Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2017-08-24 13:38:23 +0000
committerMickael ADAM2017-09-01 07:05:32 +0000
commit934b9f9b2129b67d3e44dd502f084ed226210bfa (patch)
tree238f13fbf8505d1e4dfa29b96188a8d1413089c1 /plugins/uml
parent7c97222c5dfcd71c609af06d62633d0fccdaf4f2 (diff)
downloadorg.eclipse.papyrus-934b9f9b2129b67d3e44dd502f084ed226210bfa.tar.gz
org.eclipse.papyrus-934b9f9b2129b67d3e44dd502f084ed226210bfa.tar.xz
org.eclipse.papyrus-934b9f9b2129b67d3e44dd502f084ed226210bfa.zip
Bug 521312 - [Sequence Diagram] Message Lost and Found are not well
managed https://bugs.eclipse.org/bugs/show_bug.cgi?id=521312 - Fix message foud and lost anchor - implement messageEditHelper for both - set dot size of them to 10,10 Change-Id: I072f08afc58da13e320a080fa7f431680f9ac646 Signed-off-by: Mickael ADAM <mickael.adam@all4tec.net>
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/edit/helpers/AnchorHelper.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionEditPart.java62
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageFoundEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageLostEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceReferenceEditPolicy.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageFound.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageLost.java19
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java5
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/MessageEditHelper.java65
9 files changed, 122 insertions, 94 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java
index c7f01153297..c1208c8736b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/helpers/AnchorHelper.java
@@ -1,3 +1,14 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST, ALL4TEC and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 521312
+ *****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.helpers;
import org.eclipse.draw2d.ConnectionAnchor;
@@ -23,6 +34,7 @@ import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor;
import org.eclipse.gmf.runtime.notation.Anchor;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
+import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusSlidableSnapToGridAnchor;
public class AnchorHelper {
@@ -42,8 +54,7 @@ public class AnchorHelper {
}
if (a instanceof IdentityAnchor) {
setResult(((IdentityAnchor) a).getId());
- }
- else {
+ } else {
setResult(""); //$NON-NLS-1$
}
}
@@ -249,14 +260,14 @@ public class AnchorHelper {
* Now, we use the location directly to avoid preserve position when the size of referenced figure changes.
*
*/
- public static class InnerPointAnchor extends SlidableAnchor {
+ public static class InnerPointAnchor extends PapyrusSlidableSnapToGridAnchor {
private PrecisionPoint percent;
private IFigure figure;
public InnerPointAnchor(IFigure fig, PrecisionPoint percent) {
- super(fig, percent);
+ super((NodeFigure) fig, percent);
this.figure = fig;
this.percent = percent;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionEditPart.java
index dc23bb66a77..5aa83f5e56f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionEditPart.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
+ * Copyright (c) 2016-2017 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,23 +8,20 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 521312
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
import java.util.List;
import org.eclipse.draw2d.ConnectionAnchor;
-import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionPoint;
-import org.eclipse.emf.common.notify.Notification;
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.Request;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.LocationRequest;
import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gef.requests.TargetRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
@@ -40,10 +37,10 @@ import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
/**
* @author PT202707
* @since 3.0
- *this class has been customized to prevent the strange feedback of lifeline during the move
-
+ * this class has been customized to prevent the strange feedback of lifeline during the move
+ *
*/
-public class CInteractionEditPart extends InteractionEditPart{
+public class CInteractionEditPart extends InteractionEditPart {
/**
* Constructor.
@@ -53,18 +50,18 @@ public class CInteractionEditPart extends InteractionEditPart{
public CInteractionEditPart(View view) {
super(view);
}
-
-
- //***********************************************************************
- //**ALL this code is used to manage LOST and CREATE MESSAGE on Interaction.
- //**************************************************************************
+
+
+ // ***********************************************************************
+ // **ALL this code is used to manage LOST and CREATE MESSAGE on Interaction.
+ // **************************************************************************
/**
* Handle found message
*/
@Override
public ConnectionAnchor getSourceConnectionAnchor(Request request) {
ConnectionAnchor sourceAnchor = createAnchor(request, UMLDIElementTypes.MESSAGE_FOUND_EDGE, MessageFoundEditPart.VISUAL_ID, MessageFoundEditPart.class);
-
+
if (sourceAnchor == null) {
sourceAnchor = super.getSourceConnectionAnchor(request);
}
@@ -76,7 +73,7 @@ public class CInteractionEditPart extends InteractionEditPart{
*/
@Override
public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connEditPart) {
-
+
// Read the anchor and load it, it read the absolute position
if (connEditPart instanceof MessageFoundEditPart) {
String terminal = AnchorHelper.getAnchorId(getEditingDomain(), connEditPart, true);
@@ -94,13 +91,8 @@ public class CInteractionEditPart extends InteractionEditPart{
*/
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
-
+
ConnectionAnchor targetAnchor = createAnchor(request, UMLDIElementTypes.MESSAGE_LOST_EDGE, MessageLostEditPart.VISUAL_ID, MessageLostEditPart.class);
-// if (targetAnchor == null) {
-// // Enabled to find Anchor for MessageCreate, this would be useful when showing feedbacks.
-// // Fixed bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=403134
-// targetAnchor = createAnchor(request, UMLDIElementTypes.MESSAGE_CREATE_EDGE, MessageCreateEditPart.VISUAL_ID, MessageCreateEditPart.class);
-// }
if (targetAnchor == null) {
targetAnchor = super.getTargetConnectionAnchor(request);
}
@@ -140,10 +132,9 @@ public class CInteractionEditPart extends InteractionEditPart{
*/
private ConnectionAnchor createAnchor(Request request, IElementType elementType, String visualId, Class<?> messageType) {
if (request instanceof CreateUnspecifiedTypeConnectionRequest) {
-
-
+
CreateUnspecifiedTypeConnectionRequest createRequest = (CreateUnspecifiedTypeConnectionRequest) request;
-
+
List<?> relationshipTypes = createRequest.getElementTypes();
for (Object obj : relationshipTypes) {
if (elementType.equals(obj)) {
@@ -177,20 +168,23 @@ public class CInteractionEditPart extends InteractionEditPart{
* @return The connection anchor
*/
private ConnectionAnchor createAnchor(Point location) {
- // return new SlidableAnchor(getFigure(), BaseSlidableAnchor.getAnchorRelativeLocation(location, getFigure().getBounds()));
return AnchorHelper.InnerPointAnchor.createAnchorAtLocation(getFigure(), new PrecisionPoint(location));
}
+
/**
+ * {@inheritDoc}
+ *
+ * <pre>
+ * Interaction is not selectable.
+ * </pre>
+ *
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#isSelectable()
- *
- * @return
*/
@Override
public boolean isSelectable() {
- // TODO Auto-generated method stub
return false;
}
-
+
/**
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#showTargetFeedback(org.eclipse.gef.Request)
*
@@ -198,14 +192,14 @@ public class CInteractionEditPart extends InteractionEditPart{
*/
@Override
public void showTargetFeedback(Request request) {
- if(request instanceof ChangeBoundsRequest){
- ChangeBoundsRequest changeBoundsRequest= (ChangeBoundsRequest)request;
+ if (request instanceof ChangeBoundsRequest) {
+ ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
- if( changeBoundsRequest.getEditParts().get(0) instanceof LifelineEditPart) {
- changeBoundsRequest.setMoveDelta(new Point(changeBoundsRequest.getMoveDelta().x,0));
+ if (changeBoundsRequest.getEditParts().get(0) instanceof LifelineEditPart) {
+ changeBoundsRequest.setMoveDelta(new Point(changeBoundsRequest.getMoveDelta().x, 0));
}
}
super.showTargetFeedback(request);
}
-
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageFoundEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageFoundEditPart.java
index 520a5ecdc7c..d84740717b8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageFoundEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageFoundEditPart.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA
+ * Copyright (c) 2010-2017 CEA
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,7 +9,7 @@
*
* Contributors:
* Soyatec - Initial API and implementation
- *
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 521312
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
@@ -37,14 +37,6 @@ public class CustomMessageFoundEditPart extends MessageFoundEditPart {
}
/**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- /**
* Block message sort modification
*/
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageLostEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageLostEditPart.java
index a139895577a..c33e4c2ba78 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageLostEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageLostEditPart.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA
+ * Copyright (c) 2010-2017 CEA
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,7 +9,7 @@
*
* Contributors:
* Soyatec - Initial API and implementation
- *
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 521312
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
@@ -37,14 +37,6 @@ public class CustomMessageLostEditPart extends MessageLostEditPart {
}
/**
- * @Override
- */
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- }
-
- /**
* Block message sort modification
*/
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceReferenceEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceReferenceEditPolicy.java
index c0f11550a04..a6ff9f18bf9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceReferenceEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceReferenceEditPolicy.java
@@ -1,4 +1,4 @@
-/***********s******************************************************************
+/*****************************************************************************
* Copyright (c) 2017 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
@@ -8,7 +8,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) - Initial API and implementation
- *
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 521312
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
@@ -138,19 +138,23 @@ public class SequenceReferenceEditPolicy extends GraphicalEditPolicy implements
// manage Strong references
// fill about source
MessageEnd sourceEvent = aMessage.getSendEvent();
- addExecutionSpecIntoReferences((OccurrenceSpecification) sourceEvent, strongReferences, ROLE_SOURCE);
+ if (null != sourceEvent) {
+ addExecutionSpecIntoReferences((OccurrenceSpecification) sourceEvent, strongReferences, ROLE_SOURCE);
+ }
// fill about target
MessageEnd targetEvent = aMessage.getReceiveEvent();
- addExecutionSpecIntoReferences((OccurrenceSpecification) targetEvent, strongReferences, ROLE_TARGET);
+ if (null != targetEvent) {
+ addExecutionSpecIntoReferences((OccurrenceSpecification) targetEvent, strongReferences, ROLE_TARGET);
+ }
// manage weakReferences
// source
- if (((OccurrenceSpecification) sourceEvent).getCovereds().size() == 1) {
+ if (null != sourceEvent && ((OccurrenceSpecification) sourceEvent).getCovereds().size() == 1) {
Lifeline currentLifeline = ((OccurrenceSpecification) sourceEvent).getCovereds().get(0);
fillWeakReference(((OccurrenceSpecification) sourceEvent), currentLifeline);
}
// target
- if (((OccurrenceSpecification) targetEvent).getCovereds().size() == 1) {
+ if (null != targetEvent && ((OccurrenceSpecification) targetEvent).getCovereds().size() == 1) {
Lifeline currentLifeline = ((OccurrenceSpecification) targetEvent).getCovereds().get(0);
fillWeakReference(((OccurrenceSpecification) targetEvent), currentLifeline);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageFound.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageFound.java
index 4f87686143f..cc24d9a2a8f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageFound.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageFound.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA
+ * Copyright (c) 2010-2017 CEA
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,7 +9,7 @@
*
* Contributors:
* Soyatec - Initial API and implementation
- *
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 521312
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.figures;
@@ -17,7 +17,6 @@ import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.PolylineDecoration;
import org.eclipse.draw2d.RotatableDecoration;
import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
/**
@@ -48,6 +47,7 @@ public class MessageFound extends MessageFigure {
*/
protected RotatableDecoration createSourceDecoration() {
EllipseDecoration df = new EllipseDecoration();
+ df.setPreferredSize(new Dimension(10, 10));
df.setAlwaysFill(true);
return df;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageLost.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageLost.java
index c4fb4849aa3..fd024c4a7d6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageLost.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/MessageLost.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA
+ * Copyright (c) 2010-2017 CEA
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,7 +9,7 @@
*
* Contributors:
* Soyatec - Initial API and implementation
- *
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 521312
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.figures;
@@ -19,7 +19,6 @@ import org.eclipse.draw2d.ConnectionLocator;
import org.eclipse.draw2d.PolylineDecoration;
import org.eclipse.draw2d.RotatableDecoration;
import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
/**
@@ -53,16 +52,16 @@ public class MessageLost extends MessageFigure {
protected RotatableDecoration createTargetDecoration() {
EllipseDecoration df = new EllipseDecoration();
df.setAlwaysFill(true);
- //df.setPreferredSize(new Dimension(10, 10));
+ df.setPreferredSize(new Dimension(10, 10));
add(df, new ArrowLocator(this, ConnectionLocator.TARGET)); // child figure
PolylineDecoration arrow = new PolylineDecoration();
arrow.setForegroundColor(getForegroundColor());
-// PointList pl = new PointList();
-// pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2));
-// pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
-// pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2));
-// arrow.setTemplate(pl);
-// arrow.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
+ // PointList pl = new PointList();
+ // pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2));
+ // pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
+ // pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2));
+ // arrow.setTemplate(pl);
+ // arrow.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
return arrow;
}
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 811bb776a52..5a3562c536d 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
@@ -28,7 +28,6 @@ import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.EditPart;
-import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
@@ -169,7 +168,9 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
if (referenceTargetPoint != null && sourceLocation != null) {
if (UMLDIElementTypes.MESSAGE_CREATE_EDGE.getSemanticHint().equals(((CreateConnectionViewAndElementRequest) requestForType).getConnectionViewAndElementDescriptor().getSemanticHint())
- || isHorizontalConnection(sourceLocation, referenceTargetPoint)) {
+ || (isHorizontalConnection(sourceLocation, referenceTargetPoint))
+ && request.getSourceEditPart() != request.getTargetEditPart()
+ && !UMLDIElementTypes.MESSAGE_LOST_EDGE.getSemanticHint().equals(((CreateConnectionViewAndElementRequest) requestForType).getConnectionViewAndElementDescriptor().getSemanticHint())) {
newTargetConnectionAnchor = getHorizontalAnchor(targetConnectionAnchor, referenceTargetPoint);
}
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/MessageEditHelper.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/MessageEditHelper.java
index 67f295cdabb..d3966f0b8a7 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/MessageEditHelper.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/MessageEditHelper.java
@@ -27,7 +27,6 @@ import org.eclipse.gmf.runtime.common.core.command.IdentityCommand;
import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
@@ -45,7 +44,6 @@ import org.eclipse.papyrus.uml.service.types.command.MessageSyncReorientCommand;
import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
import org.eclipse.papyrus.uml.service.types.utils.MessageUtils;
-import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants;
import org.eclipse.papyrus.uml.tools.utils.ExecutionSpecificationUtil;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ExecutionSpecification;
@@ -118,19 +116,26 @@ public class MessageEditHelper extends ElementEditHelper {
create &= (null == msgEndTarget.getMessage());
}
- // Create Message case
- if (ElementUtil.isTypeOf(elementType, UMLElementTypes.COMPLETE_CREATE_MESSAGE)
- || ElementUtil.isTypeOf(elementType, UMLElementTypes.FOUND_CREATE_MESSAGE)
- || ElementUtil.isTypeOf(elementType, UMLElementTypes.LOST_CREATE_MESSAGE)) {
- create &= canCreateMessageCreate(source, target, request);
- } else if (ElementUtil.isTypeOf(elementType, UMLElementTypes.COMPLETE_DELETE_MESSAGE)
- || ElementUtil.isTypeOf(elementType, UMLElementTypes.FOUND_DELETE_MESSAGE)
- || ElementUtil.isTypeOf(elementType, UMLElementTypes.LOST_DELETE_MESSAGE)) {
- create &= canCreateMessageDelete(source, target, request);
+ // Message Create case
+ if (ElementUtil.isTypeOf(elementType, UMLElementTypes.COMPLETE_CREATE_MESSAGE)) {
+ create &= canCreateMessageCreate(source, target);
+ } else
+ // Message Delete case
+ if (ElementUtil.isTypeOf(elementType, UMLElementTypes.COMPLETE_DELETE_MESSAGE)) {
+ create &= canCreateMessageDelete(source, target);
+ } else
+ // Message Lost case
+ if (ElementUtil.isTypeOf(elementType, UMLElementTypes.LOST_ASYNCH_CALL)) {
+ create &= canCreateMessageLost(source, target);
+ } else
+ // Message Lost case
+ if (ElementUtil.isTypeOf(elementType, UMLElementTypes.FOUND_ASYNCH_CALL)) {
+ create &= canCreateMessageFound(source, target);
}
}
return create;
+
}
/**
@@ -144,7 +149,7 @@ public class MessageEditHelper extends ElementEditHelper {
* the request
* @return return true if message can be created
*/
- private boolean canCreateMessageCreate(final EObject source, final EObject target, final AbstractEditCommandRequest request) {
+ private boolean canCreateMessageCreate(final EObject source, final EObject target) {
boolean create = true;
// source and target can't be the same
@@ -176,7 +181,7 @@ public class MessageEditHelper extends ElementEditHelper {
* the request
* @return return true if message can be created
*/
- private boolean canCreateMessageDelete(final EObject source, final EObject target, final AbstractEditCommandRequest request) {
+ private boolean canCreateMessageDelete(final EObject source, final EObject target) {
boolean create = true;
// check if target is not already created with another create message
@@ -193,6 +198,36 @@ public class MessageEditHelper extends ElementEditHelper {
return create;
}
+ /**
+ * Test if a Message Lost can be created.
+ *
+ * @param source
+ * the source of the message
+ * @param target
+ * the target of the message
+ * @param request
+ * the request
+ * @return return true if message can be created
+ */
+ private boolean canCreateMessageLost(final EObject source, final EObject target) {
+ return (target instanceof Interaction || target == null) && source instanceof Lifeline;
+ }
+
+ /**
+ * Test if a Message Found can be created.
+ *
+ * @param source
+ * the source of the message
+ * @param target
+ * the target of the message
+ * @param request
+ * the request
+ * @return return true if message can be created
+ */
+ private boolean canCreateMessageFound(final EObject source, final EObject target) {
+ return source instanceof Interaction && (target instanceof Lifeline || target == null);
+ }
+
protected boolean isReadOnly(EObject eObject) {
EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(eObject);
@@ -307,7 +342,7 @@ public class MessageEditHelper extends ElementEditHelper {
}
}
// test if we can create it
- if (canCreateMessageCreate(source, target, req)) {
+ if (canCreateMessageCreate(source, target)) {
reorientCommand = new MessageCreateReorientCommand(req);
} else {
reorientCommand = UnexecutableCommand.INSTANCE;
@@ -335,7 +370,7 @@ public class MessageEditHelper extends ElementEditHelper {
}
}
// test if we can create it
- if (canCreateMessageDelete(source, target, req)) {
+ if (canCreateMessageDelete(source, target)) {
reorientCommand = new MessageDeleteReorientCommand(req);
} else {
reorientCommand = UnexecutableCommand.INSTANCE;

Back to the top