mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-31 20:52:13 +01:00
Merge SketchData.sortCodes()
into addCode()
By now, all calls to `addCode()` were followed by a call to `sortCodes()`, and it seems like a task for SketchData to keep its list sorted. Previously, this separation made some sense, since `addCode()` was also used while loading a sketch, and you would only want to sort once. Now, sketch loading uses a SortedSet, so this is no longer a requirement.
This commit is contained in:
parent
f7fdd08695
commit
31284feb9b
@ -374,9 +374,6 @@ public class Sketch {
|
||||
data.addCode(code);
|
||||
}
|
||||
|
||||
// sort the entries
|
||||
data.sortCode();
|
||||
|
||||
// set the new guy as current
|
||||
editor.selectTab(editor.findTabIndex(newName));
|
||||
|
||||
@ -828,7 +825,6 @@ public class Sketch {
|
||||
} else {
|
||||
ensureExistence();
|
||||
data.addCode(newCode);
|
||||
data.sortCode();
|
||||
}
|
||||
editor.selectTab(editor.findTabIndex(filename));
|
||||
}
|
||||
|
@ -181,6 +181,7 @@ public class SketchData {
|
||||
|
||||
public void addCode(SketchCode sketchCode) {
|
||||
codes.add(sketchCode);
|
||||
Collections.sort(codes, CODE_DOCS_COMPARATOR);
|
||||
}
|
||||
|
||||
protected void replaceCode(SketchCode newCode) {
|
||||
@ -192,10 +193,6 @@ public class SketchData {
|
||||
}
|
||||
}
|
||||
|
||||
protected void sortCode() {
|
||||
Collections.sort(codes, CODE_DOCS_COMPARATOR);
|
||||
}
|
||||
|
||||
public SketchCode getCode(int i) {
|
||||
return codes.get(i);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user