Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2017-06-09 10:17:31 +0000
committerLaurent Redor2017-06-20 09:01:26 +0000
commitb173984e0e8b5768e167c36306a79e361971e1c6 (patch)
tree3c24385c13452ee51d9becf35acb98c7cfa8016a
parent19431b10fb3dc5d6d8a61504a9c722a46f2964d5 (diff)
downloadorg.eclipse.sirius-b173984e0e8b5768e167c36306a79e361971e1c6.tar.gz
org.eclipse.sirius-b173984e0e8b5768e167c36306a79e361971e1c6.tar.xz
org.eclipse.sirius-b173984e0e8b5768e167c36306a79e361971e1c6.zip
[518441] Fix GMF edge bendpoints pb with oblique edge with one segment
This commit also adds corresponding test. Bug: 518441 Cherry-picked-from: 518073 Change-Id: I28a72aaf43ac67b57109f210146f50ca8e1826ae Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SetConnectionBendpointsAccordingToExtremityMoveCommmand.java48
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.aird88
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.odesign23
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BendpointsStabilityOnMovesSpecificCasesTest.java74
4 files changed, 214 insertions, 19 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SetConnectionBendpointsAccordingToExtremityMoveCommmand.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SetConnectionBendpointsAccordingToExtremityMoveCommmand.java
index 307c423e7c..ea04344c26 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SetConnectionBendpointsAccordingToExtremityMoveCommmand.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/SetConnectionBendpointsAccordingToExtremityMoveCommmand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2014, 2017 THALES GLOBAL SERVICES 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
@@ -100,7 +100,7 @@ public class SetConnectionBendpointsAccordingToExtremityMoveCommmand extends Set
PrecisionRectangle targetBounds = new PrecisionRectangle(GraphicalHelper.getAbsoluteBoundsIn100Percent((IGraphicalEditPart) connectionEditPart.getTarget()));
boolean isEdgeWithRectilinearRoutingStyle = new ConnectionEditPartQuery(connectionEditPart).isEdgeWithRectilinearRoutingStyle();
if (sourceMove) {
- moveFirstSegmentAndRefPointAccordingToSourcetMove(moveDelta, isEdgeWithRectilinearRoutingStyle, sourceBounds, targetBounds, sourceRefPoint, targetRefPoint, connectionPointList);
+ moveFirstSegmentAndRefPointAccordingToSourceMove(moveDelta, isEdgeWithRectilinearRoutingStyle, sourceBounds, targetBounds, sourceRefPoint, targetRefPoint, connectionPointList);
} else {
moveLastSegmentAndRefPointAccordingToTargetMove(moveDelta, isEdgeWithRectilinearRoutingStyle, sourceBounds, targetBounds, sourceRefPoint, targetRefPoint, connectionPointList);
}
@@ -126,7 +126,7 @@ public class SetConnectionBendpointsAccordingToExtremityMoveCommmand extends Set
* @param connectionPointList
* The point list to adapt
*/
- private static void moveFirstSegmentAndRefPointAccordingToSourcetMove(Point moveDelta, boolean isEdgeWithRectilinearRoutingStyle, PrecisionRectangle sourceBounds, PrecisionRectangle targetBounds,
+ private static void moveFirstSegmentAndRefPointAccordingToSourceMove(Point moveDelta, boolean isEdgeWithRectilinearRoutingStyle, PrecisionRectangle sourceBounds, PrecisionRectangle targetBounds,
Point sourceRefPoint, Point targetRefPoint, PointList connectionPointList) {
// Move reference point
sourceRefPoint.performTranslate(moveDelta.x, moveDelta.y);
@@ -145,16 +145,29 @@ public class SetConnectionBendpointsAccordingToExtremityMoveCommmand extends Set
// This code is not needed if the edge has only 2 points.
removePointsInViews(connectionPointList, (PrecisionRectangle) sourceBounds.getTranslated(moveDelta), sourceRefPoint, targetBounds, targetRefPoint);
}
- } else {
- // Compute intersection between the line
- // (tempSourceRefPoint<-->second point) and the source node
- // 2-Compute intersection
+ } else if (connectionPointList.size() > 2) {
+ // Compute intersection between the line (moved
+ // sourceRefPoint<-->second point) and the source node
Option<Point> intersectionPoint = GraphicalHelper.getIntersection(sourceRefPoint, connectionPointList.getPoint(1), sourceBounds.getTranslated(moveDelta), false);
if (intersectionPoint.some()) {
connectionPointList.setPoint(intersectionPoint.get(), 0);
} else {
connectionPointList.setPoint(connectionPointList.getPoint(0).translate(moveDelta), 0);
}
+ } else {
+ // If the edge has only one segment, we must compute the
+ // intersection between the line (moved
+ // sourceRefPoint<-->targetRefPoint) the source and target nodes
+ Option<Point> sourceIntersectionPoint = GraphicalHelper.getIntersection(sourceRefPoint, targetRefPoint, sourceBounds.getTranslated(moveDelta), false);
+ if (sourceIntersectionPoint.some()) {
+ connectionPointList.setPoint(sourceIntersectionPoint.get(), 0);
+ } else {
+ connectionPointList.setPoint(connectionPointList.getPoint(0).translate(moveDelta), 0);
+ }
+ Option<Point> targetIntersectionPoint = GraphicalHelper.getIntersection(sourceRefPoint, targetRefPoint, targetBounds, false);
+ if (targetIntersectionPoint.some()) {
+ connectionPointList.setPoint(targetIntersectionPoint.get(), 1);
+ }
}
}
@@ -197,10 +210,10 @@ public class SetConnectionBendpointsAccordingToExtremityMoveCommmand extends Set
// This code is not needed if the edge has only 2 points.
removePointsInViews(connectionPointList, sourceBounds, sourceRefPoint, (PrecisionRectangle) targetBounds.getTranslated(moveDelta), targetRefPoint);
}
- } else {
+ } else if (connectionPointList.size() > 2) {
// Compute intersection between the line
- // (tempTargetRefPoint<-->second to last point) and the target node
- // 2-Compute intersection
+ // (moved targetRefPoint<-->second to last point) and the target
+ // node
Option<Point> intersectionPoint = GraphicalHelper.getIntersection(targetRefPoint, connectionPointList.getPoint(connectionPointList.size() - 2), targetBounds.getTranslated(moveDelta),
false);
if (intersectionPoint.some()) {
@@ -208,7 +221,20 @@ public class SetConnectionBendpointsAccordingToExtremityMoveCommmand extends Set
} else {
connectionPointList.setPoint(connectionPointList.getPoint(connectionPointList.size() - 1).translate(moveDelta), connectionPointList.size() - 1);
}
-
+ } else {
+ // If the edge has only one segment, we must compute the
+ // intersection between the line (sourceRefPoint<-->moved
+ // targetRefPoint) and the source and target nodes
+ Option<Point> sourceIntersectionPoint = GraphicalHelper.getIntersection(sourceRefPoint, targetRefPoint, sourceBounds, false);
+ if (sourceIntersectionPoint.some()) {
+ connectionPointList.setPoint(sourceIntersectionPoint.get(), connectionPointList.size() - 2);
+ }
+ Option<Point> targetIntersectionPoint = GraphicalHelper.getIntersection(sourceRefPoint, targetRefPoint, targetBounds.getTranslated(moveDelta), false);
+ if (targetIntersectionPoint.some()) {
+ connectionPointList.setPoint(targetIntersectionPoint.get(), connectionPointList.size() - 1);
+ } else {
+ connectionPointList.setPoint(connectionPointList.getPoint(connectionPointList.size() - 1).translate(moveDelta), connectionPointList.size() - 1);
+ }
}
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.aird
index b8997754ee..82829e409e 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.aird
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.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: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/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="__OXRoD_3EeWEGe6pBhmYQg" selectedViews="_AEoyUD_4EeWEGe6pBhmYQg _9YB9sIxMEeWRjpf7ffS9_g" 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: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/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="__OXRoD_3EeWEGe6pBhmYQg" selectedViews="_AEoyUD_4EeWEGe6pBhmYQg _9YB9sIxMEeWRjpf7ffS9_g _ES9FQFTUEeee6YSXJiKz8A" version="10.1.6.201608121430">
<semanticResources>My.ecore</semanticResources>
<ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_AEoyUD_4EeWEGe6pBhmYQg">
<ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_AIKAYD_4EeWEGe6pBhmYQg" name="rectilinearCase1">
@@ -334,4 +334,90 @@
</ownedRepresentations>
<viewpoint xmi:type="description:Viewpoint" href="My.odesign#//@ownedViewpoints[name='EdgeFromNoteToEContainer']"/>
</ownedViews>
+ <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_ES9FQFTUEeee6YSXJiKz8A">
+ <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_GHrLMFTUEeee6YSXJiKz8A" name="newDiag3">
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_GHrLMVTUEeee6YSXJiKz8A" source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_GHrLMlTUEeee6YSXJiKz8A"/>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_GHryQFTUEeee6YSXJiKz8A" source="GMF_DIAGRAMS">
+ <data xmi:type="notation:Diagram" xmi:id="_GHryQVTUEeee6YSXJiKz8A" type="Sirius" element="_GHrLMFTUEeee6YSXJiKz8A" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_GHryQ1TUEeee6YSXJiKz8A" type="2001" element="_GHrLM1TUEeee6YSXJiKz8A">
+ <children xmi:type="notation:Node" xmi:id="_GHryRlTUEeee6YSXJiKz8A" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_GHryR1TUEeee6YSXJiKz8A" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_GHsZUFTUEeee6YSXJiKz8A" type="3003" element="_GHrLNFTUEeee6YSXJiKz8A">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_GHsZUVTUEeee6YSXJiKz8A" fontName="Segoe UI"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GHsZUlTUEeee6YSXJiKz8A"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_GHryRFTUEeee6YSXJiKz8A" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GHryRVTUEeee6YSXJiKz8A" x="175" y="99" width="100" height="100"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_GHrySFTUEeee6YSXJiKz8A" type="2001" element="_GHrLNVTUEeee6YSXJiKz8A">
+ <children xmi:type="notation:Node" xmi:id="_GHryS1TUEeee6YSXJiKz8A" type="5002">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_GHryTFTUEeee6YSXJiKz8A" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_GHsZU1TUEeee6YSXJiKz8A" type="3003" element="_GHrLNlTUEeee6YSXJiKz8A">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_GHsZVFTUEeee6YSXJiKz8A" fontName="Segoe UI"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GHsZVVTUEeee6YSXJiKz8A"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_GHrySVTUEeee6YSXJiKz8A" fontName="Segoe UI" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GHrySlTUEeee6YSXJiKz8A" x="300" y="99" width="100" height="100"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_GHryQlTUEeee6YSXJiKz8A"/>
+ <edges xmi:type="notation:Edge" xmi:id="_GHtAYFTUEeee6YSXJiKz8A" type="4001" element="_GHrLN1TUEeee6YSXJiKz8A" source="_GHryQ1TUEeee6YSXJiKz8A" target="_GHrySFTUEeee6YSXJiKz8A">
+ <children xmi:type="notation:Node" xmi:id="_GHtAZFTUEeee6YSXJiKz8A" type="6001">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Upc9IVTVEeeoQM-xYSTJiQ" y="-10"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_GHtAZlTUEeee6YSXJiKz8A" type="6002">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_Upc9IlTVEeeoQM-xYSTJiQ" y="10"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_GHtAaFTUEeee6YSXJiKz8A" type="6003">
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_UpdkMFTVEeeoQM-xYSTJiQ" y="10"/>
+ </children>
+ <styles xmi:type="notation:ConnectorStyle" xmi:id="_GHtAYVTUEeee6YSXJiKz8A"/>
+ <styles xmi:type="notation:FontStyle" xmi:id="_GHtAYlTUEeee6YSXJiKz8A" fontName="Segoe UI" fontHeight="8"/>
+ <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_GHtAY1TUEeee6YSXJiKz8A" points="[50, 0, -75, 0]$[75, 0, -50, 0]"/>
+ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_GHtAalTUEeee6YSXJiKz8A" id="(0.5,0.5)"/>
+ <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_GHtAa1TUEeee6YSXJiKz8A" id="(0.5,0.5)"/>
+ </edges>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_GHrLM1TUEeee6YSXJiKz8A" name="C1" outgoingEdges="_GHrLN1TUEeee6YSXJiKz8A" width="10" height="10" resizeKind="NSEW">
+ <target xmi:type="ecore:EClass" href="My.ecore#//C1"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//C1"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:Square" xmi:id="_GHrLNFTUEeee6YSXJiKz8A" labelPosition="node">
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@nodeMappings[name='nodeClasses']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@nodeMappings[name='nodeClasses']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_GHrLNVTUEeee6YSXJiKz8A" name="C2" incomingEdges="_GHrLN1TUEeee6YSXJiKz8A" width="10" height="10" resizeKind="NSEW">
+ <target xmi:type="ecore:EClass" href="My.ecore#//C2"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//C2"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:Square" xmi:id="_GHrLNlTUEeee6YSXJiKz8A" labelPosition="node">
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@nodeMappings[name='nodeClasses']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@nodeMappings[name='nodeClasses']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_GHrLN1TUEeee6YSXJiKz8A" sourceNode="_GHrLM1TUEeee6YSXJiKz8A" targetNode="_GHrLNVTUEeee6YSXJiKz8A">
+ <target xmi:type="ecore:EReference" href="My.ecore#//C1/toC2"/>
+ <semanticElements xmi:type="ecore:EReference" href="My.ecore#//C1/toC2"/>
+ <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_GHrLOFTUEeee6YSXJiKz8A" size="2" centered="Both">
+ <description xmi:type="style:EdgeStyleDescription" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@edgeMappings[name='references']/@style"/>
+ <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_GHrLOVTUEeee6YSXJiKz8A"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:EdgeMapping" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@edgeMappings[name='references']"/>
+ </ownedDiagramElements>
+ <description xmi:type="description_1:DiagramDescription" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']"/>
+ <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_GHrLOlTUEeee6YSXJiKz8A"/>
+ <activatedLayers xmi:type="description_1:Layer" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer"/>
+ <target xmi:type="ecore:EPackage" href="My.ecore#/"/>
+ </ownedRepresentations>
+ <viewpoint xmi:type="description:Viewpoint" href="My.odesign#//@ownedViewpoints[name='bendpointsForObliqueEdges']"/>
+ </ownedViews>
</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.odesign
index 4e9bfb87f4..346c210f6c 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.odesign
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/bendpointsStability/otherSpecificCases/My.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" name="My" version="11.0.0.201511131800">
+<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" name="My" version="11.1.1.201610211630">
<ownedViewpoints name="EdgeFromNoteToEContainer" modelFileExtension="ecore">
<ownedRepresentations xsi:type="description_1:DiagramDescription" name="Diag" domainClass="ecore.EPackage" enablePopupBars="true">
<defaultLayer name="Default">
@@ -56,4 +56,25 @@
</defaultLayer>
</ownedRepresentations>
</ownedViewpoints>
+ <ownedViewpoints name="bendpointsForObliqueEdges" modelFileExtension="ecore">
+ <ownedRepresentations xsi:type="description_1:DiagramDescription" name="Diag3" domainClass="ecore.EPackage" enablePopupBars="true">
+ <defaultLayer name="Default">
+ <nodeMappings name="nodeClasses" domainClass="ecore.EClass">
+ <style xsi:type="style:SquareDescription" sizeComputationExpression="10" 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="references" sourceMapping="//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@nodeMappings[name='nodeClasses']" targetMapping="//@ownedViewpoints[name='bendpointsForObliqueEdges']/@ownedRepresentations[name='Diag3']/@defaultLayer/@nodeMappings[name='nodeClasses']" targetFinderExpression="aql:self.eType" sourceFinderExpression="aql:self.eContainer()" domainClass="ecore.EReference" useDomainElement="true">
+ <style sizeComputationExpression="2" endsCentering="Both">
+ <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
+ <centerLabelStyleDescription>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ </centerLabelStyleDescription>
+ </style>
+ </edgeMappings>
+ </defaultLayer>
+ </ownedRepresentations>
+ </ownedViewpoints>
</description:Group>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BendpointsStabilityOnMovesSpecificCasesTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BendpointsStabilityOnMovesSpecificCasesTest.java
index 049ab75851..f674755423 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BendpointsStabilityOnMovesSpecificCasesTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/BendpointsStabilityOnMovesSpecificCasesTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014, 2015 THALES GLOBAL SERVICES.
+ * Copyright (c) 2014, 2017 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
@@ -373,6 +373,35 @@ public class BendpointsStabilityOnMovesSpecificCasesTest extends AbstractSiriusS
/**
* Test that last point is moved has expected and that draw2d and GMF last
+ * points are consistency when the segment is inverted. In this case, the
+ * first point is also moved.
+ */
+ public void testPointsConsistencyOfObliqueEdgeAfterInversion() {
+ editor.close();
+ SWTBotUtils.waitAllUiEvents();
+ // Open the other testing diagram editor
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), "Diag3", "newDiag3", DSemanticDiagram.class, true, true);
+
+ final Point moveDelta = new Point(-250, 0);
+ AssertPointLocationFunction assertLastPointLocationFunction = new AssertPointLocationFunction(moveDelta) {
+ @Override
+ public Point getExpectedPoint() {
+ return originalPoint.getTranslated(moveDelta).getTranslated(new Point(movedNodeBounds.width(), 0));
+ }
+ };
+ SWTBotGefEditPart targetEditPart = editor.getEditPart("C1", IAbstractDiagramNodeEditPart.class);
+ final Rectangle nodeBounds = GraphicalHelper.getAbsoluteBoundsIn100Percent((GraphicalEditPart) targetEditPart.part());
+ AssertPointLocationFunction assertFirstPointLocationFunction = new AssertPointLocationFunction(moveDelta) {
+ @Override
+ public Point getExpectedPoint() {
+ return originalPoint.getTranslated(new Point(-nodeBounds.width(), 0));
+ }
+ };
+ testLastPointConsistency(moveDelta, 0, assertLastPointLocationFunction, true, assertFirstPointLocationFunction);
+ }
+
+ /**
+ * Test that last point is moved has expected and that draw2d and GMF last
* points are consistency.
*
* @param moveDelta
@@ -404,6 +433,30 @@ public class BendpointsStabilityOnMovesSpecificCasesTest extends AbstractSiriusS
* true if the edge has only two points, false otherwise
*/
private void testLastPointConsistency(Point moveDelta, int nbGMFPointsDelta, AssertPointLocationFunction assertPointLocationFunction, boolean edgeWithOnly2Points) {
+ testLastPointConsistency(moveDelta, nbGMFPointsDelta, assertPointLocationFunction, edgeWithOnly2Points, null);
+ }
+
+ /**
+ * Test that last point is moved has expected and that draw2d and GMF last
+ * points are consistency.
+ *
+ * @param moveDelta
+ * The delta from which the source node will be moved
+ * @param nbGMFPointsDelta
+ * Number of GMF points that are added (or removed) after the
+ * move.
+ * @param assertLastPointLocationFunction
+ * the function to use to check the expected last point location
+ * after move
+ * @param edgeWithOnly2Points
+ * true if the edge has only two points, false otherwise
+ * @param assertSecondToLastPointLocationFunction
+ * the function to use to check the expected first point location
+ * after move, null if the second to last point is not expected
+ * to be moved
+ */
+ private void testLastPointConsistency(Point moveDelta, int nbGMFPointsDelta, AssertPointLocationFunction assertLastPointLocationFunction, boolean edgeWithOnly2Points,
+ AssertPointLocationFunction assertSecondToLastPointLocationFunction) {
String nodeToMoveName = "C2";
editor.reveal(nodeToMoveName);
// Step 2: store the previous bendpoints
@@ -421,11 +474,20 @@ public class BendpointsStabilityOnMovesSpecificCasesTest extends AbstractSiriusS
assertEquals("Drag as failed: selection should be the same before and after drag.", editPartToMove, editor.selectedEditParts().get(0));
// Step 4: Check bendpoints
if (edgeWithOnly2Points) {
- assertPointLocationFunction.setData(previousPoints.getLastPoint(), previousPoints.getFirstPoint(), nodeBounds);
+ assertLastPointLocationFunction.setData(previousPoints.getLastPoint(), previousPoints.getFirstPoint(), nodeBounds);
+ if (assertSecondToLastPointLocationFunction != null) {
+ assertSecondToLastPointLocationFunction.setData(previousPoints.getFirstPoint(), previousPoints.getLastPoint(), nodeBounds);
+ }
} else {
- assertPointLocationFunction.setData(previousPoints.getLastPoint(), previousPoints.getPoint(previousPoints.size() - 3), nodeBounds);
+ assertLastPointLocationFunction.setData(previousPoints.getLastPoint(), previousPoints.getPoint(previousPoints.size() - 3), nodeBounds);
+ if (assertSecondToLastPointLocationFunction != null) {
+ assertSecondToLastPointLocationFunction.setData(previousPoints.getFirstPoint(), previousPoints.getPoint(2), nodeBounds);
+ }
+ }
+ compareActualBendpointsWithExpected(editor, connectionEditPart, previousPoints, moveDelta, nodeBounds, false, nbGMFPointsDelta, assertLastPointLocationFunction);
+ if (assertSecondToLastPointLocationFunction != null) {
+ compareActualBendpointsWithExpected(editor, connectionEditPart, previousPoints, moveDelta, nodeBounds, true, nbGMFPointsDelta, assertSecondToLastPointLocationFunction);
}
- compareActualBendpointsWithExpected(editor, connectionEditPart, previousPoints, moveDelta, nodeBounds, false, nbGMFPointsDelta, assertPointLocationFunction);
}
/**
@@ -438,7 +500,7 @@ public class BendpointsStabilityOnMovesSpecificCasesTest extends AbstractSiriusS
* Number of GMF points that are added (or removed) after the
* move.
* @param assertPointLocationFunction
- * the function to use to check the expected last point location
+ * the function to use to check the expected first point location
* after move
*/
private void testFirstPointConsistency(Point moveDelta, int nbGMFPointsDelta, AssertPointLocationFunction assertPointLocationFunction) {
@@ -455,7 +517,7 @@ public class BendpointsStabilityOnMovesSpecificCasesTest extends AbstractSiriusS
* Number of GMF points that are added (or removed) after the
* move.
* @param assertPointLocationFunction
- * the function to use to check the expected last point location
+ * the function to use to check the expected first point location
* after move
* @param edgeWithOnly2Points
* true if the edge has only two points, false otherwise

Back to the top