Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'uml/org.eclipse.papyrus.diagram.activity/src/org/eclipse/papyrus/diagram/activity/edit/policies/CallOperationActionCanonicalEditPolicy.java')
-rw-r--r--uml/org.eclipse.papyrus.diagram.activity/src/org/eclipse/papyrus/diagram/activity/edit/policies/CallOperationActionCanonicalEditPolicy.java130
1 files changed, 130 insertions, 0 deletions
diff --git a/uml/org.eclipse.papyrus.diagram.activity/src/org/eclipse/papyrus/diagram/activity/edit/policies/CallOperationActionCanonicalEditPolicy.java b/uml/org.eclipse.papyrus.diagram.activity/src/org/eclipse/papyrus/diagram/activity/edit/policies/CallOperationActionCanonicalEditPolicy.java
new file mode 100644
index 00000000000..19958163186
--- /dev/null
+++ b/uml/org.eclipse.papyrus.diagram.activity/src/org/eclipse/papyrus/diagram/activity/edit/policies/CallOperationActionCanonicalEditPolicy.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * Copyright (c) 2008
+ * Conselleria de Infraestructuras y Transporte, Generalitat de la Comunitat Valenciana .
+ * 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:
+ * Francisco Javier Cano Muñoz (Prodevelop) - initial API implementation
+ ******************************************************************************/
+package org.eclipse.papyrus.diagram.activity.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewType;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.Ratio;
+import org.eclipse.gmf.runtime.notation.Size;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.diagram.activity.edit.parts.InputPin5EditPart;
+import org.eclipse.papyrus.diagram.activity.edit.parts.InputPin6EditPart;
+import org.eclipse.papyrus.diagram.activity.edit.parts.OutputPin4EditPart;
+import org.eclipse.papyrus.diagram.activity.part.UMLDiagramUpdater;
+import org.eclipse.papyrus.diagram.activity.part.UMLNodeDescriptor;
+import org.eclipse.papyrus.diagram.activity.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.diagram.common.util.MultiDiagramUtil;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * @generated
+ */
+public class CallOperationActionCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ @Override
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = UMLDiagramUpdater.getCallOperationAction_2027SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ EObject nextValue = ((UMLNodeDescriptor) it.next()).getModelElement();
+ if (MultiDiagramUtil.findEObjectReferencedInEAnnotation(getHost(), nextValue)) {
+ result.add(nextValue);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ if (view.getType() == ViewType.NOTE || view.getType() == ViewType.TEXT) {
+ return false;
+ }
+ if (view.getElement() != null) {
+ int actualID = UMLVisualIDRegistry.getVisualID(view);
+ int suggestedID = UMLVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ switch (actualID) {
+ case OutputPin4EditPart.VISUAL_ID:
+ case InputPin5EditPart.VISUAL_ID:
+ case InputPin6EditPart.VISUAL_ID:
+ return actualID != suggestedID;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ private void populateViewProperties(View oldView, View newView) {
+ if (oldView instanceof Node && newView instanceof Node) {
+ Node oldNode = (Node) oldView;
+ Node newNode = (Node) newView;
+ if (oldNode.getLayoutConstraint() instanceof Location && newNode.getLayoutConstraint() instanceof Location) {
+ ((Location) newNode.getLayoutConstraint()).setX(((Location) oldNode.getLayoutConstraint()).getX());
+ ((Location) newNode.getLayoutConstraint()).setY(((Location) oldNode.getLayoutConstraint()).getY());
+ }
+ if (oldNode.getLayoutConstraint() instanceof Size && newNode.getLayoutConstraint() instanceof Size) {
+ ((Size) newNode.getLayoutConstraint()).setWidth(((Size) oldNode.getLayoutConstraint()).getWidth());
+ ((Size) newNode.getLayoutConstraint()).setHeight(((Size) oldNode.getLayoutConstraint()).getHeight());
+ }
+ if (oldNode.getLayoutConstraint() instanceof Ratio && newNode.getLayoutConstraint() instanceof Ratio) {
+ ((Ratio) newNode.getLayoutConstraint()).setValue(((Ratio) oldNode.getLayoutConstraint()).getValue());
+ }
+ newNode.persist();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ @Override
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getCallAction_Result());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInvocationAction_Argument());
+ myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getCallOperationAction_Target());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}

Back to the top