-
Notifications
You must be signed in to change notification settings - Fork 4
Popup asking to save before closing for ContingencyStoreEditor #94
Conversation
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.
SonarQube analysis found issues:
Bugs: 0
Vulnerabilities: 0
Code Smells: 2
Including the following issue(s) which could not be reported in line:
Code Smell: Remove the "gsePane" field and declare it as a local variable in the relevant methods. (more)
save(); | ||
return true; | ||
} else if (type == dontSaveAndContinue) { | ||
saved.set(true); |
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.
Seems weird to set saved to true here: this is not logic. Is it really needed?
UnsavedQuitConfirmation=is not saved, its modifications will be lost. Would you like to save the file first ? | ||
SaveAndContinue=Save and Continue | ||
DontSaveAndContinue=Don't save and Continue | ||
Cancel=Cancel |
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.
Sort entries by alphabetical order: it will be easier to find the missing properties
UnsavedQuitConfirmation=n'est pas sauvegard�, ses modifications seront perdues. Voulez vous enregistrer ce fichier d'abord ? | ||
SaveAndContinue=Enregistrer et Continuer | ||
DontSaveAndContinue=Continuer sans enregistrer | ||
Cancel=Annuler |
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.
Same remark
@@ -5,3 +5,7 @@ NewName=Nouveau nom | |||
Rename=Renommer | |||
RenameContingency=Renommer la contingence | |||
Remove=Supprimer | |||
UnsavedQuitConfirmation=n'est pas sauvegard�, ses modifications seront perdues. Voulez vous enregistrer ce fichier d'abord ? | |||
SaveAndContinue=Enregistrer et Continuer |
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.
Typo issue: Enregistrer et continuer
} | ||
} | ||
|
||
public boolean canBeClosed() { |
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.
Rename to isClosable
?
@@ -864,4 +874,8 @@ public void dispose() { | |||
taskItems.dispose(); | |||
closeViews(); | |||
} | |||
|
|||
public boolean canBeClosed() { |
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.
Same remark
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.
ProjectPane extends Tab which already has a final isClosable() method. I did not rename it here.
@@ -360,4 +360,9 @@ public void dispose() { | |||
projectCase.removeListener(this); | |||
} | |||
|
|||
@Override | |||
public boolean canBeClosed() { |
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.
Same remark
@@ -196,4 +196,9 @@ public void view() { | |||
public void dispose() { | |||
// nothing to dispose | |||
} | |||
|
|||
@Override | |||
public boolean canBeClosed() { |
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.
Same remark
@@ -139,4 +139,9 @@ public void dispose() { | |||
preContResultPane.savePreferences(); | |||
postContResultPane.savePreferences(); | |||
} | |||
|
|||
@Override | |||
public boolean canBeClosed() { |
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.
Same remark
@@ -19,4 +19,5 @@ | |||
|
|||
void dispose(); | |||
|
|||
boolean canBeClosed(); |
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.
Same remark
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.
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.
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.
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.
There is something weird in the logic of GsePane::dispose
and GsePane::isClosable
: I'm not sure the closable attribute is needed: a GsePane is closable is all the tabs are closable. The dispose
method should call isClosable
and dispose all the tabs only if the GsePane is closable.
@@ -286,6 +286,26 @@ private ContextMenu createContingencyElementMenu() { | |||
return new ContextMenu(removeItem); | |||
} | |||
|
|||
private boolean alertSave() { | |||
Alert alert = new Alert(Alert.AlertType.CONFIRMATION); | |||
alert.setHeaderText("'" + this.store.getName() + "' " + RESOURCE_BUNDLE.getString("UnsavedQuitConfirmation")); |
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:
MessageFormat.format(RESOURCE_BUNDLE.getString("UnsavedQuitConfirmation"), store.getName());
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.
There is a cosmetic issue: the label of the buttons are too long in french and are cut.
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.
- rename isClosable() (except in ProjectPane which extends a Tab) - check if it is closable before calling dispose() - when deleting a file, the closing is forced even if not saved
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.
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.
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.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Code Smell: Complete the task associated to this TODO comment. (squid:S1135)
Note: TODO - same thing in scripts