mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-13 10:29:35 +01:00
parent
4e84238527
commit
c6642c1bd2
@ -1691,6 +1691,24 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
selectTab(0);
|
||||
}
|
||||
|
||||
private static final Comparator<EditorTab> CODE_DOCS_COMPARATOR = new Comparator<EditorTab>() {
|
||||
@Override
|
||||
public int compare(EditorTab x, EditorTab y) {
|
||||
if (x.getSketchFile().isPrimary() && !y.getSketchFile().isPrimary())
|
||||
return -1;
|
||||
if (y.getSketchFile().isPrimary() && !x.getSketchFile().isPrimary())
|
||||
return 1;
|
||||
return x.getSketchFile().getFileName().compareTo(y.getSketchFile().getFileName());
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Reorders tabs as per current sketch's files order
|
||||
*/
|
||||
public void reorderTabs() {
|
||||
Collections.sort(tabs, CODE_DOCS_COMPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new tab.
|
||||
*
|
||||
|
@ -323,6 +323,7 @@ public class EditorHeader extends JComponent {
|
||||
if (sketch != null) {
|
||||
menu.addSeparator();
|
||||
|
||||
editor.reorderTabs();
|
||||
int i = 0;
|
||||
for (EditorTab tab : editor.getTabs()) {
|
||||
SketchFile file = tab.getSketchFile();
|
||||
|
Loading…
x
Reference in New Issue
Block a user