Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcletavernie2012-02-29 08:38:00 +0000
committercletavernie2012-02-29 08:38:00 +0000
commit0e4671797806827fe50c865134715bb79e28b10a (patch)
treebda771cb471c151afe0af8d4f25360396328a40b /plugins
parentf477927b36ef509cc66c558566c0a31a54a35acb (diff)
downloadorg.eclipse.papyrus-0e4671797806827fe50c865134715bb79e28b10a.tar.gz
org.eclipse.papyrus-0e4671797806827fe50c865134715bb79e28b10a.tar.xz
org.eclipse.papyrus-0e4671797806827fe50c865134715bb79e28b10a.zip
364827: [Sequence Diagram] - Synchronous messages creation
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364827
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java41
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java2
3 files changed, 44 insertions, 15 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java
index 6c891269764..2a65a13a786 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/CreateElementAndNodeCommand.java
@@ -17,14 +17,19 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
@@ -37,7 +42,7 @@ import org.eclipse.gmf.runtime.notation.View;
* @author Mathieu Velten
*
*/
-public class CreateElementAndNodeCommand extends Command {
+public class CreateElementAndNodeCommand extends AbstractTransactionalCommand {
protected ShapeNodeEditPart nodeEditPart;
@@ -56,6 +61,8 @@ public class CreateElementAndNodeCommand extends Command {
protected IHintedType elementType;
protected CreateViewRequest createViewRequest;
+
+ private List affectedFiles;
/**
*
@@ -71,12 +78,24 @@ public class CreateElementAndNodeCommand extends Command {
* the location where to create the element figure.
*/
public CreateElementAndNodeCommand(TransactionalEditingDomain editingDomain, ShapeNodeEditPart nodeEditPart, EObject parent, IHintedType elementType, Point location) {
+ super(editingDomain, "Create element and node command", null);
this.nodeEditPart = nodeEditPart;
this.location = location;
this.parent = parent;
this.editingDomain = editingDomain;
this.elementType = elementType;
}
+
+ public List getAffectedFiles() {
+ if (affectedFiles == null) {
+ if (getCreatedView() != null) {
+ affectedFiles = getWorkspaceFiles(getCreatedView());
+ } else {
+ affectedFiles = super.getAffectedFiles();
+ }
+ }
+ return affectedFiles;
+ }
/**
* put a parameter which will be add to the parameters of the element creation request.
@@ -103,15 +122,6 @@ public class CreateElementAndNodeCommand extends Command {
return null;
}
- public void execute() {
- super.execute();
- element = createModelElement();
- // create the view for the execution specification
- if(element != null) {
- createElementView();
- }
- }
-
public void undo() {
if(nodeCreationCommand != null && nodeCreationCommand.canUndo()) {
nodeCreationCommand.undo();
@@ -161,4 +171,15 @@ public class CreateElementAndNodeCommand extends Command {
}
}
}
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
+ IAdaptable info) throws ExecutionException {
+ element = createModelElement();
+ // create the view for the execution specification
+ if(element != null) {
+ createElementView();
+ }
+ return CommandResult.newOKCommandResult();
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java
index 8ab9c8eeb4a..52474d3a6d1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/PromptCreateElementAndNodeCommand.java
@@ -9,8 +9,10 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.requests.CreateConnectionRequest;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.diagram.ui.commands.CreateOrSelectElementCommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
@@ -42,18 +44,21 @@ public class PromptCreateElementAndNodeCommand extends
private EObject target;
private Point location;
private InteractionFragment container;
-
+ private CreateConnectionRequest request;
+ private EditPart sourceEP;
public PromptCreateElementAndNodeCommand(Command createCommand,
TransactionalEditingDomain editingDomain,
ConnectionViewDescriptor descriptor, ShapeNodeEditPart targetEP,
- EObject target, Point location, InteractionFragment container) {
+ EObject target, EditPart sourceEP, CreateConnectionRequest request, InteractionFragment container) {
super(Display.getCurrent().getActiveShell(), executionTypes);
this.editingDomain = editingDomain;
this.descriptor = descriptor;
this.targetEP = targetEP;
this.target = target;
- this.location = location;
+ this.sourceEP = sourceEP;
+ this.request = request;
+ this.location = request.getLocation();
this.container = container;
command = new CompoundCommand();
command.add(createCommand);
@@ -62,6 +67,9 @@ public class PromptCreateElementAndNodeCommand extends
protected CommandResult doExecuteWithResult(
IProgressMonitor progressMonitor, IAdaptable info)
throws ExecutionException {
+ sourceEP.eraseSourceFeedback(request);
+ targetEP.eraseSourceFeedback(request);
+
CommandResult cmdResult = super.doExecuteWithResult(progressMonitor,
info);
if (!cmdResult.getStatus().isOK()) {
@@ -75,7 +83,7 @@ public class PromptCreateElementAndNodeCommand extends
createExecutionSpecificationCommand.putCreateElementRequestParameter(
SequenceRequestConstant.INTERACTIONFRAGMENT_CONTAINER,
container);
- command.add(createExecutionSpecificationCommand);
+ command.add(new ICommandProxy(createExecutionSpecificationCommand));
// put the anchor at the top of the figure
ChangeEdgeTargetCommand changeTargetCommand = new ChangeEdgeTargetCommand(
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java
index ad21298ec28..fae1cbee5dd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ElementCreationWithMessageEditPolicy.java
@@ -74,7 +74,7 @@ public class ElementCreationWithMessageEditPolicy extends LifelineChildGraphical
}
EditPart sourceEditPart = request.getSourceEditPart();
if (sourceEditPart instanceof ActionExecutionSpecificationEditPart || sourceEditPart instanceof BehaviorExecutionSpecificationEditPart) {
- return new ICommandProxy(new PromptCreateElementAndNodeCommand(command, getEditingDomain(),viewRequest.getConnectionViewDescriptor(),(ShapeNodeEditPart) targetEP, target, request.getLocation(), ift));
+ return new ICommandProxy(new PromptCreateElementAndNodeCommand(command, getEditingDomain(),viewRequest.getConnectionViewDescriptor(),(ShapeNodeEditPart) targetEP, target,sourceEP,request, ift));
}
// IHintedType elementType = null;
// if(sourceEditPart instanceof ActionExecutionSpecificationEditPart) {

Back to the top