File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1691,6 +1691,24 @@ public void createTabs() {
1691
1691
selectTab (0 );
1692
1692
}
1693
1693
1694
+ private static final Comparator <EditorTab > CODE_DOCS_COMPARATOR = new Comparator <EditorTab >() {
1695
+ @ Override
1696
+ public int compare (EditorTab x , EditorTab y ) {
1697
+ if (x .getSketchFile ().isPrimary () && !y .getSketchFile ().isPrimary ())
1698
+ return -1 ;
1699
+ if (y .getSketchFile ().isPrimary () && !x .getSketchFile ().isPrimary ())
1700
+ return 1 ;
1701
+ return x .getSketchFile ().getFileName ().compareTo (y .getSketchFile ().getFileName ());
1702
+ }
1703
+ };
1704
+
1705
+ /**
1706
+ * Reorders tabs as per current sketch's files order
1707
+ */
1708
+ public void reorderTabs () {
1709
+ Collections .sort (tabs , CODE_DOCS_COMPARATOR );
1710
+ }
1711
+
1694
1712
/**
1695
1713
* Add a new tab.
1696
1714
*
Original file line number Diff line number Diff line change @@ -323,6 +323,7 @@ public void rebuildMenu() {
323
323
if (sketch != null ) {
324
324
menu .addSeparator ();
325
325
326
+ editor .reorderTabs ();
326
327
int i = 0 ;
327
328
for (EditorTab tab : editor .getTabs ()) {
328
329
SketchFile file = tab .getSketchFile ();
You can’t perform that action at this time.
0 commit comments