Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime PORHEL2014-07-08 16:57:49 +0000
committerMaxime PORHEL2014-07-09 09:27:02 +0000
commitac2f92dc002f7a655398fd31e24b8dbb4c8b051c (patch)
tree68199a532653acc73bab28c54b7580875d3112b2
parentc6b7151a193e20ee63d48326a90f060c6d6edf87 (diff)
downloadorg.eclipse.sirius-ac2f92dc002f7a655398fd31e24b8dbb4c8b051c.tar.gz
org.eclipse.sirius-ac2f92dc002f7a655398fd31e24b8dbb4c8b051c.tar.xz
org.eclipse.sirius-ac2f92dc002f7a655398fd31e24b8dbb4c8b051c.zip
[cleanup] Compute subdiagram decorator with activated Viewpoints only
Bug: 439140 Change-Id: I16818ad31c101dbee46d5dc197857d0b75f6b1c6 Signed-off-by: Maxime PORHEL <maxime.porhel@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/providers/decorators/SubDiagramDecorator.java45
1 files changed, 27 insertions, 18 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/providers/decorators/SubDiagramDecorator.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/providers/decorators/SubDiagramDecorator.java
index 4767235f10..c7b699014a 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/providers/decorators/SubDiagramDecorator.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/providers/decorators/SubDiagramDecorator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2014 THALES GLOBAL SERVICES.
+ * Copyright (c) 2012, 2014 THALES GLOBAL SERVICES and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,6 +22,7 @@ import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator;
import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.sirius.business.api.componentization.ViewpointRegistry;
import org.eclipse.sirius.business.api.dialect.DialectManager;
import org.eclipse.sirius.business.api.logger.RuntimeLoggerManager;
import org.eclipse.sirius.business.api.query.DRepresentationElementQuery;
@@ -39,6 +40,8 @@ import org.eclipse.sirius.viewpoint.DRepresentation;
import org.eclipse.sirius.viewpoint.DRepresentationElement;
import org.eclipse.sirius.viewpoint.DSemanticDecorator;
import org.eclipse.sirius.viewpoint.SiriusPlugin;
+import org.eclipse.sirius.viewpoint.description.RepresentationDescription;
+import org.eclipse.sirius.viewpoint.description.Viewpoint;
import org.eclipse.sirius.viewpoint.description.tool.RepresentationNavigationDescription;
import org.eclipse.sirius.viewpoint.description.tool.ToolPackage;
import org.eclipse.swt.graphics.Image;
@@ -159,32 +162,38 @@ public class SubDiagramDecorator extends AbstractDecorator {
IInterpreter interpreter = session.getInterpreter();
for (RepresentationNavigationDescription navDesc : element.getMapping().getNavigationDescriptions()) {
-
- interpreter.setVariable(navDesc.getContainerVariable().getName(), target);
- interpreter.setVariable(navDesc.getContainerViewVariable().getName(), element);
-
- boolean precondition = true;
- if (!StringUtil.isEmpty(navDesc.getPrecondition())) {
- try {
- precondition = interpreter.evaluateBoolean(target, navDesc.getPrecondition());
- } catch (EvaluationException e) {
- RuntimeLoggerManager.INSTANCE.error(navDesc, ToolPackage.eINSTANCE.getAbstractToolDescription_Precondition(), e);
+ if (isFromActiveViewpoint(navDesc.getRepresentationDescription())) {
+ interpreter.setVariable(navDesc.getContainerVariable().getName(), target);
+ interpreter.setVariable(navDesc.getContainerViewVariable().getName(), element);
+
+ boolean precondition = true;
+ if (!StringUtil.isEmpty(navDesc.getPrecondition())) {
+ try {
+ precondition = interpreter.evaluateBoolean(target, navDesc.getPrecondition());
+ } catch (EvaluationException e) {
+ RuntimeLoggerManager.INSTANCE.error(navDesc, ToolPackage.eINSTANCE.getAbstractToolDescription_Precondition(), e);
+ }
}
- }
- if (precondition) {
- if (checkRepresentationNavigationDescription(interpreter, navDesc, element)) {
- return true;
+ if (precondition) {
+ if (checkRepresentationNavigationDescription(interpreter, navDesc, element)) {
+ return true;
+ }
}
- }
- interpreter.unSetVariable(navDesc.getContainerVariable().getName());
- interpreter.unSetVariable(navDesc.getContainerViewVariable().getName());
+ interpreter.unSetVariable(navDesc.getContainerVariable().getName());
+ interpreter.unSetVariable(navDesc.getContainerViewVariable().getName());
+ }
}
}
return false;
}
+ private boolean isFromActiveViewpoint(final RepresentationDescription description) {
+ final Viewpoint vp = ViewpointRegistry.getInstance().getViewpoint(description);
+ return vp != null && session.getSelectedViewpoints(false).contains(vp);
+ }
+
private boolean checkRepresentationNavigationDescription(IInterpreter interpreter, RepresentationNavigationDescription navDesc, DRepresentationElement element) {
Collection<EObject> candidates = null;
if (!StringUtil.isEmpty(navDesc.getBrowseExpression())) {

Back to the top