diff options
author | Nicolas FAUVERGUE | 2018-03-22 12:15:18 +0000 |
---|---|---|
committer | Patrick Tessier | 2018-03-23 16:49:15 +0000 |
commit | ce92c6b2098730f35e6361316a2d23ad3d1d74b0 (patch) | |
tree | db7601b907ee4276c648d0aa1142707189e9e901 /plugins | |
parent | ebd30d7b8d6b3c0c9a0cec813ab90718d4de6caf (diff) | |
download | org.eclipse.papyrus-ce92c6b2098730f35e6361316a2d23ad3d1d74b0.tar.gz org.eclipse.papyrus-ce92c6b2098730f35e6361316a2d23ad3d1d74b0.tar.xz org.eclipse.papyrus-ce92c6b2098730f35e6361316a2d23ad3d1d74b0.zip |
Bug 532758: [Sequence Diagram] The height of the life line when
MessageCreate is added is not correct
The new position and the height is correctly calculated.
Change-Id: I3f785f84c8e2ed3f11d9ac8cb8e2114cc6af0e21
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
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/LifeLineGraphicalNodeEditPolicy.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java index 026fb222156..c6177fd15c7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java @@ -575,15 +575,21 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol // Translate to relative getHostFigure().getParent().translateToRelative(snappedLocation); int stickerHeight = ((CLifeLineEditPart) targetEditPart).getStickerHeight(); + + Rectangle bounds = getHostFigure().getBounds(); + + // Calculate the new Y to get the message create at the middle of the life line head + int newY = snappedLocation.y; + // Calculate the new height depending to the current height, the new Y position and the life line head + int newHeight = bounds.height() - snappedLocation.y; if (stickerHeight != -1) { - snappedLocation.y = snappedLocation.y - (stickerHeight / 2); + newY = snappedLocation.y - (stickerHeight / 2); + newHeight = newHeight + stickerHeight; } - Rectangle bounds = getHostFigure().getBounds(); - Rectangle newBounds = new Rectangle(new Point(bounds.x(), snappedLocation.y), new Dimension(bounds.width(), bounds.height() - snappedLocation.y)); + Rectangle newBounds = new Rectangle(new Point(bounds.x(), newY), new Dimension(bounds.width(), bounds.height() - snappedLocation.y + stickerHeight)); - SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Move&Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), //$NON-NLS-1$ - newBounds); + SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Move&Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), newBounds); //$NON-NLS-1$ compoundCommand.add(originalCommand); compoundCommand.add(new GMFtoGEFCommandWrapper(setBoundsCommand)); |