Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2017-09-11 13:06:39 +0000
committerMickael ADAM2017-09-15 12:41:31 +0000
commitb15ba982a57b40e8800c40d352059f1e5a887bda (patch)
treeece3d5ad1f971a03b911cfd21bbd06de35b24c87 /plugins
parent2ea59c2e846e689b92af662d342f69dc50e3ec2c (diff)
downloadorg.eclipse.papyrus-b15ba982a57b40e8800c40d352059f1e5a887bda.tar.gz
org.eclipse.papyrus-b15ba982a57b40e8800c40d352059f1e5a887bda.tar.xz
org.eclipse.papyrus-b15ba982a57b40e8800c40d352059f1e5a887bda.zip
Bug 522135 - [Sequence Diagram] Execution specification should not move
after message create creation https://bugs.eclipse.org/bugs/show_bug.cgi?id=522135 Change-Id: If2578d9b6f53bed631b0687c08eea4f45af6f3e7 Signed-off-by: Mickael ADAM <mickael.adam@all4tec.net> (cherry picked from commit 37ea00eea9fb306fdeb00bf3bda6e42a522510bd)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java38
1 files changed, 37 insertions, 1 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java
index 1c6b6ebf2aa..59813c8635b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java
@@ -13,6 +13,7 @@
package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
@@ -20,13 +21,16 @@ import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.DecorationNode;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
+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.NotationPackage;
@@ -36,6 +40,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.ExecutionSpecification;
/**
* this class is used to connect a node to the grid
@@ -270,6 +275,19 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
// updateAnchors
if (((EObject) notification.getNotifier()).eContainer().equals(((EObject) getHost().getModel()))) {
Node node = (Node) this.getHost().getModel();
+
+ // children case
+ for (Object child : node.getChildren()) {
+ // Nodes
+ if (child instanceof Node) {
+ EObject element = ((Node) child).getElement();
+ // ExecutionSpecification
+ if (element instanceof ExecutionSpecification) {
+ updateExecutionSpecificationFromY((Node) child, notification.getNewIntValue(), notification.getOldIntValue());
+ }
+ }
+ }
+
java.util.List<Edge> sourceEdge = node.getSourceEdges();
for (Edge edge : sourceEdge) {
IdentityAnchor anchor = (IdentityAnchor) edge.getSourceAnchor();
@@ -295,6 +313,25 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
}
/**
+ * This update the position of {@link ExecutionSpecification} {@link Node} after the Y move of lifeline parent.
+ *
+ * @param execSpecNode
+ * the {@link ExecutionSpecification} {@link Node}
+ * @param newYValue
+ * the new Y value
+ * @param oldYValue
+ * the old Y value
+ */
+ protected void updateExecutionSpecificationFromY(final Node execSpecNode, final int newYValue, final int oldYValue) {
+ LayoutConstraint layoutConstraint = execSpecNode.getLayoutConstraint();
+ if (layoutConstraint instanceof Bounds) {
+ int delta = newYValue - oldYValue;
+ execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update ExecutionSpecification", new EObjectAdapter(execSpecNode), //$NON-NLS-1$
+ new Point(((Bounds) layoutConstraint).getX(), ((Bounds) layoutConstraint).getY() - delta)));
+ }
+ }
+
+ /**
* When the bounds of the notation has change the axis must change
* In this case this is the height that has change so rowFinish must change
*
@@ -448,7 +485,6 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im
}
/**
- * /**
* this class update the position of anchor after the move
*
* @param sourceEdge

Back to the top