Bug 582197: [Sirius][AllDiagrams] Fix undo exception

Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=582197
Change-Id: I47533d43123b428192a476cf0d7a00b0fb5ce6e4
Signed-off-by: Gwendal Daniel <gwendal.daniel@obeosoft.com>
diff --git a/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/AbstractDiagramServices.java b/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/AbstractDiagramServices.java
index b67c81d..0d862af 100755
--- a/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/AbstractDiagramServices.java
+++ b/plugins/uml/org.eclipse.papyrus.sirius.uml.diagram.common/src/org/eclipse/papyrus/sirius/uml/diagram/common/core/services/AbstractDiagramServices.java
@@ -27,7 +27,6 @@
 import org.eclipse.emf.ecore.EObject;
 import org.eclipse.emf.ecore.EStructuralFeature;
 import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-import org.eclipse.emf.transaction.RecordingCommand;
 import org.eclipse.emf.transaction.TransactionalEditingDomain;
 import org.eclipse.papyrus.sirius.uml.diagram.common.Activator;
 import org.eclipse.papyrus.sirius.uml.diagram.common.services.DomainBasedEdgeServices;
@@ -486,37 +485,31 @@
 	 *            the create view operation to execute
 	 */
 	protected void executeCreateViewOperation(final EObject semanticElement, final Session session, DSemanticDecorator containerView, final CreateView createViewOp) {
-		session.getTransactionalEditingDomain().getCommandStack().execute(new RecordingCommand(session.getTransactionalEditingDomain()) {
-
-			@Override
-			protected void doExecute() {
-				try {
-					// Get the command context
-					DRepresentation representation = null;
-					if (containerView instanceof DRepresentation) {
-						representation = (DRepresentation) containerView;
-					} else if (containerView instanceof DDiagramElement) {
-						representation = ((DDiagramElement) containerView).getParentDiagram();
-					}
-
-					final CommandContext context = new CommandContext(semanticElement, representation);
-
-					// Execute the create view task
-					final CreateViewTask task = new CreateViewTask(context, session.getModelAccessor(), createViewOp, session.getInterpreter());
-					task.execute();
-
-					final Object createdView = session.getInterpreter().getVariable(createViewOp.getVariableName());
-					if (createdView instanceof DDiagramElement) {
-						final DDiagramElement element = (DDiagramElement) createdView;
-						HideFilterHelper.INSTANCE.reveal(element);
-					}
-				} catch (final MetaClassNotFoundException e) {
-					Activator.log.error(e);
-				} catch (final FeatureNotFoundException e) {
-					Activator.log.error(e);
-				}
+		try {
+			// Get the command context
+			DRepresentation representation = null;
+			if (containerView instanceof DRepresentation) {
+				representation = (DRepresentation) containerView;
+			} else if (containerView instanceof DDiagramElement) {
+				representation = ((DDiagramElement) containerView).getParentDiagram();
 			}
-		});
+
+			final CommandContext context = new CommandContext(semanticElement, representation);
+
+			// Execute the create view task
+			final CreateViewTask task = new CreateViewTask(context, session.getModelAccessor(), createViewOp, session.getInterpreter());
+			task.execute();
+
+			final Object createdView = session.getInterpreter().getVariable(createViewOp.getVariableName());
+			if (createdView instanceof DDiagramElement) {
+				final DDiagramElement element = (DDiagramElement) createdView;
+				HideFilterHelper.INSTANCE.reveal(element);
+			}
+		} catch (final MetaClassNotFoundException e) {
+			Activator.log.error(e);
+		} catch (final FeatureNotFoundException e) {
+			Activator.log.error(e);
+		}
 	}
 
 	/**