diff options
| author | Pierre Guilet | 2018-08-08 13:42:38 +0000 |
|---|---|---|
| committer | Pierre Guilet | 2018-08-08 13:42:38 +0000 |
| commit | 31aa54ba99b338abb4a4825381c9151284fff74d (patch) | |
| tree | 9492d3cbda78724e668e847ea7c4b32f9563a80f | |
| parent | 58c75bfa8ff4b5bf149e61050b88ce679030cf6d (diff) | |
| download | org.eclipse.sirius-31aa54ba99b338abb4a4825381c9151284fff74d.tar.gz org.eclipse.sirius-31aa54ba99b338abb4a4825381c9151284fff74d.tar.xz org.eclipse.sirius-31aa54ba99b338abb4a4825381c9151284fff74d.zip | |
[536995] Improve dialog UI
- The popup asking user to save now displays the label provided by
AbstractSWTCallback.getSessionNameToDisplayWhileSaving(Session) instead
of the aird file resource name.
- The useless cancel button has been removed.
Bug: 536995
Change-Id: I499526b581b25213eeddcb3831d97be1acc5c7a9
Signed-off-by: Pierre Guilet <pierre.guilet@obeo.fr>
2 files changed, 9 insertions, 10 deletions
diff --git a/plugins/org.eclipse.sirius.common.ui/src/org/eclipse/sirius/common/ui/tools/internal/util/MigrationUIUtil.java b/plugins/org.eclipse.sirius.common.ui/src/org/eclipse/sirius/common/ui/tools/internal/util/MigrationUIUtil.java index 48c9f57c70..67cea6c210 100644 --- a/plugins/org.eclipse.sirius.common.ui/src/org/eclipse/sirius/common/ui/tools/internal/util/MigrationUIUtil.java +++ b/plugins/org.eclipse.sirius.common.ui/src/org/eclipse/sirius/common/ui/tools/internal/util/MigrationUIUtil.java @@ -45,34 +45,33 @@ public final class MigrationUIUtil { public static boolean shouldMigratedElementBeSaved(Resource resource) { String migrateFrom = hasBeenMigratedFrom(resource); if (migrateFrom != null && shouldUserBeWarnedAboutMigration(resource)) { - return doAskUserIfElementShouldBeSaved(resource); + String message = MessageFormat.format(Messages.MigrationUIUtil_askToSaveChanges, resource.getURI().lastSegment()); + return SWTUtil.showSaveDialogWithMessage(resource, message, false) == ISaveablePart2.YES; } return false; } /** * Test if the session resource has been automatically migrated. If it is the case and this is due to a direct user - * action, ask user if he want to save the session + * action, ask user if he wants to save the session * * @param session * The session to test + * @param sessionLabel + * the session label to use when interacting with user if needed. * @return <code>true</code> if the user want to save the session, <code>false</code> otherwise */ - public static boolean shouldMigratedElementBeSaved(Session session) { + public static boolean shouldMigratedElementBeSaved(Session session, String sessionLabel) { for (Resource resource : session.getAllSessionResources()) { String migrateFrom = hasBeenMigratedFrom(resource); if (migrateFrom != null && shouldUserBeWarnedAboutMigration(resource)) { - return doAskUserIfElementShouldBeSaved(resource); + String message = MessageFormat.format(Messages.MigrationUIUtil_askToSaveChanges, sessionLabel); + return SWTUtil.showSaveDialogWithMessage(resource, message, false) == ISaveablePart2.YES; } } return false; } - private static boolean doAskUserIfElementShouldBeSaved(Resource resource) { - String message = MessageFormat.format(Messages.MigrationUIUtil_askToSaveChanges, resource.getURI().lastSegment()); - return SWTUtil.showSaveDialogWithMessage(resource, message, true) == ISaveablePart2.YES; - } - /** * Test if the given resource has been migrated due to a direct user action. * diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java index be231a70fc..5c582c7f62 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/command/AbstractSWTCallback.java @@ -384,7 +384,7 @@ public abstract class AbstractSWTCallback implements UICallBack { @Override public void askUserAndSaveMigratedSession(Session session) { - if (MigrationUIUtil.shouldMigratedElementBeSaved(session)) { + if (MigrationUIUtil.shouldMigratedElementBeSaved(session, getSessionNameToDisplayWhileSaving(session))) { PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { try { new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()).run(false, false, new WorkspaceModifyOperation() { |
