Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2017-08-11 08:11:35 -0400
committerJeremie Tatibouet2017-09-01 11:46:02 -0400
commit19f3f5ce9704dcceeacf41b7df72aced2b957ca8 (patch)
tree6b845fde0e240d414ce3a2ff389c1107ba8985d3 /plugins
parent0042720343474aa24e5d43e8a8fbd437014067b8 (diff)
downloadorg.eclipse.papyrus-19f3f5ce9704dcceeacf41b7df72aced2b957ca8.tar.gz
org.eclipse.papyrus-19f3f5ce9704dcceeacf41b7df72aced2b957ca8.tar.xz
org.eclipse.papyrus-19f3f5ce9704dcceeacf41b7df72aced2b957ca8.zip
Bug 497283 - [StateMachineDiagram] internal transition appear when the
state is synchronized Change-Id: Ibfa422a05a7983639bf58eeb4c76fc3c4436868d Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/strategies/StateSemanticConnectionsStrategy.java76
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml8
2 files changed, 84 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/strategies/StateSemanticConnectionsStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/strategies/StateSemanticConnectionsStrategy.java
new file mode 100644
index 00000000000..3020a8b67d2
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/strategies/StateSemanticConnectionsStrategy.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Pauline DEVILLE (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.statemachine.custom.strategies;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.common.canonical.DefaultUMLSemanticChildrenStrategy;
+import org.eclipse.uml2.uml.State;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.TransitionKind;
+
+/**
+ *
+ */
+public class StateSemanticConnectionsStrategy extends DefaultUMLSemanticChildrenStrategy {
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.canonical.DefaultUMLSemanticChildrenStrategy#getCanonicalSemanticConnections(org.eclipse.emf.ecore.EObject, org.eclipse.gmf.runtime.notation.View)
+ *
+ * @param semanticFromEditPart
+ * @param viewFromEditPart
+ * @return
+ */
+ @Override
+ public List<? extends EObject> getCanonicalSemanticConnections(EObject semanticFromEditPart, View viewFromEditPart) {
+ List<? extends EObject> result = super.getCanonicalSemanticConnections(semanticFromEditPart, viewFromEditPart);
+ List<Transition> toRemove = new ArrayList<>();
+ for (EObject object : result) {
+ if (object instanceof Transition) {
+ Transition transition = (Transition) object;
+ if (transition.getKind().getValue() == TransitionKind.INTERNAL) {
+ toRemove.add(transition);
+ }
+ }
+ }
+ result.removeAll(toRemove);
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.common.canonical.DefaultUMLSemanticChildrenStrategy#getCanonicalSemanticChildren(org.eclipse.emf.ecore.EObject, org.eclipse.gmf.runtime.notation.View)
+ *
+ * @param semanticFromEditPart
+ * @param viewFromEditPart
+ * @return
+ */
+ @Override
+ public List<? extends EObject> getCanonicalSemanticChildren(EObject semanticFromEditPart, View viewFromEditPart) {
+ List<EObject> result = (List<EObject>) super.getCanonicalSemanticChildren(semanticFromEditPart, viewFromEditPart);
+ List<Transition> toAdd = new ArrayList<>();
+ if (semanticFromEditPart instanceof State) {
+ State state = (State) semanticFromEditPart;
+ for (Transition transition : state.getOutgoings()) {
+ if (transition.getKind().getValue() == TransitionKind.INTERNAL) {
+ toAdd.add(transition);
+ }
+ }
+ }
+ result.addAll(toAdd);
+ return result;
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
index 4d06bd5c37c..e5c024d380a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
@@ -518,6 +518,14 @@
<extension point="org.eclipse.papyrus.infra.gmfdiag.assistant.modelProviders">
<modelProvider uri="model/stateMachineDiagram.assistants"/>
+</extension>
+<extension
+ point="org.eclipse.papyrus.infra.gmfdiag.canonical.strategies">
+ <semanticChildrenStrategy
+ class="org.eclipse.papyrus.uml.diagram.statemachine.custom.strategies.StateSemanticConnectionsStrategy"
+ editPart="org.eclipse.papyrus.uml.diagram.statemachine.edit.parts.StateEditPart"
+ priority="50">
+ </semanticChildrenStrategy>
</extension>

Back to the top