Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Fleck2017-01-11 14:18:39 +0000
committerMartin Fleck2017-01-11 14:18:39 +0000
commit976b7fd26224ab5593d26c75892c851b46363b00 (patch)
tree643e53c941302402df4bfc1ad36192516095cbdd
parent23ef1c58724606b5bb176e8fe20e66ae5bc42722 (diff)
downloadorg.eclipse.papyrus-976b7fd26224ab5593d26c75892c851b46363b00.tar.gz
org.eclipse.papyrus-976b7fd26224ab5593d26c75892c851b46363b00.tar.xz
org.eclipse.papyrus-976b7fd26224ab5593d26c75892c851b46363b00.zip
Bug 510268: [State Machine] Deleting a state does not delete transitions
Add EditHelperAdvice to delete all incoming and outgoing transitions of a Vertex element if it gets deleted. Change-Id: I3e25be2d9812eb1c0184e7904c2bc06491eabb8a Signed-off-by: Martin Fleck <mfleck@eclipsesource.com>
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations1
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/VertexEditHelperAdvice.java47
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.di2
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.notation259
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.uml15
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteTransitionsWithVertexTest.java275
-rw-r--r--tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java5
7 files changed, 603 insertions, 1 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations b/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
index 5905b299e3f..ecc9f6c3d4b 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
@@ -1100,4 +1100,5 @@
<adviceBindingsConfigurations editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.TemplateableElementEditHelperAdvice" identifier="org.eclipse.papyrus.uml.advice.TemplateableElement" inheritance="all" target="_SdHYY1YCEeS0WsAAtVmToA" xmi:id="_OGm-gAR_EeWEmNqzWv7tuw" xsi:type="elementtypesconfigurations:AdviceBindingConfiguration"/>
<adviceBindingsConfigurations description="Advice that tweaks requests to provide hints to the read-only advice" editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.UMLReadOnlyHintsAdvice" identifier="org.eclipse.papyrus.uml.advice.UMLReadOnlyHints" inheritance="all" target="_ScgUUFYCEeS0WsAAtVmToA" xmi:id="_hjfH8DCzEeWM9ILC16rEvw" xsi:type="elementtypesconfigurations:AdviceBindingConfiguration"/>
<adviceBindingsConfigurations editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.AssociationEditHelperAdvice" identifier="org.eclipse.papyrus.uml.service.types.helper.advice.AssociationEditHelperAdvice_CommunicationPath" target="_Scbb2lYCEeS0WsAAtVmToA" xmi:id="_SJGO0DWbEeWdwYNHBiYLiA" xsi:type="elementtypesconfigurations:AdviceBindingConfiguration"/>
+ <adviceBindingsConfigurations xsi:type="elementtypesconfigurations:AdviceBindingConfiguration" xmi:id="_5LsYQNckEeaJs5X9XldAaw" identifier="org.eclipse.papyrus.uml.service.types.helper.advice.VertexEditHelperAdvice" description="Advice to delete all incoming and outing transitions with a vertex." inheritance="all" editHelperAdviceClassName="org.eclipse.papyrus.uml.service.types.helper.advice.VertexEditHelperAdvice" target="_SdNe-lYCEeS0WsAAtVmToA"/>
</elementtypesconfigurations:ElementTypeSetConfiguration> \ No newline at end of file
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/VertexEditHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/VertexEditHelperAdvice.java
new file mode 100644
index 00000000000..b7b8d08f57a
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/VertexEditHelperAdvice.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2017 EclipseSource Services GmbH 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
+ *
+ * Martin Fleck (EclipseSource) - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.service.types.helper.advice;
+
+import java.util.List;
+
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.Vertex;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Edit Helper Advice to delete incoming and outgoing transitions for deleted {@link Vertex} elements.
+ *
+ * @author Martin Fleck <mfleck@eclipsesource.com>
+ */
+public class VertexEditHelperAdvice extends AbstractEditHelperAdvice {
+
+ /**
+ * Default Constructor.
+ */
+ public VertexEditHelperAdvice() {
+ }
+
+ @Override
+ protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest request) {
+ if (!(request.getElementToDestroy() instanceof Vertex)) {
+ return super.getBeforeDestroyDependentsCommand(request);
+ }
+
+ Vertex vertexToDestroy = (Vertex) request.getElementToDestroy();
+ List<Transition> transitionsToDestroy = Lists.newArrayList(vertexToDestroy.getIncomings());
+ transitionsToDestroy.addAll(vertexToDestroy.getOutgoings());
+ return request.getDestroyDependentsCommand(transitionsToDestroy);
+ }
+} \ No newline at end of file
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.di b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.di
new file mode 100644
index 00000000000..eaa91244876
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/> \ No newline at end of file
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.notation b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.notation
new file mode 100644
index 00000000000..19b9ffaad4b
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.notation
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_rI4wYNcaEeajJcal_2Mr_A" type="PapyrusUMLStateMachineDiagram" name="SmDiagram" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_rI4wYdcaEeajJcal_2Mr_A" type="StateMachine_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_rI4wYtcaEeajJcal_2Mr_A" type="StateMachine_NameLabel">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_rI4wY9caEeajJcal_2Mr_A" width="968" height="19"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_rI4wZNcaEeajJcal_2Mr_A" type="StateMachine_RegionCompartment">
+ <children xmi:type="notation:Shape" xmi:id="_rI4wZdcaEeajJcal_2Mr_A" type="Region_Shape">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_rI4wZtcaEeajJcal_2Mr_A" source="RegionAnnotationKey">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_rI4wZ9caEeajJcal_2Mr_A" key="RegionZoneKey" value=""/>
+ </eAnnotations>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_rI4waNcaEeajJcal_2Mr_A" type="Region_SubvertexCompartment">
+ <children xmi:type="notation:Shape" xmi:id="_y4ec0NcbEeajJcal_2Mr_A" type="State_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_y4fD4NcbEeajJcal_2Mr_A" type="State_NameLabel"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_y4fq8NcbEeajJcal_2Mr_A" type="State_FloatingNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_y4fq8dcbEeajJcal_2Mr_A" x="40"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_y4fq8tcbEeajJcal_2Mr_A" type="State_RegionCompartment">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_y4fq89cbEeajJcal_2Mr_A"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_i2lQENcnEeaB5Y5OmPAhhQ" type="compartment_shape_display">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_i2lQEdcnEeaB5Y5OmPAhhQ"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_i2lQEtcnEeaB5Y5OmPAhhQ"/>
+ </children>
+ <element xmi:type="uml:State" href="StateMachine.uml#_y4PzUNcbEeajJcal_2Mr_A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_y4ec0dcbEeajJcal_2Mr_A" x="342" y="72"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_zS0PcNcbEeajJcal_2Mr_A" type="Pseudostate_InitialShape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_zS02gNcbEeajJcal_2Mr_A" type="Pseudostate_InitialFloatingNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_zS02gdcbEeajJcal_2Mr_A" x="18" y="-18"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_zS02gtcbEeajJcal_2Mr_A" type="Pseudostate_InitialStereotypeLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_zS1dkNcbEeajJcal_2Mr_A" x="-6" y="-33"/>
+ </children>
+ <element xmi:type="uml:Pseudostate" href="StateMachine.uml#_zSh7kNcbEeajJcal_2Mr_A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_zS0PcdcbEeajJcal_2Mr_A" x="88" y="81"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_3gyEsNcbEeajJcal_2Mr_A" type="State_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_3gyEstcbEeajJcal_2Mr_A" type="State_NameLabel"/>
+ <children xmi:type="notation:DecorationNode" xmi:id="_3gyEs9cbEeajJcal_2Mr_A" type="State_FloatingNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_3gyEtNcbEeajJcal_2Mr_A" x="40"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_3gyrwNcbEeajJcal_2Mr_A" type="State_RegionCompartment">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3gyrwdcbEeajJcal_2Mr_A"/>
+ </children>
+ <element xmi:type="uml:State" href="StateMachine.uml#_3ghmANcbEeajJcal_2Mr_A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_3gyEsdcbEeajJcal_2Mr_A" x="579" y="72"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_30kjYNcbEeajJcal_2Mr_A" type="FinalState_Shape">
+ <children xmi:type="notation:DecorationNode" xmi:id="_30lKcNcbEeajJcal_2Mr_A" type="FinalState_FloatingNameLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_30lKcdcbEeajJcal_2Mr_A" x="25" y="3"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_30lxgNcbEeajJcal_2Mr_A" type="FinalState_StereotypeLabel">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_30lxgdcbEeajJcal_2Mr_A" x="25" y="-10"/>
+ </children>
+ <element xmi:type="uml:FinalState" href="StateMachine.uml#_30RocNcbEeajJcal_2Mr_A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_30kjYdcbEeajJcal_2Mr_A" x="772" y="81"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_n-5mANctEeaB5Y5OmPAhhQ" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_n-5mAdctEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_n-6NENctEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:State" href="StateMachine.uml#_y4PzUNcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_n-5mAtctEeaB5Y5OmPAhhQ" x="544" y="203"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_Hw_zwNcwEeaB5Y5OmPAhhQ" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_Hw_zwdcwEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_HxAa0NcwEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:Pseudostate" href="StateMachine.uml#_zSh7kNcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Hw_zwtcwEeaB5Y5OmPAhhQ" x="314" y="211"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_K0rnMNcwEeaB5Y5OmPAhhQ" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_K0rnMdcwEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_K0sOQNcwEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:State" href="StateMachine.uml#_3ghmANcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_K0rnMtcwEeaB5Y5OmPAhhQ" x="801" y="184"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_MCOYYNcwEeaB5Y5OmPAhhQ" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_MCOYYdcwEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_MCOYY9cwEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:FinalState" href="StateMachine.uml#_30RocNcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_MCOYYtcwEeaB5Y5OmPAhhQ" x="976" y="200"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_rI4wadcaEeajJcal_2Mr_A"/>
+ </children>
+ <element xmi:type="uml:Region" href="StateMachine.uml#_rIxboNcaEeajJcal_2Mr_A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_rI4watcaEeajJcal_2Mr_A" width="968" height="226"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_pj6cANctEeaB5Y5OmPAhhQ" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_pj6cAdctEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_pj7DENctEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:Region" href="StateMachine.uml#_rIxboNcaEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pj6cAtctEeaB5Y5OmPAhhQ" x="200"/>
+ </children>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_rI4wa9caEeajJcal_2Mr_A" y="19" width="968" height="226"/>
+ </children>
+ <element xmi:type="uml:StateMachine" href="StateMachine.uml#_q0ueQNcaEeajJcal_2Mr_A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_rI4wbNcaEeajJcal_2Mr_A" x="64" y="21" width="968" height="245"/>
+ </children>
+ <children xmi:type="notation:Shape" xmi:id="_qiBqENctEeaB5Y5OmPAhhQ" type="StereotypeComment">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_qiBqEdctEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_qiCRINctEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:StateMachine" href="StateMachine.uml#_q0ueQNcaEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_qiBqEtctEeaB5Y5OmPAhhQ" x="230" y="30"/>
+ </children>
+ <styles xmi:type="notation:StringValueStyle" xmi:id="_rI4wbdcaEeajJcal_2Mr_A" name="diagram_compatibility_version" stringValue="1.2.0"/>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_rI4wbtcaEeajJcal_2Mr_A"/>
+ <styles xmi:type="style:PapyrusViewStyle" xmi:id="_rI4wb9caEeajJcal_2Mr_A">
+ <owner xmi:type="uml:Model" href="StateMachine.uml#_mmoGINcaEeajJcal_2Mr_A"/>
+ </styles>
+ <element xmi:type="uml:StateMachine" href="StateMachine.uml#_q0ueQNcaEeajJcal_2Mr_A"/>
+ <edges xmi:type="notation:Connector" xmi:id="_2MsmoNcbEeajJcal_2Mr_A" type="Transition_Edge" source="_zS0PcNcbEeajJcal_2Mr_A" target="_y4ec0NcbEeajJcal_2Mr_A">
+ <children xmi:type="notation:DecorationNode" xmi:id="_2Mt0wNcbEeajJcal_2Mr_A" type="Transition_NameLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_2m-u4NcbEeajJcal_2Mr_A" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_2Mt0wdcbEeajJcal_2Mr_A" x="-9" y="-16"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_2Mt0wtcbEeajJcal_2Mr_A" type="Transition_GuardLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_2nNYYNcbEeajJcal_2Mr_A" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_2Mt0w9cbEeajJcal_2Mr_A"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_2Mt0xNcbEeajJcal_2Mr_A" type="Transition_StereotypeLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_2nYXgNcbEeajJcal_2Mr_A" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_2Mt0xdcbEeajJcal_2Mr_A" x="1" y="58"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_2MsmodcbEeajJcal_2Mr_A"/>
+ <element xmi:type="uml:Transition" href="StateMachine.uml#_2HIKINcbEeajJcal_2Mr_A"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_2MsmotcbEeajJcal_2Mr_A" points="[234, 160, -643984, -643984]$[409, 159, -643984, -643984]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_2N9x8NcbEeajJcal_2Mr_A" id="(0.5825242718446602,0.47619047619047616)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_2N-ZANcbEeajJcal_2Mr_A" id="(0.0,0.43859649122807015)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_4OCMQNcbEeajJcal_2Mr_A" type="Transition_Edge" source="_y4ec0NcbEeajJcal_2Mr_A" target="_3gyEsNcbEeajJcal_2Mr_A">
+ <children xmi:type="notation:DecorationNode" xmi:id="_4OCMQ9cbEeajJcal_2Mr_A" type="Transition_NameLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_8DvSgNcbEeajJcal_2Mr_A" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_4OCMRNcbEeajJcal_2Mr_A" x="-29" y="-14"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_4OCMRdcbEeajJcal_2Mr_A" type="Transition_GuardLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_8EC0gNcbEeajJcal_2Mr_A" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_4OCMRtcbEeajJcal_2Mr_A"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_4OCMR9cbEeajJcal_2Mr_A" type="Transition_StereotypeLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_8EVvcNcbEeajJcal_2Mr_A" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_4OCMSNcbEeajJcal_2Mr_A" y="59"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_4OCMQdcbEeajJcal_2Mr_A"/>
+ <element xmi:type="uml:Transition" href="StateMachine.uml#_4NvRUNcbEeajJcal_2Mr_A"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_4OCMQtcbEeajJcal_2Mr_A"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_4OzBQNcbEeajJcal_2Mr_A" id="(1.0,0.43859649122807015)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_4OzBQdcbEeajJcal_2Mr_A" id="(0.0,0.43859649122807015)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_n-7bMNctEeaB5Y5OmPAhhQ" type="StereotypeCommentLink" source="_y4ec0NcbEeajJcal_2Mr_A" target="_n-5mANctEeaB5Y5OmPAhhQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_n-7bMdctEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_n_CI4NctEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:State" href="StateMachine.uml#_y4PzUNcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_n-7bMtctEeaB5Y5OmPAhhQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_n_Bh0NctEeaB5Y5OmPAhhQ"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_n_Bh0dctEeaB5Y5OmPAhhQ"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_pj7DEdctEeaB5Y5OmPAhhQ" type="StereotypeCommentLink" source="_rI4wZdcaEeajJcal_2Mr_A" target="_pj6cANctEeaB5Y5OmPAhhQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_pj7DEtctEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_pj8RMNctEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:Region" href="StateMachine.uml#_rIxboNcaEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_pj7DE9ctEeaB5Y5OmPAhhQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_pj7qINctEeaB5Y5OmPAhhQ"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_pj7qIdctEeaB5Y5OmPAhhQ"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_qiC4MNctEeaB5Y5OmPAhhQ" type="StereotypeCommentLink" source="_rI4wYdcaEeajJcal_2Mr_A" target="_qiBqENctEeaB5Y5OmPAhhQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_qiC4MdctEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_qiC4NdctEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:StateMachine" href="StateMachine.uml#_q0ueQNcaEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_qiC4MtctEeaB5Y5OmPAhhQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_qiC4M9ctEeaB5Y5OmPAhhQ"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_qiC4NNctEeaB5Y5OmPAhhQ"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_HxAa0dcwEeaB5Y5OmPAhhQ" type="StereotypeCommentLink" source="_zS0PcNcbEeajJcal_2Mr_A" target="_Hw_zwNcwEeaB5Y5OmPAhhQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_HxAa0tcwEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_HxBo8NcwEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:Pseudostate" href="StateMachine.uml#_zSh7kNcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_HxAa09cwEeaB5Y5OmPAhhQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_HxBB4NcwEeaB5Y5OmPAhhQ"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_HxBB4dcwEeaB5Y5OmPAhhQ"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_K0sOQdcwEeaB5Y5OmPAhhQ" type="StereotypeCommentLink" source="_3gyEsNcbEeajJcal_2Mr_A" target="_K0rnMNcwEeaB5Y5OmPAhhQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_K0sOQtcwEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_K0sORtcwEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:State" href="StateMachine.uml#_3ghmANcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_K0sOQ9cwEeaB5Y5OmPAhhQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_K0sORNcwEeaB5Y5OmPAhhQ"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_K0sORdcwEeaB5Y5OmPAhhQ"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_MCOYZNcwEeaB5Y5OmPAhhQ" type="StereotypeCommentLink" source="_30kjYNcbEeajJcal_2Mr_A" target="_MCOYYNcwEeaB5Y5OmPAhhQ">
+ <styles xmi:type="notation:FontStyle" xmi:id="_MCOYZdcwEeaB5Y5OmPAhhQ"/>
+ <styles xmi:type="notation:EObjectValueStyle" xmi:id="_MCO_cNcwEeaB5Y5OmPAhhQ" name="BASE_ELEMENT">
+ <eObjectValue xmi:type="uml:FinalState" href="StateMachine.uml#_30RocNcbEeajJcal_2Mr_A"/>
+ </styles>
+ <element xsi:nil="true"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_MCOYZtcwEeaB5Y5OmPAhhQ" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_MCOYZ9cwEeaB5Y5OmPAhhQ"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_MCOYaNcwEeaB5Y5OmPAhhQ"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_TZbPcNcwEeaB5Y5OmPAhhQ" type="Transition_Edge" source="_3gyEsNcbEeajJcal_2Mr_A" target="_30kjYNcbEeajJcal_2Mr_A">
+ <children xmi:type="notation:DecorationNode" xmi:id="_TZbPc9cwEeaB5Y5OmPAhhQ" type="Transition_NameLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_Z-_OMNcwEeaB5Y5OmPAhhQ" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_TZbPdNcwEeaB5Y5OmPAhhQ" x="-34" y="-15"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_TZbPddcwEeaB5Y5OmPAhhQ" type="Transition_GuardLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_Z-_1QNcwEeaB5Y5OmPAhhQ" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_TZbPdtcwEeaB5Y5OmPAhhQ"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_TZbPd9cwEeaB5Y5OmPAhhQ" type="Transition_StereotypeLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_Z-_1QdcwEeaB5Y5OmPAhhQ" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_TZbPeNcwEeaB5Y5OmPAhhQ" x="-1" y="59"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_TZbPcdcwEeaB5Y5OmPAhhQ"/>
+ <element xmi:type="uml:Transition" href="StateMachine.uml#_TZHtcNcwEeaB5Y5OmPAhhQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_TZbPctcwEeaB5Y5OmPAhhQ" points="[706, 95, -643984, -643984]$[842, 139, -643984, -643984]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_TaF90NcwEeaB5Y5OmPAhhQ" id="(1.0,0.40350877192982454)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_TaF90dcwEeaB5Y5OmPAhhQ" id="(0.05,0.4194444444444443)"/>
+ </edges>
+ <edges xmi:type="notation:Connector" xmi:id="_w3zcMNc0EeaB5Y5OmPAhhQ" type="Transition_Edge" source="_y4ec0NcbEeajJcal_2Mr_A" target="_30kjYNcbEeajJcal_2Mr_A">
+ <children xmi:type="notation:DecorationNode" xmi:id="_w3zcM9c0EeaB5Y5OmPAhhQ" type="Transition_NameLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_xlVQkNc0EeaB5Y5OmPAhhQ" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_w3zcNNc0EeaB5Y5OmPAhhQ" y="-14"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_w3zcNdc0EeaB5Y5OmPAhhQ" type="Transition_GuardLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_xlfooNc0EeaB5Y5OmPAhhQ" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_w3zcNtc0EeaB5Y5OmPAhhQ"/>
+ </children>
+ <children xmi:type="notation:DecorationNode" xmi:id="_w3zcN9c0EeaB5Y5OmPAhhQ" type="Transition_StereotypeLabel">
+ <styles xmi:type="notation:BooleanValueStyle" xmi:id="_xlqAsNc0EeaB5Y5OmPAhhQ" name="IS_UPDATED_POSITION" booleanValue="true"/>
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_w3zcONc0EeaB5Y5OmPAhhQ" y="59"/>
+ </children>
+ <styles xmi:type="notation:FontStyle" xmi:id="_w3zcMdc0EeaB5Y5OmPAhhQ"/>
+ <element xmi:type="uml:Transition" href="StateMachine.uml#_w3jkkNc0EeaB5Y5OmPAhhQ"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_w3zcMtc0EeaB5Y5OmPAhhQ" points="[426, 112, -643984, -643984]$[426, 98, -643984, -643984]$[847, 98, -643984, -643984]$[847, 122, -643984, -643984]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_w4YrANc0EeaB5Y5OmPAhhQ" id="(0.475,0.0)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_w4YrAdc0EeaB5Y5OmPAhhQ" id="(0.5,0.05)"/>
+ </edges>
+</notation:Diagram>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.uml
new file mode 100644
index 00000000000..5241a83d1b8
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/resource/bug510268/StateMachine.uml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_mmoGINcaEeajJcal_2Mr_A" name="StateMachineModel">
+ <packagedElement xmi:type="uml:StateMachine" xmi:id="_q0ueQNcaEeajJcal_2Mr_A" name="StateMachine">
+ <region xmi:type="uml:Region" xmi:id="_rIxboNcaEeajJcal_2Mr_A" name="Region">
+ <transition xmi:type="uml:Transition" xmi:id="_2HIKINcbEeajJcal_2Mr_A" name="InitialToS1" source="_zSh7kNcbEeajJcal_2Mr_A" target="_y4PzUNcbEeajJcal_2Mr_A"/>
+ <transition xmi:type="uml:Transition" xmi:id="_4NvRUNcbEeajJcal_2Mr_A" name="S1ToS2" source="_y4PzUNcbEeajJcal_2Mr_A" target="_3ghmANcbEeajJcal_2Mr_A"/>
+ <transition xmi:type="uml:Transition" xmi:id="_TZHtcNcwEeaB5Y5OmPAhhQ" name="S2ToFinal" source="_3ghmANcbEeajJcal_2Mr_A" target="_30RocNcbEeajJcal_2Mr_A"/>
+ <transition xmi:type="uml:Transition" xmi:id="_w3jkkNc0EeaB5Y5OmPAhhQ" name="S1ToFinal" source="_y4PzUNcbEeajJcal_2Mr_A" target="_30RocNcbEeajJcal_2Mr_A"/>
+ <subvertex xmi:type="uml:State" xmi:id="_y4PzUNcbEeajJcal_2Mr_A" name="S1"/>
+ <subvertex xmi:type="uml:Pseudostate" xmi:id="_zSh7kNcbEeajJcal_2Mr_A" name="InitialState"/>
+ <subvertex xmi:type="uml:State" xmi:id="_3ghmANcbEeajJcal_2Mr_A" name="S2"/>
+ <subvertex xmi:type="uml:FinalState" xmi:id="_30RocNcbEeajJcal_2Mr_A" name="FinalState"/>
+ </region>
+ </packagedElement>
+</uml:Model>
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteTransitionsWithVertexTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteTransitionsWithVertexTest.java
new file mode 100644
index 00000000000..9ad994b393d
--- /dev/null
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/deletion/DeleteTransitionsWithVertexTest.java
@@ -0,0 +1,275 @@
+/*****************************************************************************
+ * Copyright (c) 2017 EclipseSource Services GmbH 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
+ *
+ * Martin Fleck (EclipseSource) - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.service.types.tests.deletion;
+
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.junit.utils.rules.HouseKeeper;
+import org.eclipse.papyrus.junit.utils.rules.ModelSetFixture;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.eclipse.papyrus.junit.utils.rules.ServiceRegistryModelSetFixture;
+import org.eclipse.papyrus.uml.service.types.helper.advice.VertexEditHelperAdvice;
+import org.eclipse.uml2.uml.Region;
+import org.eclipse.uml2.uml.StateMachine;
+import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.Vertex;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import com.google.common.collect.Lists;
+
+/**
+ * Tests the {@link VertexEditHelperAdvice} that deletes all incoming and outgoing transitions when a vertex is deleted.
+ * The used test model consists of a statemachine with four states and four transitions:
+ *
+ * <pre>
+ * +--------------+
+ * | v
+ * [Initial]-->[S1]-->[S2]-->[Final]
+ * </pre>
+ *
+ * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=510268
+ * @author Martin Fleck <mfleck@eclipsesource.com>
+ *
+ */
+@PluginResource("resource/bug510268/StateMachine.di")
+public class DeleteTransitionsWithVertexTest {
+
+ /** HouseKeeper to clean up resources after a test has finished. */
+ @Rule
+ public HouseKeeper houseKeeper = new HouseKeeper();
+
+ /** ModelSetFixture with initialized service registry. */
+ @Rule
+ public ModelSetFixture modelSet = new ServiceRegistryModelSetFixture();
+
+ /** Region containing the states and transitions. */
+ private StateMachine stateMachine;
+
+ /** Region containing the states and transitions. */
+ private Region region;
+
+ /** Initial State. */
+ private Vertex initialState;
+
+ /** State 1. */
+ private Vertex s1;
+
+ /** State 2. */
+ private Vertex s2;
+
+ /** Final State. */
+ private Vertex finalState;
+
+ /** Transition from Initial State to State 1. */
+ private Transition initialToS1;
+
+ /** Transition from State 1 to State 2. */
+ private Transition s1ToS2;
+
+ /** Transition from State 1 to Final State. */
+ private Transition s1ToFinal;
+
+ /** Transition from State 2 to Final State. */
+ private Transition s2ToFinal;
+
+ /**
+ * Default Constructor.
+ */
+ public DeleteTransitionsWithVertexTest() {
+ }
+
+ /**
+ * Asserts the structure of the model fixture with four states and four transitions.
+ */
+ @Before
+ public void assertModelFixture() {
+ stateMachine = (StateMachine) modelSet.getModel().getOwnedMember("StateMachine");
+ assertThat("StateMachine does not exist!", stateMachine, is(notNullValue()));
+
+ region = stateMachine.getRegion("Region");
+ assertThat("Region does not exist!", region, is(notNullValue()));
+
+ initialState = region.getSubvertex("InitialState");
+ assertThat("Initial State does not exist!", initialState, is(notNullValue()));
+
+ s1 = region.getSubvertex("S1");
+ assertThat("State 1 does not exist!", s1, is(notNullValue()));
+
+ s2 = region.getSubvertex("S2");
+ assertThat("State 2 does not exist!", s2, is(notNullValue()));
+
+ finalState = region.getSubvertex("FinalState");
+ assertThat("Final State does not exist!", finalState, is(notNullValue()));
+
+ initialToS1 = region.getTransition("InitialToS1");
+ assertThat("Transition from Initial State to State 1 does not exist!", initialToS1, is(notNullValue()));
+ assertThat("Transition from Initial State to State 1 not connected correctly (source).", initialToS1.getSource(), is(initialState));
+ assertThat("Transition from Initial State to State 1 not connected correctly (target).", initialToS1.getTarget(), is(s1));
+
+ s1ToS2 = region.getTransition("S1ToS2");
+ assertThat("Transition from State 1 to State 2 does not exist!", s1ToS2, is(notNullValue()));
+ assertThat("Transition from State 1 to State 2 not connected correctly (source).", s1ToS2.getSource(), is(s1));
+ assertThat("Transition from State 1 to State 2 not connected correctly (target).", s1ToS2.getTarget(), is(s2));
+
+ s1ToFinal = region.getTransition("S1ToFinal");
+ assertThat("Transition from State 1 to Final State does not exist!", s1ToFinal, is(notNullValue()));
+ assertThat("Transition from State 1 to Final State not connected correctly (source).", s1ToFinal.getSource(), is(s1));
+ assertThat("Transition from State 1 to Final State not connected correctly (target).", s1ToFinal.getTarget(), is(finalState));
+
+ s2ToFinal = region.getTransition("S2ToFinal");
+ assertThat("Transition from State 2 to Final State does not exist!", s2ToFinal, is(notNullValue()));
+ assertThat("Transition from State 2 to Final State not connected correctly (source).", s2ToFinal.getSource(), is(s2));
+ assertThat("Transition from State 2 to Final State not connected correctly (target).", s2ToFinal.getTarget(), is(finalState));
+ }
+
+ /**
+ * Verify that all outgoing transitions from the initial state are deleted.
+ */
+ @Test
+ public void deleteInitialState() throws Exception {
+ testDeleteVertex(initialState, initialToS1);
+ }
+
+ /**
+ * Verify that all incoming and outgoing transitions from state 1 are deleted.
+ */
+ @Test
+ public void deleteS1() throws Exception {
+ testDeleteVertex(s1, initialToS1, s1ToS2, s1ToFinal);
+ }
+
+ /**
+ * Verify that all incoming and outgoing transitions from state 2 are deleted.
+ */
+ @Test
+ public void deleteS2() throws Exception {
+ testDeleteVertex(s2, s1ToS2, s2ToFinal);
+ }
+
+ /**
+ * Verify that all incoming transitions from the final state are deleted.
+ */
+ @Test
+ public void deleteFinalState() throws Exception {
+ testDeleteVertex(finalState, s1ToFinal, s2ToFinal);
+ }
+
+ /**
+ * Deletes the given vertex and asserts that the given transitions are automatically deleted as well.
+ *
+ * @param vertexToDelete
+ * vertex element to delete.
+ * @param deletedTransitions
+ * transitions that should be deleted together with the vertex.
+ */
+ protected void testDeleteVertex(Vertex vertexToDelete, Transition... deletedTransitions) {
+ ICommand deleteCommand = getDeleteCommand(vertexToDelete);
+
+ modelSet.execute(deleteCommand);
+ assertVertexDeleted(vertexToDelete);
+ assertTransitionsDeleted(Lists.newArrayList(deletedTransitions));
+
+ modelSet.undo();
+ assertModelFixture();
+
+ modelSet.redo();
+ assertVertexDeleted(vertexToDelete);
+ assertTransitionsDeleted(Lists.newArrayList(deletedTransitions));
+ }
+
+ /**
+ * Asserts that all given transitions are deleted from the model and that all other transitions are unchanged.
+ *
+ * @param deletedTransitions
+ * transitions that should have been deleted from the model.
+ */
+ protected void assertTransitionsDeleted(List<Transition> deletedTransitions) {
+ List<Transition> allTransitions = Lists.newArrayList(initialToS1, s1ToS2, s1ToFinal, s2ToFinal);
+ for (Transition transition : allTransitions) {
+ if (deletedTransitions.contains(transition)) {
+ assertTransitionDeleted(transition);
+ } else {
+ assertTransitionNotDeleted(transition);
+ }
+ }
+ }
+
+ /**
+ * Asserts that the given vertex was deleted from the model.
+ *
+ * @param vertex
+ * vertex that should have been deleted.
+ */
+ protected void assertVertexDeleted(Vertex vertex) {
+ assertThat("Deleted vertex still has incoming transitions.", vertex.getIncomings().isEmpty());
+ assertThat("Deleted vertex still has outgoing transitions.", vertex.getOutgoings().isEmpty());
+ assertThat("Deleted vertex still in the resource.", vertex.eResource(), is(nullValue()));
+ assertThat("Deleted vertex still in region.", region.getSubvertices(), not(hasItem(vertex)));
+ }
+
+ /**
+ * Asserts that the given transition was deleted from the model.
+ *
+ * @param transition
+ * transition that should have been deleted.
+ */
+ protected void assertTransitionDeleted(Transition transition) {
+ assertThat("Deleted transition still connected to its source.", transition.getSource(), is(nullValue()));
+ assertThat("Deleted transition still connected to its target.", transition.getTarget(), is(nullValue()));
+ assertThat("Deleted transition still in the resource.", transition.eResource(), is(nullValue()));
+ assertThat("Deleted transition still in region.", region.getTransitions(), not(hasItem(transition)));
+ }
+
+ /**
+ * Asserts that the given transition was NOT deleted from the model.
+ *
+ * @param transition
+ * transition that should be left unchanged.
+ */
+ protected void assertTransitionNotDeleted(Transition transition) {
+ assertThat("Not deleted transition lost its source.", transition.getSource(), is(notNullValue()));
+ assertThat("Not deleted transition lost its target.", transition.getTarget(), is(notNullValue()));
+ assertThat("Not deleted transition lost its container.", transition.eContainer(), is((EObject) region));
+ assertThat("Not deleted transition not in region.", region.getTransitions(), hasItem(transition));
+ }
+
+ /**
+ * Creates a command to delete the given element.
+ *
+ * @param elementToDelete
+ * element that should be deleted.
+ * @return deletion command.
+ */
+ protected ICommand getDeleteCommand(EObject elementToDelete) {
+ IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(elementToDelete);
+ assertThat("No ElementEditService found for element: " + elementToDelete, elementEditService, notNullValue());
+
+ ICommand command = elementEditService.getEditCommand(new DestroyElementRequest(elementToDelete, false));
+ assertThat("No deletion command provided", command, notNullValue());
+ assertThat("Deletion command is not executable", command.canExecute(), is(true));
+
+ return command;
+ }
+} \ No newline at end of file
diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java
index f99f18e11f1..37b61cb76bd 100644
--- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java
+++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.service.types.tests/src/org/eclipse/papyrus/uml/service/types/tests/suites/AllTests.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2012, 2017 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -10,6 +10,7 @@
* CEA LIST - Initial API and implementation
* Christian W. Damus - bugs 458685, 468071, 465899, 478314, 485220
* Vincent Lorenzo - bug 492522
+ * Martin Fleck - bug 510268
*****************************************************************************/
package org.eclipse.papyrus.uml.service.types.tests.suites;
@@ -22,6 +23,7 @@ import org.eclipse.papyrus.uml.service.types.tests.deletion.DeleteCommentLinkTes
import org.eclipse.papyrus.uml.service.types.tests.deletion.DeleteContainmentSubsetTest;
import org.eclipse.papyrus.uml.service.types.tests.deletion.DeleteDependentWithStereotypeApplications458685;
import org.eclipse.papyrus.uml.service.types.tests.deletion.DeletePureUMLElementTest;
+import org.eclipse.papyrus.uml.service.types.tests.deletion.DeleteTransitionsWithVertexTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -35,6 +37,7 @@ import org.junit.runners.Suite.SuiteClasses;
CreatePureUMLElementTest.class, // pure uml tests, only element edit service
DeletePureUMLElementTest.class,
DeleteDependentWithStereotypeApplications458685.class,
+ DeleteTransitionsWithVertexTest.class,
DeleteContainmentSubsetTest.class,
ConnectorReadOnlyTestBug465899.class,
DeleteCommentLinkTest.class

Back to the top