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() {
16911691 selectTab (0 );
16921692 }
16931693
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+
16941712 /**
16951713 * Add a new tab.
16961714 *
Original file line number Diff line number Diff line change @@ -323,6 +323,7 @@ public void rebuildMenu() {
323323 if (sketch != null ) {
324324 menu .addSeparator ();
325325
326+ editor .reorderTabs ();
326327 int i = 0 ;
327328 for (EditorTab tab : editor .getTabs ()) {
328329 SketchFile file = tab .getSketchFile ();
You can’t perform that action at this time.
0 commit comments