Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Schnekenburger2017-02-13 17:30:20 +0000
committerGerrit Code Review @ Eclipse.org2017-02-14 09:26:23 +0000
commit6bdb73c47c176c55389b6396aa6d90b7373fa038 (patch)
treee3fbb28dcba3c497b62b93cfef160f787d5b5e9e
parent3a1e3c516d04671c102267c8d4547e21432aeed2 (diff)
downloadorg.eclipse.papyrus-6bdb73c47c176c55389b6396aa6d90b7373fa038.tar.gz
org.eclipse.papyrus-6bdb73c47c176c55389b6396aa6d90b7373fa038.tar.xz
org.eclipse.papyrus-6bdb73c47c176c55389b6396aa6d90b7373fa038.zip
Bug 512133: [StateMachine] Transition container is set by default to
source state container rather than than request container https://bugs.eclipse.org/bugs/show_bug.cgi?id=512133 - compute the new container only if it is not a valid region Change-Id: I6ed56e9112fa1f3f0a4540e4d360be4c761dfbd7 Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com>
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/TransitionEditHelper.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/TransitionEditHelper.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/TransitionEditHelper.java
index bfcc1201b49..1e5cd9e6065 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/TransitionEditHelper.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/TransitionEditHelper.java
@@ -30,6 +30,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.infra.tools.util.TypeUtils;
import org.eclipse.uml2.uml.Region;
import org.eclipse.uml2.uml.StateMachine;
import org.eclipse.uml2.uml.Transition;
@@ -65,14 +66,17 @@ public class TransitionEditHelper extends ElementEditHelper {
if (false == target instanceof Vertex) {
return UnexecutableCommand.INSTANCE;
}
- Region container = findRegionContainer((Vertex) source);
- if (null == container) {
- container = findRegionContainer((Vertex) target);
+ Region container = TypeUtils.as(req.getContainer(), Region.class);
+ if (container == null) {
+ container = findRegionContainer((Vertex) source);
if (null == container) {
- // If neither the source nor the Target are contained in a Region, create the transition in the first Region of StateMachine.
- container = getFirstRegionStateMachine((Vertex) source);
+ container = findRegionContainer((Vertex) target);
if (null == container) {
- return UnexecutableCommand.INSTANCE;
+ // If neither the source nor the Target are contained in a Region, create the transition in the first Region of StateMachine.
+ container = getFirstRegionStateMachine((Vertex) source);
+ if (null == container) {
+ return UnexecutableCommand.INSTANCE;
+ }
}
}
}

Back to the top