diff options
| author | Laurent Redor | 2016-03-04 10:14:31 +0000 |
|---|---|---|
| committer | Laurent Redor | 2016-03-15 09:11:51 +0000 |
| commit | affea29c5b22c23d4869fcea695514377f923f81 (patch) | |
| tree | b4b88a154a322bea2cd8cfa0b415ffa48ee9582e | |
| parent | 20f68be177a1a298ba6c9d60bb9faa2ff1daa443 (diff) | |
| download | org.eclipse.sirius-affea29c5b22c23d4869fcea695514377f923f81.tar.gz org.eclipse.sirius-affea29c5b22c23d4869fcea695514377f923f81.tar.xz org.eclipse.sirius-affea29c5b22c23d4869fcea695514377f923f81.zip | |
[489198] Add tests to reveal problem with specific layout action
The first test, testSpecificLayout(), does a horizontal layout between 2
nodes and layouts the edge between them. The edge must have only two
points (draw2d and GMF points). In this scenario, before the commit
"[489199] Fix the detected regressions", there are several points, even
in draw2d.
The second test, testSpecificVerticalLayout(), does a vertical layout
between 2 container and layouts the edge between them. The edge must
have only two points (draw2d and GMF points). In this scenario, there
are 2 points in Draw2D but several points in GMF.
Bug: 489198
Change-Id: I0c69c748774cb919154c9fc9d56effef0d64225a
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
8 files changed, 762 insertions, 17 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF index 712123c57b..5aaf768662 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF @@ -50,7 +50,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.sirius.diagram.ui;bundle-version="1.0.0", org.eclipse.sirius.diagram.ui.ext, org.eclipse.sdk, - org.eclipse.platform + org.eclipse.platform, + org.eclipse.sirius.tests.sample.migration Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Eclipse-RegisterBuddy: org.apache.log4j diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.aird index 7ad570c3f6..7b9f6dd490 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.aird +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.aird @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:migrationmodeler="http://www.eclipse.org/sirius/tests/sample/migrationmodeler" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_tyCgMPfKEeOewbIoSlcvjw" selectedViews="_uYpNMPfKEeOewbIoSlcvjw" version="10.1.0.201509162000"> +<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:migrationmodeler="http://www.eclipse.org/sirius/tests/sample/migrationmodeler" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_tyCgMPfKEeOewbIoSlcvjw" selectedViews="_uYpNMPfKEeOewbIoSlcvjw _NFsncOSUEeW5uORBaLWliQ" version="10.1.0.201509162000"> <semanticResources>platform:/resource/Test/useCase.migrationmodeler</semanticResources> <semanticResources>useCase.migrationmodeler</semanticResources> <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_uYpNMPfKEeOewbIoSlcvjw"> @@ -2490,6 +2490,297 @@ <activatedLayers xmi:type="description_1:Layer" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer"/> <target xmi:type="migrationmodeler:Diagram" href="useCase.migrationmodeler#//@representations.4"/> </ownedRepresentations> + <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_hKxmgObdEeWNq6OCTnmZcA" name="specificVerticalLayout"> + <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_hKxmgebdEeWNq6OCTnmZcA" source="GMF_DIAGRAMS"> + <data xmi:type="notation:Diagram" xmi:id="_hKxmgubdEeWNq6OCTnmZcA" type="Sirius" element="_hKxmgObdEeWNq6OCTnmZcA" measurementUnit="Pixel"> + <children xmi:type="notation:Node" xmi:id="_hKxmg-bdEeWNq6OCTnmZcA" type="2002" element="_hKxmoObdEeWNq6OCTnmZcA"> + <children xmi:type="notation:Node" xmi:id="_hKxmhObdEeWNq6OCTnmZcA" type="5006"/> + <children xmi:type="notation:Node" xmi:id="_hKxmhebdEeWNq6OCTnmZcA" type="7001"> + <styles xmi:type="notation:SortingStyle" xmi:id="_hKxmhubdEeWNq6OCTnmZcA"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_hKxmh-bdEeWNq6OCTnmZcA"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_hKxmiObdEeWNq6OCTnmZcA" fontName="Cantarell" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKxmiebdEeWNq6OCTnmZcA" x="160" y="40" width="179"/> + </children> + <children xmi:type="notation:Node" xmi:id="_hKxmiubdEeWNq6OCTnmZcA" type="2002" element="_hKxmoubdEeWNq6OCTnmZcA"> + <children xmi:type="notation:Node" xmi:id="_hKxmi-bdEeWNq6OCTnmZcA" type="5006"/> + <children xmi:type="notation:Node" xmi:id="_hKxmjObdEeWNq6OCTnmZcA" type="7001"> + <styles xmi:type="notation:SortingStyle" xmi:id="_hKxmjebdEeWNq6OCTnmZcA"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_hKxmjubdEeWNq6OCTnmZcA"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_hKxmj-bdEeWNq6OCTnmZcA" fontName="Cantarell" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKxmkObdEeWNq6OCTnmZcA" x="640" y="260"/> + </children> + <styles xmi:type="notation:DiagramStyle" xmi:id="_hKxmkebdEeWNq6OCTnmZcA"/> + <edges xmi:type="notation:Edge" xmi:id="_hKxmkubdEeWNq6OCTnmZcA" type="4001" element="_hKxmpObdEeWNq6OCTnmZcA" source="_hKxmg-bdEeWNq6OCTnmZcA" target="_hKxmiubdEeWNq6OCTnmZcA"> + <children xmi:type="notation:Node" xmi:id="_hKxmk-bdEeWNq6OCTnmZcA" type="6001"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKxmlObdEeWNq6OCTnmZcA" x="-4" y="-10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_hKxmlebdEeWNq6OCTnmZcA" type="6002"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKxmlubdEeWNq6OCTnmZcA" x="-5" y="10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_hKxml-bdEeWNq6OCTnmZcA" type="6003"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hKxmmObdEeWNq6OCTnmZcA" x="-1" y="11"/> + </children> + <styles xmi:type="notation:ConnectorStyle" xmi:id="_hKxmmebdEeWNq6OCTnmZcA"/> + <styles xmi:type="notation:FontStyle" xmi:id="_hKxmmubdEeWNq6OCTnmZcA" fontName="Cantarell" fontHeight="8"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hKxmm-bdEeWNq6OCTnmZcA" points="[19, 35, -558, -185]$[70, 126, -507, -94]$[450, 126, -127, -94]$[529, 185, -48, -35]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hKxmnObdEeWNq6OCTnmZcA" id="(0.5,0.5)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hKxmnebdEeWNq6OCTnmZcA" id="(0.5,0.5)"/> + </edges> + </data> + </ownedAnnotationEntries> + <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_hKxmnubdEeWNq6OCTnmZcA" source="DANNOTATION_CUSTOMIZATION_KEY"> + <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_hKxmn-bdEeWNq6OCTnmZcA"/> + </ownedAnnotationEntries> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_hKxmoObdEeWNq6OCTnmZcA" name="container2" outgoingEdges="_hKxmpObdEeWNq6OCTnmZcA"> + <target xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.4/@containers.1"/> + <semanticElements xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.4/@containers.1"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_hKxmoebdEeWNq6OCTnmZcA" borderSize="1" borderSizeComputationExpression="1" foregroundColor="204,242,166"> + <description xmi:type="style:FlatContainerStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMappingImport" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_hKxmoubdEeWNq6OCTnmZcA" name="container1container1container1container1container1container1" incomingEdges="_hKxmpObdEeWNq6OCTnmZcA"> + <target xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.4/@containers.0"/> + <semanticElements xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.4/@containers.0"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_hKxmo-bdEeWNq6OCTnmZcA" borderSize="1" borderSizeComputationExpression="1" foregroundColor="204,242,166"> + <description xmi:type="style:FlatContainerStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMappingImport" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_hKxmpObdEeWNq6OCTnmZcA" name="edge1" sourceNode="_hKxmoObdEeWNq6OCTnmZcA" targetNode="_hKxmoubdEeWNq6OCTnmZcA"> + <target xmi:type="migrationmodeler:Edge" href="useCase.migrationmodeler#//@representations.4/@edges.0"/> + <semanticElements xmi:type="migrationmodeler:Edge" href="useCase.migrationmodeler#//@representations.4/@edges.0"/> + <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_hKxmpebdEeWNq6OCTnmZcA" centered="Both" strokeColor="39,76,114"> + <customFeatures>routingStyle</customFeatures> + <description xmi:type="style:EdgeStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@edgeMappings[name='edge']/@style"/> + <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_hKxmpubdEeWNq6OCTnmZcA"/> + </ownedStyle> + <actualMapping xmi:type="description_1:EdgeMapping" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@edgeMappings[name='edge']"/> + </ownedDiagramElements> + <description xmi:type="description_1:DiagramDescription" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']"/> + <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_hKxmp-bdEeWNq6OCTnmZcA"/> + <activatedLayers xmi:type="description_1:Layer" href="useCase.odesign#//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer"/> + <target xmi:type="migrationmodeler:Diagram" href="useCase.migrationmodeler#//@representations.4"/> + </ownedRepresentations> <viewpoint xmi:type="description:Viewpoint" href="useCase.odesign#//@ownedViewpoints[name='centered']"/> </ownedViews> + <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_NFsncOSUEeW5uORBaLWliQ"> + <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_VUHrUOSdEeW5uORBaLWliQ" name="new borderNodesDiagram"> + <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_VUHrUeSdEeW5uORBaLWliQ" source="DANNOTATION_CUSTOMIZATION_KEY"> + <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_VUHrUuSdEeW5uORBaLWliQ"/> + </ownedAnnotationEntries> + <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_VUISYOSdEeW5uORBaLWliQ" source="GMF_DIAGRAMS"> + <data xmi:type="notation:Diagram" xmi:id="_VUISYeSdEeW5uORBaLWliQ" type="Sirius" element="_VUHrUOSdEeW5uORBaLWliQ" measurementUnit="Pixel"> + <children xmi:type="notation:Node" xmi:id="_VUISY-SdEeW5uORBaLWliQ" type="2002" element="_VUHrU-SdEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_VUI5cOSdEeW5uORBaLWliQ" type="5006"/> + <children xmi:type="notation:Node" xmi:id="_VUI5ceSdEeW5uORBaLWliQ" type="7001"> + <children xmi:type="notation:Node" xmi:id="_VUKHkOSdEeW5uORBaLWliQ" type="3008" element="_VUHrVeSdEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_VUKHk-SdEeW5uORBaLWliQ" type="5005"/> + <children xmi:type="notation:Node" xmi:id="_VUKuoOSdEeW5uORBaLWliQ" type="7002"> + <children xmi:type="notation:Node" xmi:id="_VTjOIOSeEeW5uORBaLWliQ" type="3007" element="_VTfjwOSeEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_VTjOI-SeEeW5uORBaLWliQ" type="5003"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VTjOJOSeEeW5uORBaLWliQ" y="5"/> + </children> + <children xmi:type="notation:Node" xmi:id="_VTj1MOSeEeW5uORBaLWliQ" type="3003" element="_VTgK0OSeEeW5uORBaLWliQ"> + <styles xmi:type="notation:ShapeStyle" xmi:id="_VTj1MeSeEeW5uORBaLWliQ" fontName="Ubuntu"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTj1MuSeEeW5uORBaLWliQ"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_VTjOIeSeEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTjOIuSeEeW5uORBaLWliQ" x="30" y="28" width="101" height="50"/> + </children> + <styles xmi:type="notation:SortingStyle" xmi:id="_VUKuoeSdEeW5uORBaLWliQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_VUKuouSdEeW5uORBaLWliQ"/> + </children> + <children xmi:type="notation:Node" xmi:id="_-PJo8OSeEeW5uORBaLWliQ" type="3012" element="_-PGloOSeEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_-PJo8-SeEeW5uORBaLWliQ" type="5010"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_-PJo9OSeEeW5uORBaLWliQ" x="11" y="-10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_-PJo9eSeEeW5uORBaLWliQ" type="3003" element="_-PGloeSeEeW5uORBaLWliQ"> + <styles xmi:type="notation:ShapeStyle" xmi:id="_-PJo9uSeEeW5uORBaLWliQ" fontName="Ubuntu"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_-PJo9-SeEeW5uORBaLWliQ"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_-PJo8eSeEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_-PJo8uSeEeW5uORBaLWliQ" x="-2" y="24" width="10" height="10"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_VUKHkeSdEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VUKHkuSdEeW5uORBaLWliQ" x="33" y="34" width="150" height="92"/> + </children> + <children xmi:type="notation:Node" xmi:id="_VUKuo-SdEeW5uORBaLWliQ" type="3008" element="_VUHrV-SdEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_VUKupuSdEeW5uORBaLWliQ" type="5005"/> + <children xmi:type="notation:Node" xmi:id="_VUKup-SdEeW5uORBaLWliQ" type="7002"> + <styles xmi:type="notation:SortingStyle" xmi:id="_VUKuqOSdEeW5uORBaLWliQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_VUKuqeSdEeW5uORBaLWliQ"/> + </children> + <children xmi:type="notation:Node" xmi:id="_7YY3MOSeEeW5uORBaLWliQ" type="3012" element="_7YWa8OSeEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_7YY3M-SeEeW5uORBaLWliQ" type="5010"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_7YY3NOSeEeW5uORBaLWliQ" x="11" y="-10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_7YZeQOSeEeW5uORBaLWliQ" type="3003" element="_7YXCAOSeEeW5uORBaLWliQ"> + <styles xmi:type="notation:ShapeStyle" xmi:id="_7YZeQeSeEeW5uORBaLWliQ" fontName="Ubuntu"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7YZeQuSeEeW5uORBaLWliQ"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_7YY3MeSeEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7YY3MuSeEeW5uORBaLWliQ" x="-2" y="20" width="10" height="10"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_VUKupOSdEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VUKupeSdEeW5uORBaLWliQ" x="353" y="110" width="150" height="70"/> + </children> + <styles xmi:type="notation:SortingStyle" xmi:id="_VUI5cuSdEeW5uORBaLWliQ"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_VUI5c-SdEeW5uORBaLWliQ"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_VUISZOSdEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VUISZeSdEeW5uORBaLWliQ" x="37" y="20" width="576" height="194"/> + </children> + <children xmi:type="notation:Node" xmi:id="_VTinEOSeEeW5uORBaLWliQ" type="2001" element="_VTdHgOSeEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_VTinE-SeEeW5uORBaLWliQ" type="5002"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_VTinFOSeEeW5uORBaLWliQ" y="5"/> + </children> + <children xmi:type="notation:Node" xmi:id="_VTkcQ-SeEeW5uORBaLWliQ" type="3003" element="_VTdukOSeEeW5uORBaLWliQ"> + <styles xmi:type="notation:ShapeStyle" xmi:id="_VTkcROSeEeW5uORBaLWliQ" fontName="Ubuntu"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTkcReSeEeW5uORBaLWliQ"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_VTinEeSeEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VTinEuSeEeW5uORBaLWliQ" x="70" y="320" width="101" height="50"/> + </children> + <styles xmi:type="notation:DiagramStyle" xmi:id="_VUISYuSdEeW5uORBaLWliQ"/> + <edges xmi:type="notation:Edge" xmi:id="_RIK9YOSfEeW5uORBaLWliQ" type="4001" element="_RIH6EOSfEeW5uORBaLWliQ" source="_VTinEOSeEeW5uORBaLWliQ" target="_VTjOIOSeEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_RILkcOSfEeW5uORBaLWliQ" type="6001"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RILkceSfEeW5uORBaLWliQ" y="-10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_RIMLgOSfEeW5uORBaLWliQ" type="6002"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RIMLgeSfEeW5uORBaLWliQ" y="10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_RIMLguSfEeW5uORBaLWliQ" type="6003"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RIMLg-SfEeW5uORBaLWliQ" y="10"/> + </children> + <styles xmi:type="notation:ConnectorStyle" xmi:id="_RIK9YeSfEeW5uORBaLWliQ"/> + <styles xmi:type="notation:FontStyle" xmi:id="_RIK9YuSfEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_RIK9Y-SfEeW5uORBaLWliQ" points="[6, -25, -54, 195]$[53, -195, -7, 25]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_RINZoOSfEeW5uORBaLWliQ" id="(0.5,0.5)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_RINZoeSfEeW5uORBaLWliQ" id="(0.5,0.5)"/> + </edges> + <edges xmi:type="notation:Edge" xmi:id="_jRmA4OSfEeW5uORBaLWliQ" type="4001" element="_jRkywOSfEeW5uORBaLWliQ" source="_-PJo8OSeEeW5uORBaLWliQ" target="_7YY3MOSeEeW5uORBaLWliQ"> + <children xmi:type="notation:Node" xmi:id="_jRmA5OSfEeW5uORBaLWliQ" type="6001"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jRmA5eSfEeW5uORBaLWliQ" x="-1" y="-9"/> + </children> + <children xmi:type="notation:Node" xmi:id="_jRmA5uSfEeW5uORBaLWliQ" type="6002"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jRmA5-SfEeW5uORBaLWliQ" x="1" y="10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_jRmA6OSfEeW5uORBaLWliQ" type="6003"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jRmA6eSfEeW5uORBaLWliQ" x="2" y="10"/> + </children> + <styles xmi:type="notation:ConnectorStyle" xmi:id="_jRmA4eSfEeW5uORBaLWliQ"/> + <styles xmi:type="notation:FontStyle" xmi:id="_jRmA4uSfEeW5uORBaLWliQ" fontName="Ubuntu" fontHeight="8"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_jRmA4-SfEeW5uORBaLWliQ" points="[5, 0, -268, -44]$[268, 43, -5, -1]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_jRmn8OSfEeW5uORBaLWliQ" id="(0.5,0.5)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_jRmn8eSfEeW5uORBaLWliQ" id="(0.5,0.5)"/> + </edges> + </data> + </ownedAnnotationEntries> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_VUHrU-SdEeW5uORBaLWliQ" name="P1"> + <target xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.7/@containers.0"/> + <semanticElements xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.7/@containers.0"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_VUHrVOSdEeW5uORBaLWliQ" borderSize="1" borderSizeComputationExpression="1"> + <description xmi:type="style:FlatContainerStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']"/> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_VUHrVeSdEeW5uORBaLWliQ" name="P11"> + <target xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.0"/> + <semanticElements xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.0"/> + <ownedBorderedNodes xmi:type="diagram:DNode" xmi:id="_-PGloOSeEeW5uORBaLWliQ" name="Interface11" outgoingEdges="_jRkywOSfEeW5uORBaLWliQ" width="1" height="1" resizeKind="NSEW"> + <target xmi:type="migrationmodeler:Bordered" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.0/@elements.1"/> + <semanticElements xmi:type="migrationmodeler:Bordered" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.0/@elements.1"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:Square" xmi:id="_-PGloeSeEeW5uORBaLWliQ" showIcon="false" color="224,133,3"> + <description xmi:type="style:SquareDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@borderedNodeMappings[name='Interface']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@borderedNodeMappings[name='Interface']"/> + </ownedBorderedNodes> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_VUHrVuSdEeW5uORBaLWliQ" borderSize="1" borderSizeComputationExpression="1"> + <description xmi:type="style:FlatContainerStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']"/> + <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_VTfjwOSeEeW5uORBaLWliQ" name="Class11" incomingEdges="_RIH6EOSfEeW5uORBaLWliQ" width="5" height="5" resizeKind="NSEW"> + <target xmi:type="migrationmodeler:Node" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.0/@elements.0"/> + <semanticElements xmi:type="migrationmodeler:Node" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.0/@elements.0"/> + <ownedStyle xmi:type="diagram:Square" xmi:id="_VTgK0OSeEeW5uORBaLWliQ" labelPosition="node"> + <description xmi:type="style:SquareDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@nodeMappings[name='Class']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@nodeMappings[name='Class']"/> + </ownedDiagramElements> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_VUHrV-SdEeW5uORBaLWliQ" name="P12"> + <target xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.1"/> + <semanticElements xmi:type="migrationmodeler:Container" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.1"/> + <ownedBorderedNodes xmi:type="diagram:DNode" xmi:id="_7YWa8OSeEeW5uORBaLWliQ" name="Interface12" incomingEdges="_jRkywOSfEeW5uORBaLWliQ" width="1" height="1" resizeKind="NSEW"> + <target xmi:type="migrationmodeler:Bordered" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.1/@elements.0"/> + <semanticElements xmi:type="migrationmodeler:Bordered" href="useCase.migrationmodeler#//@representations.7/@containers.0/@elements.1/@elements.0"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:Square" xmi:id="_7YXCAOSeEeW5uORBaLWliQ" showIcon="false" color="224,133,3"> + <description xmi:type="style:SquareDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@borderedNodeMappings[name='Interface']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@borderedNodeMappings[name='Interface']"/> + </ownedBorderedNodes> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_VUHrWOSdEeW5uORBaLWliQ" borderSize="1" borderSizeComputationExpression="1"> + <description xmi:type="style:FlatContainerStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']"/> + </ownedDiagramElements> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_VTdHgOSeEeW5uORBaLWliQ" name="Class1" outgoingEdges="_RIH6EOSfEeW5uORBaLWliQ" width="5" height="5" resizeKind="NSEW"> + <target xmi:type="migrationmodeler:Node" href="useCase.migrationmodeler#//@representations.7/@nodes.0"/> + <semanticElements xmi:type="migrationmodeler:Node" href="useCase.migrationmodeler#//@representations.7/@nodes.0"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:Square" xmi:id="_VTdukOSeEeW5uORBaLWliQ" labelPosition="node"> + <description xmi:type="style:SquareDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@nodeMappings[name='Class']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:NodeMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@nodeMappings[name='Class']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_RIH6EOSfEeW5uORBaLWliQ" name="toClass11" sourceNode="_VTdHgOSeEeW5uORBaLWliQ" targetNode="_VTfjwOSeEeW5uORBaLWliQ"> + <target xmi:type="migrationmodeler:Edge" href="useCase.migrationmodeler#//@representations.7/@edges.0"/> + <semanticElements xmi:type="migrationmodeler:Edge" href="useCase.migrationmodeler#//@representations.7/@edges.0"/> + <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_RIH6EeSfEeW5uORBaLWliQ" size="2" centered="Both"> + <customFeatures>centered</customFeatures> + <description xmi:type="style:EdgeStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/> + <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_RIH6EuSfEeW5uORBaLWliQ"/> + </ownedStyle> + <actualMapping xmi:type="description_1:EdgeMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@edgeMappings[name='EReference']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_jRkywOSfEeW5uORBaLWliQ" name="edge1" sourceNode="_-PGloOSeEeW5uORBaLWliQ" targetNode="_7YWa8OSeEeW5uORBaLWliQ"> + <target xmi:type="migrationmodeler:Edge" href="useCase.migrationmodeler#//@representations.7/@edges.1"/> + <semanticElements xmi:type="migrationmodeler:Edge" href="useCase.migrationmodeler#//@representations.7/@edges.1"/> + <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_jRkyweSfEeW5uORBaLWliQ" size="2" centered="Both"> + <customFeatures>centered</customFeatures> + <description xmi:type="style:EdgeStyleDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/> + <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_jRkywuSfEeW5uORBaLWliQ"/> + </ownedStyle> + <actualMapping xmi:type="description_1:EdgeMapping" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@edgeMappings[name='EReference']"/> + </ownedDiagramElements> + <description xmi:type="description_1:DiagramDescription" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']"/> + <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_VUHrW-SdEeW5uORBaLWliQ"/> + <activatedLayers xmi:type="description_1:Layer" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer"/> + <target xmi:type="migrationmodeler:Diagram" href="useCase.migrationmodeler#//@representations.7"/> + </ownedRepresentations> + <viewpoint xmi:type="description:Viewpoint" href="useCase.odesign#//@ownedViewpoints[name='borderNodes']"/> + </ownedViews> </viewpoint:DAnalysis> diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.migrationmodeler b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.migrationmodeler index eab1260fc6..f01246230b 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.migrationmodeler +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.migrationmodeler @@ -112,4 +112,18 @@ <edges id="edge3" source="//@representations.6/@containers.3" target="//@representations.6/@containers.1"/> <edges id="edge4" source="//@representations.6/@containers.2" target="//@representations.6/@containers.0"/> </representations> + <representations xsi:type="migrationmodeler:Diagram" name="diagram7"> + <containers id="P1"> + <elements xsi:type="migrationmodeler:Container" id="P11"> + <elements xsi:type="migrationmodeler:Node" id="Class11"/> + <elements xsi:type="migrationmodeler:Bordered" id="Interface11"/> + </elements> + <elements xsi:type="migrationmodeler:Container" id="P12"> + <elements xsi:type="migrationmodeler:Bordered" id="Interface12"/> + </elements> + </containers> + <nodes id="Class1"/> + <edges id="toClass11" source="//@representations.7/@nodes.0" target="//@representations.7/@containers.0/@elements.0/@elements.0"/> + <edges id="edge1" source="//@representations.7/@containers.0/@elements.0/@elements.1" target="//@representations.7/@containers.0/@elements.1/@elements.0"/> + </representations> </migrationmodeler:TestCase> diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.odesign index e12a5ab209..51e14c4c08 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.odesign +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/centeredEdge/useCase.odesign @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/description/tool/1.1.0" name="useCase" version="8.1.0"> +<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/description/tool/1.1.0" name="useCase" version="10.1.3.201511131800"> <ownedViewpoints name="centered"> <ownedRepresentations xsi:type="description_1:DiagramDescription" name="useCase" domainClass="migrationmodeler.Diagram"> <defaultLayer name="Default"> @@ -18,14 +18,14 @@ </style> </nodeMappings> <edgeMappings name="edge" semanticCandidatesExpression="feature:eContents" createElements="false" sourceMapping="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered_centered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='node'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='nodeImportCentered']" targetMapping="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered_centered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='node'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='nodeImportCentered']" targetFinderExpression="feature:target" sourceFinderExpression="feature:source" domainClass="migrationmodeler.Edge" useDomainElement="true" reconnections="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@toolSections.0/@ownedTools[name='reconnectTarget']"> - <style sizeComputationExpression="1" centeredSourceMappings="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered_centered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='nodeImportCentered']" centeredTargetMappings="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered_centered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='nodeImportCentered']"> + <style centeredSourceMappings="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered_centered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='nodeImportCentered']" centeredTargetMappings="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered_centered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='containerImportCentered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@nodeMappings[name='nodeImportCentered']"> <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_blue']"/> <centerLabelStyleDescription labelExpression="feature:id"> <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> </centerLabelStyleDescription> </style> </edgeMappings> - <containerMappings name="container" preconditionExpression="[id = 'container3' or id = 'container4' /]" semanticCandidatesExpression="feature:eContents" domainClass="migrationmodeler.Container"> + <containerMappings name="container" preconditionExpression="[id = 'container3' or id = 'container4' /]" semanticCandidatesExpression="feature:eContents" domainClass="migrationmodeler.Container" reusedContainerMappings="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']"> <borderedNodeMappings name="bordered_centered" preconditionExpression="[id = 'border1' or id = 'border4' /]" semanticCandidatesExpression="feature:eContents" domainClass="migrationmodeler.Bordered"> <style xsi:type="style:SquareDescription" labelExpression="feature:id" sizeComputationExpression="1" resizeKind="NSEW"> <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> @@ -40,7 +40,7 @@ <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_red']"/> </style> </borderedNodeMappings> - <style xsi:type="style:FlatContainerStyleDescription" labelExpression="feature:id"> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="1" arcHeight="1" borderSizeComputationExpression="1" labelExpression="feature:id"> <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> @@ -48,7 +48,7 @@ </style> </containerMappings> <containerMappings xsi:type="description_1:ContainerMappingImport" name="containerImportCentered" preconditionExpression="[id.contains('container1') or id.contains('container2') /]" semanticCandidatesExpression="feature:eContents" reusedBorderedNodeMappings="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered_centered'] //@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']/@borderedNodeMappings[name='bordered']" importedMapping="//@ownedViewpoints[name='centered']/@ownedRepresentations[name='useCase']/@defaultLayer/@containerMappings[name='container']"> - <style xsi:type="style:FlatContainerStyleDescription" labelExpression="feature:id"> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="1" arcHeight="1" borderSizeComputationExpression="1" labelExpression="feature:id"> <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> @@ -105,6 +105,67 @@ </initialOperation> <edgeView name="edgeView"/> </ownedTools> + <ownedTools xsi:type="tool_1:ToolDescription" documentation="This specific tool moves several elements at same time and reveals a problem about the "center edges". It must be applied on diagram." name="MoveElements" label="Move elements" forceRefresh="true"> + <element name="element"/> + <elementView name="elementView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="aql:self"> + <subModelOperations xsi:type="tool_1:ExternalJavaAction" name="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificVerticalLayoutID" forceRefresh="true" id="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificVerticalLayoutID"> + <parameters name="ddiagram" value="var:elementView"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + </toolSections> + </defaultLayer> + </ownedRepresentations> + </ownedViewpoints> + <ownedViewpoints name="borderNodes"> + <ownedRepresentations xsi:type="description_1:DiagramDescription" name="borderNodesDiagram" label="borderNodesDiagram" domainClass="migrationmodeler.Diagram"> + <metamodel href="http://www.eclipse.org/sirius/tests/sample/migrationmodeler#/"/> + <defaultLayer name="Default"> + <nodeMappings name="Class" label="Class" semanticCandidatesExpression="feature:eContents" domainClass="migrationmodeler.Node"> + <style xsi:type="style:SquareDescription" labelExpression="feature:id" sizeComputationExpression="5" labelPosition="node" resizeKind="NSEW"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> + </style> + </nodeMappings> + <edgeMappings name="EReference" sourceMapping="//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@nodeMappings[name='Class'] //@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@borderedNodeMappings[name='Interface']" targetMapping="//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@nodeMappings[name='Class'] //@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']/@borderedNodeMappings[name='Interface']" targetFinderExpression="feature:target" sourceFinderExpression="feature:source" domainClass="migrationmodeler.Edge" useDomainElement="true"> + <style sizeComputationExpression="2"> + <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> + <centerLabelStyleDescription labelExpression="feature:id"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </centerLabelStyleDescription> + </style> + </edgeMappings> + <containerMappings name="Package" label="Package" semanticCandidatesExpression="feature:eContents" domainClass="migrationmodeler.Container" reusedNodeMappings="//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@nodeMappings[name='Class']" reusedContainerMappings="//@ownedViewpoints[name='borderNodes']/@ownedRepresentations[name='borderNodesDiagram']/@defaultLayer/@containerMappings[name='Package']"> + <borderedNodeMappings name="Interface" semanticCandidatesExpression="feature:eContents" domainClass="migrationmodeler.Bordered"> + <style xsi:type="style:SquareDescription" showIcon="false" labelExpression="feature:id" sizeComputationExpression="1" resizeKind="NSEW"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='dark_orange']"/> + </style> + </borderedNodeMappings> + <style xsi:type="style:FlatContainerStyleDescription" borderSizeComputationExpression="1" labelExpression="feature:id"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/> + </style> + </containerMappings> + <toolSections name="tools"> + <ownedTools xsi:type="tool_1:ToolDescription" documentation="This specific tool moves several elements at same time and reveals a problem about the "center edges". It must be applied on diagram." name="MoveElements" label="Move elements" forceRefresh="true"> + <element name="element"/> + <elementView name="elementView"/> + <initialOperation> + <firstModelOperations xsi:type="tool_1:ChangeContext" browseExpression="aql:self"> + <subModelOperations xsi:type="tool_1:ExternalJavaAction" name="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificLayoutID" forceRefresh="true" id="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificLayoutID"> + <parameters name="ddiagram" value="var:elementView"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> </toolSections> </defaultLayer> </ownedRepresentations> diff --git a/plugins/org.eclipse.sirius.tests.swtbot/plugin.xml b/plugins/org.eclipse.sirius.tests.swtbot/plugin.xml index e0207a4c46..f283688891 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/plugin.xml +++ b/plugins/org.eclipse.sirius.tests.swtbot/plugin.xml @@ -18,7 +18,21 @@ actionClass="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionForDDiagramElementCreation" id="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionForDDiagramElementCreationID"> </javaActions> - </extension> + </extension> + <extension + point="org.eclipse.sirius.externalJavaAction"> + <javaActions + actionClass="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificLayout" + id="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificLayoutID"> + </javaActions> + </extension> + <extension + point="org.eclipse.sirius.externalJavaAction"> + <javaActions + actionClass="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificVerticalLayout" + id="org.eclipse.sirius.tests.swtbot.services.ExternalJavaActionSpecificVerticalLayoutID"> + </javaActions> + </extension> <extension point="org.eclipse.ui.menus"> <menuContribution diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java index a65d4c45c8..21c3655894 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java @@ -30,6 +30,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor; import org.eclipse.gmf.runtime.notation.ConnectorStyle; import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.Routing; import org.eclipse.sirius.business.api.preferences.SiriusPreferencesKeys; import org.eclipse.sirius.diagram.DDiagram; @@ -546,7 +547,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { containerBotGefEditPart.resize(PositionConstants.SOUTH_EAST, 300, 80); // we make sure the figure has been resized - bot.waitUntil(new WaitFigureResizedCondition(boundsBefore, figure)); + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); SWTBotGefConnectionEditPart edgeSwtBotGefEditPart = (SWTBotGefConnectionEditPart) editor.getEditPart("edge1", DEdgeEditPart.class); assertEdgeHasExpectedTgtAnchor(edgeSwtBotGefEditPart, new PrecisionPoint(0.5, 0.5)); @@ -570,7 +571,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { borderNodeBotGefEditPart.resize(PositionConstants.SOUTH, 0, 200); // we make sure the figure has been resized - bot.waitUntil(new WaitFigureResizedCondition(boundsBefore, figure)); + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); // The source is no longer centered, and the bendpoints of edges must no // be changed (bug 441424) checkPointsListAfterResizing(edgeSwtBotGefEditPart, edge2PointListBefore, false); @@ -621,7 +622,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { borderNodeBotGefEditPart.resize(PositionConstants.SOUTH, 0, (int) (200 * zoomLevel.getAmount())); // we make sure the figure has been resized - bot.waitUntil(new WaitFigureResizedCondition(boundsBefore, figure)); + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); assertEdgeHasExpectedTgtAnchor(edgeSwtBotGefEditPart, new PrecisionPoint(0.5, 0.5)); @@ -653,7 +654,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { border1NodeBotGefEditPart.resize(PositionConstants.NORTH, 0, 160); // we make sure the figure has been resized (and moved) - bot.waitUntil(new WaitFigureResizedCondition(boundsBefore, figure)); + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); assertEdgeHasExpectedTgtAnchor(edgeSwtBotGefEditPart, new PrecisionPoint(0.5, 0.5)); @@ -681,7 +682,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { border2NodeBotGefEditPart.resize(PositionConstants.SOUTH, 0, 125); // we make sure the figure has been resized (and moved) - bot.waitUntil(new WaitFigureResizedCondition(boundsBefore, figure)); + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); assertEquals("The overlapped border node should not be moved.", border1BoundsBefore, ((GraphicalEditPart) border1NodeBotGefEditPart.part()).getFigure().getBounds().getCopy()); } @@ -704,7 +705,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { containerBotGefEditPart.resize(PositionConstants.NORTH_EAST, 677, 255); // we make sure the figure has been resized - bot.waitUntil(new WaitFigureResizedCondition(boundsBefore, figure)); + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); SWTBotGefConnectionEditPart edgeSwtBotGefEditPart = (SWTBotGefConnectionEditPart) editor.getEditPart("edge1", DEdgeEditPart.class); assertEdgeHasExpectedTgtAnchor(edgeSwtBotGefEditPart, new PrecisionPoint(0.5, 0.5)); @@ -817,6 +818,72 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { } /** + * This test launches a specific tool that arranges some nodes and edges: + * <UL> + * <LI>Source node of edge A is moved</LI> + * <LI>Target node of edge A is moved</LI> + * <LI>Bendpoints of edge A are recomputed</LI> + * <LI>Routing style of edge A is changed (both in Sirius style and GMF + * style)</LI> + * <LI>Routing style of edge B is changed (both in Sirius style and GMF + * style)</LI> + * </UL> + * . This kind of layout can be done when someone make specific layout + * action. The goal is to check that in this condition, the edge A is + * correctly layouted. + */ + public void testSpecificLayout() { + editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), "borderNodesDiagram", "new borderNodesDiagram", DDiagram.class); + IFigure figure = ((GraphicalEditPart) editor.getEditPart("Class1", DNodeEditPart.class).part()).getFigure(); + Rectangle boundsBefore = figure.getBounds().getCopy(); + + editor.activateTool("Move elements"); + editor.click(10, 10); + // we make sure the at least one figure has been moved + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); + + // Check that the edge from Class1 to Class11 is correctly layouted + // (only two bendpoints) + SWTBotGefConnectionEditPart swtBotGefEditPart = (SWTBotGefConnectionEditPart) editor.getEditPart("toClass11", DEdgeEditPart.class); + ConnectionEditPart connectionEditPart = (ConnectionEditPart) swtBotGefEditPart.part(); + Connection connection = (Connection) connectionEditPart.getFigure(); + assertEquals("Wrong nomber of points for edge figure.", 2, connection.getPoints().size()); + assertEquals("Wrong nomber of GMF bendpoints.", 2, ((RelativeBendpoints) ((Edge) connectionEditPart.getNotationView()).getBendpoints()).getPoints().size()); + } + + /** + * This test launches a specific tool that arranges some nodes and edge: + * <UL> + * <LI>Auto-sized target node of an edge is moved</LI> + * <LI>Bendpoints of edge are recomputed</LI> + * <LI>Routing style of edge is changed (both in Sirius style and GMF style) + * </LI> + * </UL> + * . This kind of layout can be done when someone make specific layout + * action. The goal is to check that in this condition, the edge is + * correctly layouted. + */ + public void testSpecificVerticalLayout() { + openDiagram("specificVerticalLayout"); + IFigure figure = ((GraphicalEditPart) editor.getEditPart("container1container1container1container1container1container1", DNodeContainerEditPart.class).part()).getFigure(); + Rectangle boundsBefore = figure.getBounds().getCopy(); + + editor.activateTool("Move elements"); + editor.click(10, 10); + // we make sure the at least one figure has been moved + bot.waitUntil(new WaitFigureBoundsChangedCondition(boundsBefore, figure)); + + // Check that the edge from container2 to + // container1container1container1container1container1container1 is + // correctly layouted (only two bendpoints) + SWTBotGefConnectionEditPart swtBotGefEditPart = (SWTBotGefConnectionEditPart) editor.getEditPart("edge1", DEdgeEditPart.class); + ConnectionEditPart connectionEditPart = (ConnectionEditPart) swtBotGefEditPart.part(); + Connection connection = (Connection) connectionEditPart.getFigure(); + assertEquals("Wrong nomber of points for edge figure.", 2, connection.getPoints().size()); + assertEquals("Wrong nomber of GMF bendpoints.", 2, ((RelativeBendpoints) ((Edge) connectionEditPart.getNotationView()).getBendpoints()).getPoints().size()); + } + + /** * * @param gefConnectionEditPart * @param routingStyle @@ -1032,7 +1099,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { * @author fbarbin * */ - private class WaitFigureResizedCondition extends DefaultCondition { + private class WaitFigureBoundsChangedCondition extends DefaultCondition { private Rectangle before; @@ -1047,7 +1114,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { * @param figure * the figure. */ - public WaitFigureResizedCondition(Rectangle before, IFigure figure) { + public WaitFigureBoundsChangedCondition(Rectangle before, IFigure figure) { this.before = before; this.figure = figure; } @@ -1068,7 +1135,7 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase { */ @Override public String getFailureMessage() { - return "the figure should be resized"; + return "The bounds of the figure should be changed (resized or moved)"; } } diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/services/ExternalJavaActionSpecificLayout.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/services/ExternalJavaActionSpecificLayout.java new file mode 100644 index 0000000000..fbec7f68ae --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/services/ExternalJavaActionSpecificLayout.java @@ -0,0 +1,155 @@ +/******************************************************************************* + * Copyright (c) 2016 THALES GLOBAL SERVICES. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.swtbot.services; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EStructuralFeature.Setting; +import org.eclipse.emf.ecore.util.ECrossReferenceAdapter; +import org.eclipse.gmf.runtime.notation.ConnectorStyle; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.LayoutConstraint; +import org.eclipse.gmf.runtime.notation.Location; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.NotationFactory; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.RelativeBendpoints; +import org.eclipse.gmf.runtime.notation.Routing; +import org.eclipse.gmf.runtime.notation.Size; +import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; +import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.business.api.session.SessionManager; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DDiagramElement; +import org.eclipse.sirius.diagram.DDiagramElementContainer; +import org.eclipse.sirius.diagram.DNode; +import org.eclipse.sirius.diagram.DiagramPackage; +import org.eclipse.sirius.diagram.EdgeRouting; +import org.eclipse.sirius.diagram.EdgeStyle; +import org.eclipse.sirius.tests.sample.migration.migrationmodeler.Bordered; +import org.eclipse.sirius.tests.sample.migration.migrationmodeler.Container; +import org.eclipse.sirius.tests.sample.migration.migrationmodeler.Diagram; +import org.eclipse.sirius.tools.api.ui.IExternalJavaAction; +import org.eclipse.sirius.viewpoint.Style; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; + +/** + * An {@link IExternalJavaAction} used to test a specific layout. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public class ExternalJavaActionSpecificLayout implements IExternalJavaAction { + private static final String DDIAGRAM_PARAM = "ddiagram"; + + private Node getGMFNode(DDiagramElement dDiagramElement, ECrossReferenceAdapter xref) { + for (EStructuralFeature.Setting setting : Iterables.filter(xref.getInverseReferences(dDiagramElement), new Predicate<EStructuralFeature.Setting>() { + @Override + public boolean apply(Setting input) { + return input != null && input.getEStructuralFeature().getName().equals("element"); + } + })) { + return (Node) setting.getEObject(); + } + return null; + } + + @Override + public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) { + Diagram self = (Diagram) selections.iterator().next(); + Session sess = SessionManager.INSTANCE.getSession(self); + if (sess != null) { + ECrossReferenceAdapter xref = sess.getSemanticCrossReferencer(); + Object dDiagramObjectParam = parameters.get(DDIAGRAM_PARAM); + if (dDiagramObjectParam instanceof DDiagram) { + DDiagram diagram = (DDiagram) dDiagramObjectParam; + + for (DNode dNode : diagram.getNodes()) { + Node node = getGMFNode(dNode, xref); + if (node != null) { + LayoutConstraint layoutConstraint = node.getLayoutConstraint(); + if (layoutConstraint instanceof Location) { + if (dNode.getTarget() instanceof Bordered) { + if ("Interface11".equals(((Bordered) dNode.getTarget()).getId())) { + // Change routing style of edge from + // Interface11 to Interface12 + Style style = dNode.getOutgoingEdges().get(0).getStyle(); + ((EdgeStyle) style).setRoutingStyle(EdgeRouting.MANHATTAN_LITERAL); + ((EdgeStyle) style).getCustomFeatures().add(DiagramPackage.Literals.EDGE_STYLE__ROUTING_STYLE.getName()); + final ConnectorStyle connectorStyle = (ConnectorStyle) ((Edge) node.getSourceEdges().get(0)).getStyle(NotationPackage.eINSTANCE.getConnectorStyle()); + if (connectorStyle != null) { + connectorStyle.setRouting(Routing.RECTILINEAR_LITERAL); + } + } + } else if ("Class1".equals(((org.eclipse.sirius.tests.sample.migration.migrationmodeler.Node) dNode.getTarget()).getId())) { + // Move Class1 + ((Location) layoutConstraint).setX(50); + ((Location) layoutConstraint).setY(90); + // Move edge from Class1 to Class11 + RelativeBendpoints result = NotationFactory.eINSTANCE.createRelativeBendpoints(); + List<RelativeBendpoint> relativeBendpoints = new LinkedList<RelativeBendpoint>(); + relativeBendpoints.add(new RelativeBendpoint(51, 0, -159, 0)); + relativeBendpoints.add(new RelativeBendpoint(130, 0, -80, 0)); + result.setPoints(relativeBendpoints); + ((Edge) node.getSourceEdges().get(0)).setBendpoints(result); + // Change its routing style + Style style = dNode.getOutgoingEdges().get(0).getStyle(); + ((EdgeStyle) style).setRoutingStyle(EdgeRouting.MANHATTAN_LITERAL); + ((EdgeStyle) style).getCustomFeatures().add(DiagramPackage.Literals.EDGE_STYLE__ROUTING_STYLE.getName()); + final ConnectorStyle connectorStyle = (ConnectorStyle) ((Edge) node.getSourceEdges().get(0)).getStyle(NotationPackage.eINSTANCE.getConnectorStyle()); + if (connectorStyle != null) { + connectorStyle.setRouting(Routing.RECTILINEAR_LITERAL); + } + } else if ("Class11".equals(((org.eclipse.sirius.tests.sample.migration.migrationmodeler.Node) dNode.getTarget()).getId())) { + // Move Class11 + ((Location) layoutConstraint).setX(17); + ((Location) layoutConstraint).setY(24); + } + } + } + } + for (DDiagramElementContainer dContainer : diagram.getContainers()) { + Node node = getGMFNode(dContainer, xref); + if (node != null) { + LayoutConstraint layoutConstraint = node.getLayoutConstraint(); + // Move and resize P1 + if ("P1".equals(((Container) dContainer.getTarget()).getId())) { + if (layoutConstraint instanceof Location) { + ((Location) layoutConstraint).setX(200); + ((Location) layoutConstraint).setY(20); + } + if (layoutConstraint instanceof Size) { + ((Size) layoutConstraint).setHeight(300); + } + } + } + } + } + } + } + + /* + * (non-Javadoc) + * @see + * org.eclipse.sirius.tools.api.ui.IExternalJavaAction#canExecute(java.util. + * Collection) + */ + @Override + public boolean canExecute(Collection<? extends EObject> selections) { + return selections.size() == 1 && selections.iterator().next() instanceof Diagram; + } +} diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/services/ExternalJavaActionSpecificVerticalLayout.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/services/ExternalJavaActionSpecificVerticalLayout.java new file mode 100644 index 0000000000..0fab08dc9d --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/services/ExternalJavaActionSpecificVerticalLayout.java @@ -0,0 +1,142 @@ +/******************************************************************************* + * Copyright (c) 2016 THALES GLOBAL SERVICES. + * 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.swtbot.services; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.EStructuralFeature.Setting; +import org.eclipse.emf.ecore.util.ECrossReferenceAdapter; +import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; +import org.eclipse.gmf.runtime.notation.ConnectorStyle; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.LayoutConstraint; +import org.eclipse.gmf.runtime.notation.Location; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.NotationFactory; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.RelativeBendpoints; +import org.eclipse.gmf.runtime.notation.Routing; +import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; +import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.business.api.session.SessionManager; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DDiagramElement; +import org.eclipse.sirius.diagram.DDiagramElementContainer; +import org.eclipse.sirius.diagram.DiagramPackage; +import org.eclipse.sirius.diagram.EdgeRouting; +import org.eclipse.sirius.diagram.EdgeStyle; +import org.eclipse.sirius.diagram.ui.internal.edit.parts.DNodeContainerEditPart; +import org.eclipse.sirius.diagram.ui.tools.api.part.IDiagramDialectGraphicalViewer; +import org.eclipse.sirius.tests.sample.migration.migrationmodeler.Container; +import org.eclipse.sirius.tests.sample.migration.migrationmodeler.Diagram; +import org.eclipse.sirius.tools.api.ui.IExternalJavaAction; +import org.eclipse.sirius.viewpoint.Style; +import org.eclipse.ui.PlatformUI; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; + +/** + * An {@link IExternalJavaAction} used to test a specific vertical layout. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public class ExternalJavaActionSpecificVerticalLayout implements IExternalJavaAction { + private static final String DDIAGRAM_PARAM = "ddiagram"; + + private Node getGMFNode(DDiagramElement dDiagramElement, ECrossReferenceAdapter xref) { + for (EStructuralFeature.Setting setting : Iterables.filter(xref.getInverseReferences(dDiagramElement), new Predicate<EStructuralFeature.Setting>() { + @Override + public boolean apply(Setting input) { + return input != null && input.getEStructuralFeature().getName().equals("element"); + } + })) { + return (Node) setting.getEObject(); + } + return null; + } + + @Override + public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) { + Diagram self = (Diagram) selections.iterator().next(); + Session sess = SessionManager.INSTANCE.getSession(self); + if (sess != null) { + ECrossReferenceAdapter xref = sess.getSemanticCrossReferencer(); + Object dDiagramObjectParam = parameters.get(DDIAGRAM_PARAM); + if (dDiagramObjectParam instanceof DDiagram) { + DDiagram diagram = (DDiagram) dDiagramObjectParam; + // First iteration to retrieve container data needed after. + DiagramEditor editor = (DiagramEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + IDiagramDialectGraphicalViewer viewer = (IDiagramDialectGraphicalViewer) editor.getDiagramGraphicalViewer(); + double xCenterReferenceLocation = 0; + double xLocation = 0; + double width = 0; + for (DDiagramElementContainer dContainer : diagram.getContainers()) { + Container container = (Container) dContainer.getTarget(); + if ("container2".equals(container.getId())) { + for (DNodeContainerEditPart editPart : viewer.findEditPartsForElement(dContainer.getTarget(), DNodeContainerEditPart.class)) { + xCenterReferenceLocation = editPart.getFigure().getBounds().getCenter().preciseX(); + } + } else { + for (DNodeContainerEditPart editPart : viewer.findEditPartsForElement(dContainer.getTarget(), DNodeContainerEditPart.class)) { + xLocation = editPart.getFigure().getBounds().preciseX(); + width = editPart.getFigure().getBounds().preciseWidth(); + } + } + } + for (DDiagramElementContainer dContainer : diagram.getContainers()) { + Node node = getGMFNode(dContainer, xref); + if (node != null) { + LayoutConstraint layoutConstraint = node.getLayoutConstraint(); + if ("container1container1container1container1container1container1".equals(((Container) dContainer.getTarget()).getId())) { + // Move it (center on other container) + if (layoutConstraint instanceof Location) { + // ((Location) layoutConstraint).setX(61); + ((Location) layoutConstraint).setX((int) Math.round(xCenterReferenceLocation - (width / 2))); + } + // Make the incoming edge rectilinear and straight + RelativeBendpoints result = NotationFactory.eINSTANCE.createRelativeBendpoints(); + List<RelativeBendpoint> relativeBendpoints = new LinkedList<RelativeBendpoint>(); + relativeBendpoints.add(new RelativeBendpoint(0, 34, 0, -186)); + relativeBendpoints.add(new RelativeBendpoint(0, 186, 0, -34)); + result.setPoints(relativeBendpoints); + ((Edge) node.getTargetEdges().get(0)).setBendpoints(result); + // Change its routing style + Style style = dContainer.getIncomingEdges().get(0).getStyle(); + ((EdgeStyle) style).setRoutingStyle(EdgeRouting.MANHATTAN_LITERAL); + ((EdgeStyle) style).getCustomFeatures().add(DiagramPackage.Literals.EDGE_STYLE__ROUTING_STYLE.getName()); + final ConnectorStyle connectorStyle = (ConnectorStyle) ((Edge) node.getTargetEdges().get(0)).getStyle(NotationPackage.eINSTANCE.getConnectorStyle()); + if (connectorStyle != null) { + connectorStyle.setRouting(Routing.RECTILINEAR_LITERAL); + } + } + } + } + } + } + } + + /* + * (non-Javadoc) + * @see + * org.eclipse.sirius.tools.api.ui.IExternalJavaAction#canExecute(java.util. + * Collection) + */ + @Override + public boolean canExecute(Collection<? extends EObject> selections) { + return selections.size() == 1 && selections.iterator().next() instanceof Diagram; + } +} |
