diff options
author | Mathilde Arnaud | 2018-01-11 15:18:23 +0000 |
---|---|---|
committer | Mathilde Arnaud | 2018-01-11 15:23:41 +0000 |
commit | e21394efd4533fbff89fe60f21d60bc7ebc760bb (patch) | |
tree | a5ac694009d3ccd134ab2449c555d037e4932af6 /plugins/uml/diagram | |
parent | efda270c26a2dcf2eb716d12c43ba8c52bfc2aa0 (diff) | |
download | org.eclipse.papyrus-e21394efd4533fbff89fe60f21d60bc7ebc760bb.tar.gz org.eclipse.papyrus-e21394efd4533fbff89fe60f21d60bc7ebc760bb.tar.xz org.eclipse.papyrus-e21394efd4533fbff89fe60f21d60bc7ebc760bb.zip |
Revert "Bug 527333 - [Sequence Diagram] Some error exist in event
replacement for execution specification"
This reverts commit 245bedd3866307e46b4a0d8a61f9b7dc006b2fea.
Signed-off-by: Mathilde Arnaud <mathilde.arnaud@cea.fr>
Diffstat (limited to 'plugins/uml/diagram')
2 files changed, 2 insertions, 161 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/ReplaceExecSpecEventAtReconnectCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/ReplaceExecSpecEventAtReconnectCommand.java deleted file mode 100644 index c730ebf09aa..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/ReplaceExecSpecEventAtReconnectCommand.java +++ /dev/null @@ -1,105 +0,0 @@ -/***************************************************************************** - * 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 - Initial API and implementation - *****************************************************************************/ -package org.eclipse.papyrus.uml.diagram.sequence.command; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.edit.command.DeleteCommand; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gef.requests.ReconnectRequest; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification; -import org.eclipse.uml2.uml.Message; -import org.eclipse.uml2.uml.MessageEnd; -import org.eclipse.uml2.uml.OccurrenceSpecification; -import org.eclipse.uml2.uml.UMLPackage; - -/** - * The command to replace execution specification start/finish event when a message is drag to it. - * - * @since 5.0.0 - */ -public class ReplaceExecSpecEventAtReconnectCommand extends AbstractTransactionalCommand { - /** - * The reconnect message. - */ - private final ReconnectRequest request; - - /** - * The {@link OccurrenceSpecification} to be replaced. - */ - private final OccurrenceSpecification os; - - /** - * Set to true if it is a reconnect source, false for reconnect target. - */ - private boolean source; - - /** - * Constructor. - * - * @param domain - * The {@link TransactionalEditingDomain}. - * @param request - * The {@link ReconnectRequest}. - * @param os - * the {@link OccurrenceSpecification}. - * @param source - * True if it is a reconnect source, false for reconnect target. - */ - public ReplaceExecSpecEventAtReconnectCommand(final TransactionalEditingDomain domain, final ReconnectRequest request, final OccurrenceSpecification os, final boolean source) { - super(domain, "replace execution specification event command", null); - this.request = request; - this.os = os; - this.source = source; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) - */ - @Override - protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { - // get the message - EObject message = ((View) request.getConnectionEditPart().getModel()).getElement(); - if (message instanceof Message) { - // get the correct event to set - MessageEnd eventToSet = source ? ((Message) message).getSendEvent() : ((Message) message).getReceiveEvent(); - - // get the feature to set of the exec spec - EReference executionSpecificationFeatureToSet = null; - if (((ExecutionOccurrenceSpecification) os).getExecution().getStart().equals(os)) { - executionSpecificationFeatureToSet = UMLPackage.eINSTANCE.getExecutionSpecification_Start(); - } else { - executionSpecificationFeatureToSet = UMLPackage.eINSTANCE.getExecutionSpecification_Finish(); - } - - // replace the os event by the message event - SetCommand setCommand = new SetCommand(getEditingDomain(), ((ExecutionOccurrenceSpecification) os).getExecution(), executionSpecificationFeatureToSet, eventToSet); - setCommand.execute(); - - // delete the old os event - org.eclipse.emf.common.command.Command deleteCommand = DeleteCommand.create(getEditingDomain(), os); - if (deleteCommand != null && deleteCommand.canExecute()) { - getEditingDomain().getCommandStack().execute(deleteCommand); - } - } - return CommandResult.newOKCommandResult(); - } -}
\ No newline at end of file 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 9f264098972..2919ae9914d 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,7 +8,7 @@ * * Contributors: * CEA LIST - Initial API and implementation - * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 519621, 519756, 526191, 527333 + * Mickaël ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 519621, 519756, 526191 *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling; @@ -56,7 +56,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.ReplaceExecSpecEventAtReconnectCommand; 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; @@ -652,10 +651,6 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol @Override protected Command getReconnectSourceCommand(final ReconnectRequest request) { request.setLocation(SequenceUtil.getSnappedLocation(getHost(), request.getLocation())); - - // Display event - displayEvent.addFigureEvent(getHostFigure(), request.getLocation()); - // Check if the target is lower than the source Point targetLocation = SequenceUtil.getAbsoluteEdgeExtremity((ConnectionNodeEditPart) request.getConnectionEditPart(), false, true); if (!isTargetLowerThanSource(request.getLocation().getCopy(), targetLocation)) { @@ -677,28 +672,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol } } - // Get the reconnect command - Command command = null; - // Check if we are in a start/finish of an exec spec - OccurrenceSpecification os = displayEvent.getActionExecutionSpecificationEvent(getHostFigure(), ((ReconnectRequest) request).getLocation()); - - if (os instanceof ExecutionOccurrenceSpecification) { - CompoundCommand compoundCommand = new CompoundCommand(); - if (request.getLocation() != displayEvent.getRealEventLocation(request.getLocation())) { - request.setLocation(displayEvent.getRealEventLocation(request.getLocation())); - } - compoundCommand.add(getBasicGraphicalNodeEditPolicy().getCommand(request)); - ReplaceExecSpecEventAtReconnectCommand replaceExecSpecEventAtReconnectCommand = new ReplaceExecSpecEventAtReconnectCommand(getEditingDomain(), request, os, true); - compoundCommand.add(new GMFtoGEFCommandWrapper(replaceExecSpecEventAtReconnectCommand)); - command = compoundCommand; - - - } else if (os instanceof MessageEnd) { - // Event of Exec Spec have been already replaced. Only one message can be related to start or finish. - return UnexecutableCommand.INSTANCE; - } - - return null != command ? command : getBasicGraphicalNodeEditPolicy().getCommand(request); + return getBasicGraphicalNodeEditPolicy().getCommand(request); } /** @@ -709,13 +683,9 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol @Override protected Command getReconnectTargetCommand(final ReconnectRequest request) { Command command = null; - // Snap to grid the request location request.setLocation(SequenceUtil.getSnappedLocation(getHost(), request.getLocation())); - // Display event - displayEvent.addFigureEvent(getHostFigure(), request.getLocation()); - // Check if the target is lower than the source Point sourceLocation = SequenceUtil.getAbsoluteEdgeExtremity((ConnectionNodeEditPart) request.getConnectionEditPart(), true); if (!isTargetLowerThanSource(sourceLocation, request.getLocation().getCopy())) { @@ -737,16 +707,6 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol } } - // Check if we are in a start/finish of an exec spec - OccurrenceSpecification os = displayEvent.getActionExecutionSpecificationEvent(getHostFigure(), ((ReconnectRequest) request).getLocation()); - if (os instanceof ExecutionOccurrenceSpecification) { - // If we reconnect to a exec spec event, we maj position to it - if (request.getLocation() != displayEvent.getRealEventLocation(request.getLocation())) { - request.setLocation(displayEvent.getRealEventLocation(request.getLocation())); - } - } - - // Get the original reconnect command Command reconnectTargetCommand = getBasicGraphicalNodeEditPolicy().getCommand(request); // in case of reconnect target for message create it is need to move up the old target and move down the new target @@ -799,20 +759,6 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol } else { command = reconnectTargetCommand; } - - - // get the command to replace event - if (os instanceof ExecutionOccurrenceSpecification) { - CompoundCommand compoundCommand = new CompoundCommand(); - compoundCommand.add(command); - ReplaceExecSpecEventAtReconnectCommand replaceExecSpecEventAtReconnectCommand = new ReplaceExecSpecEventAtReconnectCommand(getEditingDomain(), request, os, false); - compoundCommand.add(new GMFtoGEFCommandWrapper(replaceExecSpecEventAtReconnectCommand)); - command = compoundCommand; - } else if (os instanceof MessageEnd) { - // Event of Exec Spec have been already replaced. Only one message can be related to start or finish. - return UnexecutableCommand.INSTANCE; - } - return command; } |