Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

Popup asking to save before closing for ContingencyStoreEditor #94

Merged
merged 12 commits into from
Nov 9, 2018

Conversation

miovd
Copy link
Contributor

@miovd miovd commented Oct 25, 2018

Note: TODO - same thing in scripts

@miovd miovd requested a review from mathbagu October 25, 2018 15:33
Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 2

Including the following issue(s) which could not be reported in line:

  1. Code Smell Code Smell: Remove the "gsePane" field and declare it as a local variable in the relevant methods. (more)

See all issues in SonarCloud

save();
return true;
} else if (type == dontSaveAndContinue) {
saved.set(true);
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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() {
Copy link
Contributor

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() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark

Copy link
Contributor Author

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() {
Copy link
Contributor

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() {
Copy link
Contributor

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() {
Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark

@miovd miovd changed the title Popup asking to save before closing for ContingencyStoreEditor [WIP] Popup asking to save before closing for ContingencyStoreEditor Oct 29, 2018
Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 1

See all issues in SonarCloud

Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 1

See all issues in SonarCloud

@miovd miovd changed the title [WIP] Popup asking to save before closing for ContingencyStoreEditor Popup asking to save before closing for ContingencyStoreEditor Oct 29, 2018
Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 1

See all issues in SonarCloud

Copy link
Contributor

@mathbagu mathbagu left a 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"));
Copy link
Contributor

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());

Copy link
Contributor

@mathbagu mathbagu left a 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.

@mathbagu mathbagu dismissed their stale review November 5, 2018 22:19

I miss something

@mathbagu mathbagu changed the title Popup asking to save before closing for ContingencyStoreEditor [WIP] Popup asking to save before closing for ContingencyStoreEditor Nov 5, 2018
Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 1

See all issues in SonarCloud

ralambotianamio added 3 commits November 7, 2018 15:28
- 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
Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 1

See all issues in SonarCloud

@miovd miovd changed the title [WIP] Popup asking to save before closing for ContingencyStoreEditor Popup asking to save before closing for ContingencyStoreEditor Nov 7, 2018
Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 1

See all issues in SonarCloud

Copy link

@sonarcloud sonarcloud bot left a 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:
Bug Bugs: 0
Vulnerability Vulnerabilities: 0
Code Smell Code Smells: 1

See all issues in SonarCloud

@@ -135,4 +135,10 @@ public void dispose() {
storableScript.removeListener(this);
}

@Override
public boolean isClosable() {
//TODO: save before close
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Smell Code Smell: Complete the task associated to this TODO comment. (squid:S1135)

See it in SonarCloud

@mathbagu mathbagu merged commit ef79ff7 into master Nov 9, 2018
@mathbagu mathbagu deleted the save_before_closing_cse branch November 9, 2018 21:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants