Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsboyko2014-08-01 07:27:25 +0000
committerSergey Boyko2014-08-05 14:48:23 +0000
commitf779e9d81cd86fcf180c27ada13c5df8287451e3 (patch)
treeabf3a830f9b2019ab47f9e48517896e0b268fc8f
parentccc6dc241e4c5cf59b23f5b96ec0825da621fac7 (diff)
downloadorg.eclipse.papyrus-f779e9d81cd86fcf180c27ada13c5df8287451e3.tar.gz
org.eclipse.papyrus-f779e9d81cd86fcf180c27ada13c5df8287451e3.tar.xz
org.eclipse.papyrus-f779e9d81cd86fcf180c27ada13c5df8287451e3.zip
Bug 350726 - [SequenceDiagram] Can't align Action Execution Specifications
Change-Id: Id7cdb2d4c214033069862c3c5257df0c2a7ec22c Signed-off-by: sboyko <serg.boyko2011@gmail.com>
-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