diff options
author | Mickael ADAM | 2017-09-11 13:06:39 +0000 |
---|---|---|
committer | Patrick Tessier | 2017-09-12 14:30:28 +0000 |
commit | 37ea00eea9fb306fdeb00bf3bda6e42a522510bd (patch) | |
tree | cb0a919590b62dc79e63fca4a4e340bf0cedd4ae /plugins | |
parent | 0f8ff9716fff8f2c04c643b16ceb99785f76488b (diff) | |
download | org.eclipse.papyrus-37ea00eea9fb306fdeb00bf3bda6e42a522510bd.tar.gz org.eclipse.papyrus-37ea00eea9fb306fdeb00bf3bda6e42a522510bd.tar.xz org.eclipse.papyrus-37ea00eea9fb306fdeb00bf3bda6e42a522510bd.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>
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.java | 38 |
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 |