Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java52
1 files changed, 15 insertions, 37 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java
index 45baa2b3ab7..e0609b812cb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ShortCutDiagramCreateCommand.java
@@ -1,22 +1,21 @@
-/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
- *
- *
+/*
+ * Copyright (c) 2014 CEA LIST.
+ *
* 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:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
+ *
+ *
+ */
package org.eclipse.papyrus.uml.diagram.profile.edit.commands;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
@@ -29,40 +28,18 @@ import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
+
+
/**
* @generated
*/
public class ShortCutDiagramCreateCommand extends EditElementCommand {
- /**
- * @generated
- */
private Diagram diagram = null;
/**
* @generated
*/
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ShortCutDiagramCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static ShortCutDiagramCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new ShortCutDiagramCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
public ShortCutDiagramCreateCommand(CreateElementRequest req, Diagram diagram) {
super(req.getLabel(), null, req);
this.diagram = diagram;
@@ -70,7 +47,6 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand {
/**
* FIXME: replace with setElementToEdit()
- *
* @generated
*/
protected EObject getElementToEdit() {
@@ -78,10 +54,7 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand {
if(container instanceof View) {
container = ((View)container).getElement();
}
- if(container != null) {
- return container;
- }
- return eObject;
+ return container;
}
/**
@@ -95,6 +68,7 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand {
* @generated
*/
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
// Uncomment to put "phantom" objects into the diagram file.
// org.eclipse.emf.ecore.resource.Resource resource =
// ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer().eResource();
@@ -104,7 +78,10 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand {
Resource resource = getElementToEdit().eResource();
Diagram newElement = NotationFactory.eINSTANCE.createDiagram();
resource.getContents().add(newElement);
+
+
doConfigure(newElement, monitor, info);
+
((CreateElementRequest)getRequest()).setNewElement(newElement);
return CommandResult.newOKCommandResult(newElement);
}
@@ -122,4 +99,5 @@ public class ShortCutDiagramCreateCommand extends EditElementCommand {
configureCommand.execute(monitor, info);
}
}
+
}

Back to the top