This repository has been archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Popup asking to save before closing for ContingencyStoreEditor #94
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1170fab
save before closing cse
9bcf958
Merge branch 'master' into save_before_closing_cse
miovd 554ed1a
Merge branch 'master' into save_before_closing_cse
mathbagu 4b82ae4
corrections: rename canBeClosed() + alphabetical properties + logic o…
3955e6a
Merge branch 'master' into save_before_closing_cse
miovd 7e5388c
Merge branch 'master' into save_before_closing_cse
miovd bc1df12
Small fixes
6528d42
cosmetics
58e6687
correction:
8d2fc83
resolve merge conflict
e73f008
Move alert in GseAlerts to mutualize code
9fc09db
Merge branch 'master' into save_before_closing_cse
mathbagu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,4 +135,10 @@ public void dispose() { | |
storableScript.removeListener(this); | ||
} | ||
|
||
@Override | ||
public boolean isClosable() { | ||
//TODO: save before close | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return true; | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
gse-afs-ext-base/src/main/resources/lang/ContingencyStore.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
Cancel=Cancel | ||
CreateContingencies=Create contingencies | ||
DontSaveAndContinue=Don't save and continue | ||
EditContingencies=Edit contingencies | ||
Name=Name | ||
NewName=New name | ||
Rename=Rename | ||
RenameContingency=Rename contingency | ||
Remove=Remove | ||
SaveAndContinue=Save and continue | ||
UnsavedQuitConfirmation=is not saved, its modifications will be lost. Would you like to save the file first ? |
4 changes: 4 additions & 0 deletions
4
gse-afs-ext-base/src/main/resources/lang/ContingencyStore_fr.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
Cancel=Annuler | ||
CreateContingencies=Cr�er des contingences | ||
DontSaveAndContinue=Continuer sans enregistrer | ||
EditContingencies=Editer les contingences | ||
Name=Nom | ||
NewName=Nouveau nom | ||
Rename=Renommer | ||
RenameContingency=Renommer la contingence | ||
Remove=Supprimer | ||
SaveAndContinue=Enregistrer et continuer | ||
UnsavedQuitConfirmation=n'est pas sauvegard�, ses modifications seront perdues. Voulez vous enregistrer ce fichier d'abord ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,8 @@ public class ProjectPane extends Tab { | |
|
||
private static final ServiceLoaderCache<ProjectFileExecutionTaskExtension> EXECUTION_TASK_EXTENSION_LOADER = new ServiceLoaderCache<>(ProjectFileExecutionTaskExtension.class); | ||
|
||
private int tabsOpen = 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure this counter is needed: the number of tabs can probably be retrieved elsewhere |
||
|
||
private static class TabKey { | ||
|
||
private final String nodeId; | ||
|
@@ -653,7 +655,23 @@ private void viewFile(ProjectFile file, ProjectFileViewerExtension viewerExtensi | |
Node graphic = viewerExtension.getMenuGraphic(file); | ||
ProjectFileViewer viewer = viewerExtension.newViewer(file, getContent().getScene(), context); | ||
Tab tab = new MyTab(tabName, viewer.getContent()); | ||
tab.setOnClosed(event -> viewer.dispose()); | ||
tabsOpen++; | ||
if (this.isClosable()) { | ||
this.setClosable(false); | ||
} | ||
tab.setOnCloseRequest(event -> { | ||
if (!viewer.isClosable()) { | ||
event.consume(); | ||
} else { | ||
viewer.dispose(); | ||
} | ||
}); | ||
tab.setOnClosed(event -> { | ||
tabsOpen--; | ||
if (tabsOpen == 0) { | ||
this.setClosable(true); | ||
} | ||
}); | ||
tab.setGraphic(graphic); | ||
tab.setTooltip(new Tooltip(tabName)); | ||
tab.setUserData(tabKey); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,5 @@ public interface ProjectFileViewer { | |
|
||
void dispose(); | ||
|
||
boolean isClosable(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use MessageFormat seems better: