diff options
NEW - bug 302703: [Profile Diagram] Papyrus shall support profile diagram
https://bugs.eclipse.org/bugs/show_bug.cgi?id=302703
Diffstat (limited to 'plugins/uml/org.eclipse.papyrus.diagram.profile/src/org/eclipse/papyrus/diagram/profile/edit/policies/DataTypeOperationItemSemanticEditPolicy.java')
-rw-r--r-- | plugins/uml/org.eclipse.papyrus.diagram.profile/src/org/eclipse/papyrus/diagram/profile/edit/policies/DataTypeOperationItemSemanticEditPolicy.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.profile/src/org/eclipse/papyrus/diagram/profile/edit/policies/DataTypeOperationItemSemanticEditPolicy.java b/plugins/uml/org.eclipse.papyrus.diagram.profile/src/org/eclipse/papyrus/diagram/profile/edit/policies/DataTypeOperationItemSemanticEditPolicy.java new file mode 100644 index 00000000000..ee997dfad80 --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.diagram.profile/src/org/eclipse/papyrus/diagram/profile/edit/policies/DataTypeOperationItemSemanticEditPolicy.java @@ -0,0 +1,57 @@ +/*****************************************************************************
+ * Copyright (c) 2010 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.diagram.profile.edit.policies;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.profile.providers.UMLElementTypes;
+
+/**
+ * @generated
+ */
+public class DataTypeOperationItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ public DataTypeOperationItemSemanticEditPolicy() {
+ super(UMLElementTypes.Operation_3019);
+ }
+
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ View view = (View)getHost().getModel();
+ CompositeTransactionalCommand cmd = new CompositeTransactionalCommand(getEditingDomain(), null);
+ cmd.setTransactionNestingEnabled(false);
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if(annotation == null) {
+ // there are indirectly referenced children, need extra commands: false
+ addDestroyShortcutsCommand(cmd, view);
+ // delete host element
+ cmd.add(new DestroyElementCommand(req));
+ } else {
+ cmd.add(new DeleteCommand(getEditingDomain(), view));
+ }
+ return getGEFWrapper(cmd.reduce());
+ }
+
+}
|