Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java')
-rw-r--r--uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java
new file mode 100644
index 00000000000..0d29f12d38c
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.clazz/src/org/eclipse/papyrus/diagram/clazz/edit/commands/Operation5CreateCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2008 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:
+ * Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagram.clazz.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.clazz.providers.UMLElementTypes;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class Operation5CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public Operation5CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ Operation newElement = UMLFactory.eINSTANCE.createOperation();
+
+ DataType owner = (DataType) getElementToEdit();
+ owner.getOwnedOperations().add(newElement);
+
+ UMLElementTypes.init_Operation_3007(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return UMLPackage.eINSTANCE.getDataType();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}

Back to the top