Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-08-08 10:55:09 +0000
committerGerrit Code Review @ Eclipse.org2014-08-08 10:55:09 +0000
commit5c05b56373d15fc73f7dd099c88300a828f67d43 (patch)
treeab435c7364e1527d57e2efe28227d0c7e0fe550f
parent6c9c17e521259fc5243604e126cc5dc75403762c (diff)
parentf779e9d81cd86fcf180c27ada13c5df8287451e3 (diff)
downloadorg.eclipse.papyrus-5c05b56373d15fc73f7dd099c88300a828f67d43.tar.gz
org.eclipse.papyrus-5c05b56373d15fc73f7dd099c88300a828f67d43.tar.xz
org.eclipse.papyrus-5c05b56373d15fc73f7dd099c88300a828f67d43.zip
Merge "Bug 350726 - [SequenceDiagram] Can't align Action Execution Specifications"
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java25
1 files changed, 22 insertions, 3 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
index 3ea1a26213f..b0ba4e6f41d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
@@ -29,6 +30,7 @@ import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.AlignmentRequest;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gef.requests.DropRequest;
@@ -603,9 +605,26 @@ public class LifelineXYLayoutEditPolicy extends XYLayoutEditPolicy {
Rectangle oldBounds = executionSpecificationEP.getFigure().getBounds().getCopy();
Rectangle newBounds = oldBounds.getCopy();
// According to the parameters, the new bounds would be the following
- newBounds.x += request.getMoveDelta().x;
- newBounds.y += request.getMoveDelta().y;
- newBounds.height += newSizeDelta.height;
+ if (request instanceof AlignmentRequest) {
+ AlignmentRequest alignmentRequest = (AlignmentRequest)request;
+ // Horizontal-only alignment is not allowed
+ switch(alignmentRequest.getAlignment()) {
+ case PositionConstants.LEFT:
+ case PositionConstants.CENTER:
+ case PositionConstants.RIGHT:
+ case PositionConstants.HORIZONTAL:
+ return UnexecutableCommand.INSTANCE;
+ }
+ newBounds = alignmentRequest.getAlignmentRectangle().getCopy();
+ executionSpecificationEP.getFigure().translateToRelative(newBounds);
+ // Remove X component of the alignment
+ newBounds.x = oldBounds.x;
+ }
+ else {
+ newBounds.x += request.getMoveDelta().x;
+ newBounds.y += request.getMoveDelta().y;
+ newBounds.height += newSizeDelta.height;
+ }
// Not to check list
List<ShapeNodeEditPart> notToCheckExecutionSpecificationList = new BasicEList<ShapeNodeEditPart>();
// Affixed ExecutionSpecification List

Back to the top