aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2017-10-11 08:12:56 -0400
committerPatrick Tessier2017-10-17 04:58:51 -0400
commit2f14e1028d8448bd654024a256256b154a53d6e5 (patch)
treea2cb342ab2336eca2e2d06faf559fce2c84d3a48
parent0cc06c2b578a43a59318327c2840812a2c863ac6 (diff)
downloadorg.eclipse.papyrus-2f14e1028d8448bd654024a256256b154a53d6e5.zip
org.eclipse.papyrus-2f14e1028d8448bd654024a256256b154a53d6e5.tar.gz
org.eclipse.papyrus-2f14e1028d8448bd654024a256256b154a53d6e5.tar.xz
Bug 525927 - [Sequence Diagram] Execution specification have some issue.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=525927 Many little fix Change-Id: Ia212ba22766538460da7e8562fd4fd571a99430e Signed-off-by: Mickael ADAM <mickael.adam@all4tec.net>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java29
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDSequenceGraphicalNodeEditPolicy.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/SequenceReferenceEditPolicy.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/LifelineFigure.java69
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java27
7 files changed, 38 insertions, 125 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java
index 79b8fd4..9d7c946 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateExecutionSpecificationWithMessage.java
@@ -47,6 +47,8 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.papyrus.commands.DestroyElementPapyrusCommand;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomActionExecutionSpecificationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.messages.Messages;
@@ -153,11 +155,16 @@ public class CreateExecutionSpecificationWithMessage extends AbstractTransaction
Command replycommand = lifelineEditPart.getCommand(requestreplycreation);
// setup the request in preparation to get the connection end command
requestreplycreation.setSourceEditPart(lifelineEditPart);
- LifelineEditPart target = (LifelineEditPart) request.getSourceEditPart();
+ NodeEditPart target = (NodeEditPart) request.getSourceEditPart();
+
+ while (target instanceof AbstractExecutionSpecificationEditPart) {
+ target = (NodeEditPart) target.getParent();
+ }
+
requestreplycreation.setTargetEditPart(target);
requestreplycreation.setType(RequestConstants.REQ_CONNECTION_END);
- IFigure f = ((LifelineEditPart) target).getPrimaryShape();
+ IFigure f = target.getPrimaryShape();
Rectangle b = f.getBounds().getCopy();
f.translateToAbsolute(b);
Point c = b.getCenter().getCopy();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
index 1401ff6..1378d53 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
@@ -9,7 +9,6 @@ import org.eclipse.draw2d.Locator;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.Request;
@@ -26,7 +25,6 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnecti
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.Anchor;
-import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.FillStyle;
import org.eclipse.gmf.runtime.notation.IdentityAnchor;
@@ -46,7 +44,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectExecu
import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectYCoordinateToGrillingEditPolicy;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentEditPolicy;
import org.eclipse.swt.graphics.Color;
-import org.eclipse.uml2.uml.ExecutionSpecification;
/**
* Add implementing IPapyrusEditPart to displaying Stereotypes.
@@ -65,32 +62,6 @@ public abstract class AbstractExecutionSpecificationEditPart extends RoundedComp
super(view);
}
- @Override
- public List getChildren() {
- // if (executionSpecificationEndParts == null) {
- // initExecutionSpecificationEndEditPart();
- // }
- return super.getChildren();
- }
-
- protected void initExecutionSpecificationEndEditPart() {
- EObject element = this.resolveSemanticElement();
- if (!(element instanceof ExecutionSpecification)) {
- return;
- }
- // executionSpecificationEndParts = new ArrayList<ExecutionSpecificationEndEditPart>();
- ExecutionSpecification execution = (ExecutionSpecification) element;
- // final ExecutionSpecificationEndEditPart startPart = new ExecutionSpecificationEndEditPart(execution.getStart(), this, new RelativeLocator(getFigure(), PositionConstants.NORTH));
- // executionSpecificationEndParts.add(startPart);
- // final ExecutionSpecificationEndEditPart finishPart = new ExecutionSpecificationEndEditPart(execution.getFinish(), this, new RelativeLocator(getFigure(), PositionConstants.SOUTH));
- // executionSpecificationEndParts.add(finishPart);
- Diagram diagram = ((View) this.getModel()).getDiagram();
- // startPart.rebuildLinks(diagram);
- // finishPart.rebuildLinks(diagram);
- // addChild(startPart, -1);
- // addChild(finishPart, -1);
- }
-
static class FillParentLocator implements Locator {
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDSequenceGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDSequenceGraphicalNodeEditPolicy.java
index c6ccb17..b0a2b36 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDSequenceGraphicalNodeEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDSequenceGraphicalNodeEditPolicy.java
@@ -49,13 +49,11 @@ import org.eclipse.gmf.runtime.diagram.ui.internal.commands.SetConnectionBendpoi
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest.ConnectionViewAndElementDescriptor;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionFragmentEditPart;
@@ -413,9 +411,9 @@ public class OLDSequenceGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy
*/
@Override
protected Command getReconnectSourceCommand(ReconnectRequest request) {
- if (isUphillMessage(request) && !isLostFoundMessage(request)) {
- return UnexecutableCommand.INSTANCE;
- }
+ // if (isUphillMessage(request) && !isLostFoundMessage(request)) {
+ // return UnexecutableCommand.INSTANCE;
+ // }
// prevent duplicate link
if (request.getConnectionEditPart() instanceof MessageCreateEditPart && request.getTarget() != null && !LifelineMessageCreateHelper.canReconnectMessageCreate(request)) {
return UnexecutableCommand.INSTANCE;
@@ -648,12 +646,12 @@ public class OLDSequenceGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy
}
protected boolean isCreateConnectionRequest(Request request, IElementType type) {
-// if (request instanceof CreateAspectUnspecifiedTypeConnectionRequest) {
-// List types = ((CreateUnspecifiedTypeConnectionRequest) request).getElementTypes();
-// if (types.contains(type)) {
-// return true;
-// }
-// }
+ // if (request instanceof CreateAspectUnspecifiedTypeConnectionRequest) {
+ // List types = ((CreateUnspecifiedTypeConnectionRequest) request).getElementTypes();
+ // if (types.contains(type)) {
+ // return true;
+ // }
+ // }
if (request instanceof CreateConnectionViewRequest) {
String requestHint = ((CreateConnectionViewRequest) request).getConnectionViewDescriptor().getSemanticHint();
if (((IHintedType) type).getSemanticHint().equals(requestHint)) {
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 a6ff9f1..e811072 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
@@ -86,10 +86,11 @@ public class SequenceReferenceEditPolicy extends GraphicalEditPolicy implements
@Override
public void activate() {
super.activate();
- updateStrongAndWeakReferences();
// add a listener to update weak and string references
redirectionOperationListener = new RedirectionOperationListener(this);
OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(redirectionOperationListener);
+
+ updateStrongAndWeakReferences();
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java
index 380e901..ccf66a3 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java
@@ -31,6 +31,7 @@ import org.eclipse.gef.requests.ReconnectRequest;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
/**
* this editpolicy is to manage the movement of Execution specification and update move of messages
@@ -81,9 +82,10 @@ public class UpdateConnectionReferenceEditPolicy extends GraphicalEditPolicy {
ConnectionEditPart connectionEditPart = (ConnectionEditPart) editPart;
ArrayList<EditPart> senderList = SenderRequestUtils.getSenders(request);
// create the request
-
ReconnectRequest reconnectSourceRequest = createReconnectRequest(connectionEditPart, locationAndSize, senderList, RequestConstants.REQ_RECONNECT_SOURCE, references);
+ reconnectSourceRequest.getExtendedData().put(SequenceUtil.DO_NOT_CHECK_HORIZONTALITY, true);
ReconnectRequest reconnectTargetRequest = createReconnectRequest(connectionEditPart, locationAndSize, senderList, RequestConstants.REQ_RECONNECT_TARGET, references);
+ reconnectTargetRequest.getExtendedData().put(SequenceUtil.DO_NOT_CHECK_HORIZONTALITY, true);
compoundCommand.add(connectionEditPart.getTarget().getCommand(reconnectTargetRequest));
compoundCommand.add(connectionEditPart.getSource().getCommand(reconnectSourceRequest));
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/LifelineFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/LifelineFigure.java
index 41e25dd..4a9ce51 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/LifelineFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/LifelineFigure.java
@@ -108,19 +108,20 @@ public class LifelineFigure extends RoundedCompartmentFigure {
* {@inheritDoc}
*/
public void paint(Graphics graphics) {
- super.paint(graphics);
Rectangle rect = this.getBounds();
graphics.pushState();
graphics.setForegroundColor(getForegroundColor());
// do not forget to set line width to 1, if not the color will
// change because of the anti-aliasing
graphics.setLineWidth(1);
-
- // graphics.setLineStyle(Graphics.LINE_DASH);
graphics.drawRectangle(rect.x, rect.y, rect.width - 1, ((LifeLineLayoutManager) this.getLifeLineLayoutManager()).getBottomHeader() - rect.y);
+ // Draw dash line first to be under child
graphics.setLineDash(new int[] { 5, 5 });
graphics.drawLine(new Point(rect.x + rect.width / 2, ((LifeLineLayoutManager) this.getLifeLineLayoutManager()).getBottomHeader()), new Point(rect.x + rect.width / 2, rect.y + rect.height - 1));
graphics.popState();
+
+ // Then finish to draw figure.
+ super.paint(graphics);
}
/**
@@ -136,35 +137,6 @@ public class LifelineFigure extends RoundedCompartmentFigure {
public LayoutManager getLifeLineLayoutManager() {
return super.getLayoutManager();
}
- // public int getNameContainerPreferredHeight(int wHint) {
- // return fFigureLifelineNameContainerFigure.getPreferredSize(wHint, -1).height;
- // }
-
- // /**
- // * Get the rectangle which contains all labels
- // *
- // * @see org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure#getDefaultLabelsContainer()
- // * @return lifeline labels rectangle
- // */
- // @Override
- // protected IFigure getDefaultLabelsContainer() {
- // return getFigureLifelineNameContainerFigure();
- // }
-
- /**
- * Create the composite structure.
- *
- * @see org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusNodeFigure#createCompositeFigureStructure()
- */
- @Override
- protected void createCompositeFigureStructure() {
- super.createCompositeFigureStructure();
- // BorderLayout layoutThis = new BorderLayout();
- // this.setLayoutManager(layoutThis);
- // this.setOpaque(false);
- // this.setPreferredSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(200)));
- // createContents();
- }
/**
* Paint the label rectangle as background instead of the whole figure
@@ -207,29 +179,6 @@ public class LifelineFigure extends RoundedCompartmentFigure {
}
/**
- * Get layout to display content of properties compartment.
- *
- * @return the layout
- */
- @Override
- protected LayoutManager getPropertiesCompartmentLayout() {
- // ToolbarLayout layout = new ToolbarLayout(false);
- // layout.setStretchMinorAxis(true);
- // return layout;
- return super.getPropertiesCompartmentLayout();
- }
-
- // /**
- // * Create the name label with width wrap
- // *
- // * @see org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure#createNameLabel()
- // */
- // @Override
- // protected void createNameLabel() {
- // super.createNameLabel();
- // }
-
- /**
* remove label creation, change layout
*/
private void createContents() {
@@ -262,14 +211,4 @@ public class LifelineFigure extends RoundedCompartmentFigure {
public LifelineDotLineCustomFigure getFigureLifelineDotLineFigure() {
return fFigureLifelineDotLineFigure;
}
-
- @Override
- public void setLineWidth(int w) {
- if (w < 0) {
- return;
- }
- super.setLineWidth(w);
- }
-
-
}
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 47f51e6..864b867 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
@@ -8,8 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 519621
- * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 519756
+ * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 519621, 519756
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
@@ -58,7 +57,6 @@ import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants;
import org.eclipse.papyrus.uml.diagram.sequence.command.CreateExecutionSpecificationWithMessage;
import org.eclipse.papyrus.uml.diagram.sequence.command.DropDestructionOccurenceSpecification;
-import org.eclipse.papyrus.uml.diagram.sequence.command.SetMoveAllLineAtSamePositionCommand;
import org.eclipse.papyrus.uml.diagram.sequence.draw2d.routers.MessageRouter;
import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
@@ -75,6 +73,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
import org.eclipse.uml2.uml.MessageEnd;
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
import org.eclipse.uml2.uml.OccurrenceSpecification;
@@ -116,7 +115,6 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
MessageOccurrenceSpecification mos = displayEvent.getMessageEvent(getHostFigure(), ((CreateRequest) request).getLocation());
if (mos != null) {
Point location = request.getLocation();
-
if (location != displayEvent.getRealEventLocation(location)) {
request.setLocation(displayEvent.getRealEventLocation(location));
}
@@ -124,7 +122,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
OccurrenceSpecification os = displayEvent.getActionExecutionSpecificationEvent(getHostFigure(), ((CreateRequest) request).getLocation());
// add a param if we must replace an event of the execution specification
- if (os != null) {
+ if (os instanceof ExecutionOccurrenceSpecification) {
Map<String, Object> extendedData = request.getExtendedData();
extendedData.put(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.MESSAGE_SENTEVENT_REPLACE_EXECUTIONEVENT, os);
request.setExtendedData(extendedData);
@@ -484,20 +482,17 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
* @return Compound cmd with the Delete Occurrence Specification command
*/
protected Command getSyncAsyncEdgeCommand(CreateConnectionViewAndElementRequest request, Command cmd) {
-
// in the case of messages of sort: synchCall, asynchCall or asynchSignal
// an execution specification may be created at target
- DiagramEditPart diagramEditPart = getDiagramEditPart(getHost());
- GridManagementEditPolicy grid = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRID_MANAGEMENT);
- CreateExecutionSpecificationWithMessage createExecutionSpecificationwithMsg = new CreateExecutionSpecificationWithMessage(getDiagramEditPart(getHost()).getEditingDomain(), request, (NodeEditPart) request.getTargetEditPart());
+ OccurrenceSpecification messageEvent = displayEvent.getActionExecutionSpecificationEvent(getHostFigure(), ((CreateConnectionViewAndElementRequest) request).getLocation());
+
CompoundCommand compoundCommand = new CompoundCommand();
- SetMoveAllLineAtSamePositionCommand setMoveAllLineAtSamePositionCommand = new SetMoveAllLineAtSamePositionCommand(grid, false);
- compoundCommand.add(setMoveAllLineAtSamePositionCommand);
compoundCommand.add(cmd);
- compoundCommand.add(new GMFtoGEFCommandWrapper(createExecutionSpecificationwithMsg));
- setMoveAllLineAtSamePositionCommand = new SetMoveAllLineAtSamePositionCommand(grid, true);
- compoundCommand.add(setMoveAllLineAtSamePositionCommand);
-
+ // If we are not into an existing event we create Execution specification in the same time
+ if (null == messageEvent) {
+ CreateExecutionSpecificationWithMessage createExecutionSpecificationwithMsg = new CreateExecutionSpecificationWithMessage(getDiagramEditPart(getHost()).getEditingDomain(), request, (NodeEditPart) request.getTargetEditPart());
+ compoundCommand.add(new GMFtoGEFCommandWrapper(createExecutionSpecificationwithMsg));
+ }
return compoundCommand;
}
@@ -611,7 +606,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol
Map<String, Object> extendedData = request.getExtendedData();
Object sourceLocation = extendedData.get(RequestParameterConstants.EDGE_SOURCE_POINT);
if (sourceLocation instanceof Point) {
- allowed &= isTargetLowerThanSource((Point) sourceLocation, targetLocation);
+ allowed &= isTargetLowerThanSource(SequenceUtil.getSnappedLocation(getHost(), (Point) sourceLocation), targetLocation);
}
}
return allowed;