Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFanch BONNABESSE2016-02-04 14:57:17 +0000
committerGerrit Code Review @ Eclipse.org2016-02-18 13:05:45 +0000
commit7ba44c7a4107388464ddbea256ed6072a063b1a6 (patch)
treef64af063fc6ad0909e8554df0282bc2698cfbbf3
parenta9fe08a26226520edbf4ff449e1eb1429fe96ad0 (diff)
downloadorg.eclipse.papyrus-7ba44c7a4107388464ddbea256ed6072a063b1a6.tar.gz
org.eclipse.papyrus-7ba44c7a4107388464ddbea256ed6072a063b1a6.tar.xz
org.eclipse.papyrus-7ba44c7a4107388464ddbea256ed6072a063b1a6.zip
Bug 487237: [StateMachine Diagram] Create/Restore link doesn't work for
state machine diagram. Check if the relationship created is a Transition https://bugs.eclipse.org/bugs/show_bug.cgi?id=487237 Signed-off-by: Fanch BONNABESSE <fanch.bonnabesse@all4tec.net> Change-Id: I628d7d82f82cbaef2844279b4df9ab546149c92e
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/CreateOrShowExistingElementHelper.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/LinkMappingHelper.java11
2 files changed, 22 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/CreateOrShowExistingElementHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/CreateOrShowExistingElementHelper.java
index 56e7aa92ad5..a14409097a2 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/CreateOrShowExistingElementHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/CreateOrShowExistingElementHelper.java
@@ -43,6 +43,7 @@ import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.UMLPackage;
/**
@@ -236,6 +237,16 @@ public class CreateOrShowExistingElementHelper {
}
}
}
+ } else if (UMLPackage.eINSTANCE.getTransition().equals(wantedEClass)) {
+ for (final Element current : ((Region) request.getContainer()).getTransitions()) {
+ if (hasWantedType(current, wantedElementType)) {
+ final Collection<?> sources = this.linkMappingHelper.getSource(current);
+ final Collection<?> targets = this.linkMappingHelper.getTarget(current);
+ if (sources.contains(request.getSource()) && targets.contains(request.getTarget())) {
+ existingElement.add(new LinkEndsMapper(current, null, sources, targets));
+ }
+ }
+ }
} else {
for (final Element current : ((Element) request.getContainer()).getOwnedElements()) {
if (hasWantedType(current, wantedElementType)) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/LinkMappingHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/LinkMappingHelper.java
index e46e6d9fd2d..f8fb5b9eb60 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/LinkMappingHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/helper/LinkMappingHelper.java
@@ -26,6 +26,7 @@ import org.eclipse.uml2.uml.ConnectorEnd;
import org.eclipse.uml2.uml.Constraint;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.InterfaceRealization;
+import org.eclipse.uml2.uml.Transition;
import org.eclipse.uml2.uml.util.UMLSwitch;
/**
@@ -160,6 +161,11 @@ public class LinkMappingHelper {
public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) {
return Collections.EMPTY_LIST;
};
+
+ @Override
+ public Collection<?> caseTransition(Transition object) {
+ return Collections.singletonList(object.getSource());
+ }
}
/**
@@ -240,6 +246,11 @@ public class LinkMappingHelper {
public Collection<?> defaultCase(org.eclipse.emf.ecore.EObject object) {
return Collections.EMPTY_LIST;
};
+
+ @Override
+ public Collection<?> caseTransition(Transition object) {
+ return Collections.singletonList(object.getTarget());
+ }
}
}

Back to the top