Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEsteban Dugueperoux2015-11-12 10:21:11 +0000
committerLaurent Redor2015-11-20 09:47:16 +0000
commitec52fd1e759e82878d123974095ca0f0faf9c483 (patch)
treeef2d44e2164e03d1062ae8b85b6432a4702e462e
parent7d5afd3d6dd93e4e3b20a94cd9273e0fdf5960fb (diff)
downloadorg.eclipse.sirius-ec52fd1e759e82878d123974095ca0f0faf9c483.tar.gz
org.eclipse.sirius-ec52fd1e759e82878d123974095ca0f0faf9c483.tar.xz
org.eclipse.sirius-ec52fd1e759e82878d123974095ca0f0faf9c483.zip
[482648] Have Sequence diagram refresh check IPermissionAuthorityv3.1.3
Bug: 482648 Change-Id: I628a417dae32ca0b58d472ff4bf0bed42765ba59 Signed-off-by: Esteban Dugueperoux <esteban.dugueperoux@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java86
1 files changed, 45 insertions, 41 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java
index 5704c76683..ee77cd9911 100644
--- a/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java
+++ b/plugins/org.eclipse.sirius.diagram.sequence/src/org/eclipse/sirius/diagram/sequence/business/internal/refresh/RefreshLayoutCommand.java
@@ -25,6 +25,8 @@ import org.eclipse.sirius.diagram.sequence.business.internal.operation.Synchroni
import org.eclipse.sirius.diagram.sequence.business.internal.ordering.RefreshOrderingHelper;
import org.eclipse.sirius.diagram.sequence.ordering.EventEnd;
import org.eclipse.sirius.diagram.ui.business.internal.operation.AbstractModelChangeOperation;
+import org.eclipse.sirius.ecore.extender.business.api.permission.IPermissionAuthority;
+import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry;
import org.eclipse.sirius.ui.tools.api.profiler.SiriusTasks;
/**
@@ -68,54 +70,56 @@ public class RefreshLayoutCommand extends RecordingCommand {
protected void doExecute() {
DslCommonPlugin.PROFILER.startWork(REFRESH_LAYOUT);
SequenceDiagram sequenceDiagram = ISequenceElementAccessor.getSequenceDiagram(diagram).get();
- sequenceDiagram.useCache(true);
- try {
- SequenceDDiagram sequenceDDiagram = sequenceDiagram.getSequenceDDiagram();
-
- /*
- * Everything has been committed, so we should be in a stable state
- * where it is safe to refresh both orderings.
- */
+ SequenceDDiagram sequenceDDiagram = sequenceDiagram.getSequenceDDiagram();
+ IPermissionAuthority permissionAuthority = PermissionAuthorityRegistry.getDefault().getPermissionAuthority(sequenceDDiagram);
+ if (permissionAuthority != null && permissionAuthority.canEditInstance(sequenceDDiagram)) {
+ sequenceDiagram.useCache(true);
+ try {
+ /*
+ * Everything has been committed, so we should be in a stable
+ * state where it is safe to refresh both orderings.
+ */
- // Compute only once (and not three times) the event ends.
- final Iterable<? extends EventEnd> allEventEnds = RefreshOrderingHelper.getAllEventEnds(sequenceDDiagram);
+ // Compute only once (and not three times) the event ends.
+ final Iterable<? extends EventEnd> allEventEnds = RefreshOrderingHelper.getAllEventEnds(sequenceDDiagram);
- AbstractModelChangeOperation<Boolean> refreshSemanticOrderingOperation = new RefreshSemanticOrderingsOperation(sequenceDDiagram) {
- @Override
- protected Iterable<? extends EventEnd> getAllEventEnds() {
- return allEventEnds;
- }
- };
- if (refreshSemanticOrderingOperation.execute()) {
- sequenceDiagram.clearOrderedCaches();
- }
- AbstractModelChangeOperation<Boolean> refreshGraphicalOrderingOperation = new RefreshGraphicalOrderingOperation(sequenceDiagram) {
- @Override
- protected Iterable<? extends EventEnd> getAllEventEnds() {
- return allEventEnds;
+ AbstractModelChangeOperation<Boolean> refreshSemanticOrderingOperation = new RefreshSemanticOrderingsOperation(sequenceDDiagram) {
+ @Override
+ protected Iterable<? extends EventEnd> getAllEventEnds() {
+ return allEventEnds;
+ }
+ };
+ if (refreshSemanticOrderingOperation.execute()) {
+ sequenceDiagram.clearOrderedCaches();
}
- };
- if (refreshGraphicalOrderingOperation.execute()) {
- sequenceDiagram.clearOrderedCaches();
- }
-
- if (refreshDiagram) {
- /*
- * Launch a non-packing layout
- */
- AbstractModelChangeOperation<Boolean> synchronizeGraphicalOrderingOperation = new SynchronizeGraphicalOrderingOperation(diagram, false);
- synchronizeGraphicalOrderingOperation.execute();
- /*
- * The layout has probably changed graphical positions:
- * re-compute the ordering to make sure it is up-to-date.
- */
+ AbstractModelChangeOperation<Boolean> refreshGraphicalOrderingOperation = new RefreshGraphicalOrderingOperation(sequenceDiagram) {
+ @Override
+ protected Iterable<? extends EventEnd> getAllEventEnds() {
+ return allEventEnds;
+ }
+ };
if (refreshGraphicalOrderingOperation.execute()) {
sequenceDiagram.clearOrderedCaches();
}
+
+ if (refreshDiagram) {
+ /*
+ * Launch a non-packing layout
+ */
+ AbstractModelChangeOperation<Boolean> synchronizeGraphicalOrderingOperation = new SynchronizeGraphicalOrderingOperation(diagram, false);
+ synchronizeGraphicalOrderingOperation.execute();
+ /*
+ * The layout has probably changed graphical positions:
+ * re-compute the ordering to make sure it is up-to-date.
+ */
+ if (refreshGraphicalOrderingOperation.execute()) {
+ sequenceDiagram.clearOrderedCaches();
+ }
+ }
+ } finally {
+ sequenceDiagram.useCache(false);
+ sequenceDiagram.clearAllCaches();
}
- } finally {
- sequenceDiagram.useCache(false);
- sequenceDiagram.clearAllCaches();
}
DslCommonPlugin.PROFILER.stopWork(REFRESH_LAYOUT);
}

Back to the top