When a new tab is created is also selected

Previously it was selected always the last tab because the action
sequence was:

 - create the new tab (in the last position)
 - select the new tab index (last)
 - sort the tabs (the new tab is now in the middle but the selected
   is always the last)

instead the correct action sequence is

 - create the new tab (in the last position)
 - sort the tabs (now the new tab is in the middle)
 - select the new tab index (now the correct index is selected)
This commit is contained in:
Cristian Maglie 2016-11-07 12:25:53 +01:00
parent 5244daa5d1
commit 10dcc1d932
2 changed files with 1 additions and 1 deletions

View File

@ -1711,6 +1711,7 @@ public class Editor extends JFrame implements RunnerListener {
protected void addTab(SketchFile file, String contents) throws IOException {
EditorTab tab = new EditorTab(this, file, contents);
tabs.add(tab);
reorderTabs();
}
protected void removeTab(SketchFile file) throws IOException {

View File

@ -323,7 +323,6 @@ public class EditorHeader extends JComponent {
if (sketch != null) {
menu.addSeparator();
editor.reorderTabs();
int i = 0;
for (EditorTab tab : editor.getTabs()) {
SketchFile file = tab.getSketchFile();