Fix issue where closing the last tab didn't cause the application state to be saved
This commit is contained in:
parent
fa4e4fdead
commit
2e6e1c147c
1 changed files with 10 additions and 2 deletions
|
@ -131,6 +131,10 @@ public class HomeWindowController implements Initializable {
|
|||
addTab(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new tab to the homeWindowTabPane initialized with
|
||||
* the ComposerState provided.
|
||||
*/
|
||||
private void addTab(ComposerState composerState) {
|
||||
Tab newTab = new Tab();
|
||||
|
||||
|
@ -143,9 +147,11 @@ public class HomeWindowController implements Initializable {
|
|||
|
||||
newTab.setOnCloseRequest(e -> {
|
||||
tabStateMap.remove(newTab);
|
||||
homeWindowTabPane.getTabs().remove(newTab);
|
||||
|
||||
// Closes the application if the last tab is closed
|
||||
if (homeWindowTabPane.getTabs().size() == 1) {
|
||||
if (homeWindowTabPane.getTabs().size() == 0) {
|
||||
saveState();
|
||||
Stage thisStage = (Stage) homeWindowSP.getScene().getWindow();
|
||||
thisStage.close();
|
||||
}
|
||||
|
@ -247,7 +253,9 @@ public class HomeWindowController implements Initializable {
|
|||
} else if (KeyMap.closeTab.match(e)) {
|
||||
Tab activeTab = homeWindowTabPane.getSelectionModel().getSelectedItem();
|
||||
tabStateMap.remove(activeTab);
|
||||
if (homeWindowTabPane.getTabs().size() == 1) {
|
||||
homeWindowTabPane.getTabs().remove(activeTab);
|
||||
if (homeWindowTabPane.getTabs().size() == 0) {
|
||||
saveState();
|
||||
Stage thisStage = (Stage) homeWindowSP.getScene().getWindow();
|
||||
thisStage.close();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue