Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Farre2019-03-22 12:47:56 -0400
committerNicolas FAUVERGUE2019-04-03 04:57:10 -0400
commita7b3491363cf80239db4eca787c4182330ba02a5 (patch)
tree063ece144d1649a5f7bb12a49953ca2288d7dbf9 /plugins/uml
parent3b45dadbfa72b9969f1ecb9cd7b46833b0e5d806 (diff)
downloadorg.eclipse.papyrus-a7b3491363cf80239db4eca787c4182330ba02a5.tar.gz
org.eclipse.papyrus-a7b3491363cf80239db4eca787c4182330ba02a5.tar.xz
org.eclipse.papyrus-a7b3491363cf80239db4eca787c4182330ba02a5.zip
Bug 542434 : [Sequence Diagram] Add element on stereotyped Lifeline
https://bugs.eclipse.org/bugs/show_bug.cgi?id=542434 -Remove call to deprecated method and add a test to avoid BaseSlidableAnchor Illegal Argument Exception Change-Id: I961b7d3b6e7e01fcb263add6c00cd65a3255fe95 Signed-off-by: Yoann Farre <yoann.farre@cil4sys.com>
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/DisplayEvent.java24
1 files changed, 11 insertions, 13 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/DisplayEvent.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/DisplayEvent.java
index 3276ae20ed4..f3d5feb897f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/DisplayEvent.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/DisplayEvent.java
@@ -10,6 +10,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Yoann Farre (CIL4Sys) <yoann.farre@cil4sys.com> - Bug 542434
*
*****************************************************************************/
@@ -22,16 +23,17 @@ import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Ellipse;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
@@ -285,7 +287,12 @@ public class DisplayEvent {
* @return the y relative to it's node. (here is a lifeline)
*/
public int getYfromAnchor(Node node, IdentityAnchor anchor) {
- double yPercent = IdentityAnchorHelper.getYPercentage(anchor);
+ PrecisionPoint point = BaseSlidableAnchor.parseTerminalString(anchor.getId());
+ if (point == null) {
+ return 0;
+ }
+
+ double yPercent = point.preciseY();
// calculate bounds from notation
int height = BoundForEditPart.getHeightFromView(node);
@@ -336,12 +343,8 @@ public class DisplayEvent {
} else {
anchor = (IdentityAnchor) edge.getTargetAnchor();
}
- double yPercent = IdentityAnchorHelper.getYPercentage(anchor);
+ double posY = getYfromAnchor(node, anchor);
- // calculate bounds from notation
- double height = BoundForEditPart.getHeightFromView(node);
-
- double posY = yPercent * height;
IFigure lifelineFigure = ((GraphicalEditPart) editpart).getFigure();
if (lifelineFigure.getBounds().y + (int) posY - EVENT_SELECTION_DELTA < currentPosition.y() && currentPosition.y() < lifelineFigure.getBounds().y + (int) posY + EVENT_SELECTION_DELTA) {
if ((edge.getElement() instanceof Message)) {
@@ -428,13 +431,8 @@ public class DisplayEvent {
}
if (null != anchor) {
- double yPercent = IdentityAnchorHelper.getYPercentage(anchor);
-
- // calculate bounds from notation
- double height = 0;
- height = BoundForEditPart.getHeightFromView(node);
+ double posY = getYfromAnchor(node, anchor);
- double posY = yPercent * height;
addAnEvent(container.getFigure(), posY, ColorConstants.white, currentPosition);
}
}

Back to the top