Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-09-14 07:29:36 -0400
committervlorenzo2012-09-14 07:29:36 -0400
commitf0aa51bea0a2f9fb89c58dd184125c2790abebde (patch)
tree8fb91c022981690df75e10d541e9e0ea2707fb6f /plugins/infra
parent88ae8ba922d486a5d50bb4f738d4b9be2cb1e1a9 (diff)
downloadorg.eclipse.papyrus-f0aa51bea0a2f9fb89c58dd184125c2790abebde.tar.gz
org.eclipse.papyrus-f0aa51bea0a2f9fb89c58dd184125c2790abebde.tar.xz
org.eclipse.papyrus-f0aa51bea0a2f9fb89c58dd184125c2790abebde.zip
387960: [All Diagrams] Recent modifications in AbstractPapyrusGmfCreateDiagramCommandHandler.getCreateDiagramCommand makes diagram creation not redoable.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=387960
Diffstat (limited to 'plugins/infra')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
index fb3cc1042d8..7c01b0a86b2 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/AbstractPapyrusGmfCreateDiagramCommandHandler.java
@@ -25,7 +25,6 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.transaction.RecordingCommand;
@@ -297,6 +296,8 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
return new AbstractTransactionalCommand(diResourceSet.getTransactionalEditingDomain(), Messages.AbstractPapyrusGmfCreateDiagramCommandHandler_CreateDiagramCommandLabel, modifiedFiles) {
+ protected Diagram diagram = null;
+
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
@@ -315,7 +316,7 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
attachModelToResource(model, modelResource);
}
- Diagram diagram = createDiagram(notationResource, model, name);
+ diagram = createDiagram(notationResource, model, name);
if(diagram != null) {
IPageMngr pageMngr = EditorUtils.getIPageMngr(diResource);
@@ -330,12 +331,12 @@ public abstract class AbstractPapyrusGmfCreateDiagramCommandHandler extends Abst
// the undo corresponds to a destroy diagram command
// during diagram creation no adapters are set to the diagram so the setElement is not registered
// to remove the cross reference using the element reference it is better to use the destroy element command
- Object result = getCommandResult().getReturnValue();
- if(result instanceof Diagram) {
- Diagram d = (Diagram)result;
- new DestroyElementPapyrusCommand(new DestroyElementRequest(d, false)).execute(null, null);
+ DestroyElementPapyrusCommand depc = (diagram != null) ? new DestroyElementPapyrusCommand(new DestroyElementRequest(diagram, false)) : null;
+ IStatus status = super.doUndo(monitor, info);
+ if (depc != null) {
+ depc.execute(null, null);
}
- return Status.OK_STATUS;
+ return status;
}
};
}

Back to the top