aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Lagarde2013-12-16 11:20:39 (EST)
committerAlex Lagarde2013-12-16 11:58:51 (EST)
commit679983850e861e2584b90dc90a150e5621ca7c7d (patch)
tree415b05559724b535d2804c73d6d805de4fce1e88
parente605173ce0f974daaa9fb718ed1891dc300d3bfe (diff)
downloadorg.eclipse.sirius-679983850e861e2584b90dc90a150e5621ca7c7d.zip
org.eclipse.sirius-679983850e861e2584b90dc90a150e5621ca7c7d.tar.gz
org.eclipse.sirius-679983850e861e2584b90dc90a150e5621ca7c7d.tar.bz2
[424139] Modify SecurityExceptions error message to provide meaningfulv1.0.0M4refs/changes/70/19870/2
information to the end-user Change-Id: Idc638fa10dd38b190a88eb1ced0540a9718134d0 Signed-off-by: Alex Lagarde <alex.lagarde@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java
index dc32dfd..6078b51 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/internal/commands/ChangeViewpointSelectionCommand.java
@@ -106,10 +106,25 @@ public class ChangeViewpointSelectionCommand extends RecordingCommand {
if (newSelectedViewpoints != null) {
List<Viewpoint> sorted = sortByDependencies(newSelectedViewpoints);
monitor.worked(1);
+
for (final Viewpoint viewpoint : sorted) {
monitor.subTask("Select viewpoint : " + new IdentifiedElementQuery(viewpoint).getLabel());
- callback.selectViewpoint(viewpoint, session, createNewRepresentations, new SubProgressMonitor(monitor, 1));
+ try {
+ callback.selectViewpoint(viewpoint, session, createNewRepresentations, new SubProgressMonitor(monitor, 1));
+ } catch (SecurityException e) {
+ // If permission were not sufficient to select the
+ // viewpoint on the main or one of the referenced
+ // DAnalysis
+
+ // Provide a meaningful error message to the end-user
+ String errorMessage = "Unable to activate viewpoint '" + viewpoint.getName() + "' because of insufficient rights.";
+
+ // And re-throw the security exception with the previous
+ // as cause
+ throw new SecurityException(errorMessage, e);
+ }
}
+
}
if (newDeselectedViewpoints != null) {
for (final Viewpoint viewpoint : newDeselectedViewpoints) {