1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-26 20:54:22 +01:00

When switching between tabs, add the name of the current file/tab to the title. Fixes #2765

This commit is contained in:
Federico Fissore 2015-06-25 12:08:58 +02:00
parent df667756d2
commit 2339049c0f

View File

@ -1782,6 +1782,7 @@ public class Editor extends JFrame implements RunnerListener {
} }
}); });
updateTitle();
} }
@ -2191,7 +2192,7 @@ public class Editor extends JFrame implements RunnerListener {
return false; return false;
} }
header.rebuild(); header.rebuild();
setTitle(I18n.format(_("{0} | Arduino {1}"), sketch.getName(), BaseNoGui.VERSION_NAME_LONG)); updateTitle();
// Disable untitled setting from previous document, if any // Disable untitled setting from previous document, if any
untitled = false; untitled = false;
@ -2205,6 +2206,17 @@ public class Editor extends JFrame implements RunnerListener {
// } // }
} }
private void updateTitle() {
if (sketch == null) {
return;
}
if (sketch.getName().equals(sketch.getCurrentCode().getPrettyName())) {
setTitle(I18n.format(_("{0} | Arduino {1}"), sketch.getName(), BaseNoGui.VERSION_NAME_LONG));
} else {
setTitle(I18n.format(_("{0} - {1} | Arduino {2}"), sketch.getName(), sketch.getCurrentCode().getFileName(), BaseNoGui.VERSION_NAME_LONG));
}
}
/** /**
* Actually handle the save command. If 'immediately' is set to false, * Actually handle the save command. If 'immediately' is set to false,