Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/dnd/strategies/PropertyToAddStructuralFeatureValueActionDropStrategy.java')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/dnd/strategies/PropertyToAddStructuralFeatureValueActionDropStrategy.java105
1 files changed, 105 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/dnd/strategies/PropertyToAddStructuralFeatureValueActionDropStrategy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/dnd/strategies/PropertyToAddStructuralFeatureValueActionDropStrategy.java
new file mode 100644
index 00000000000..95e0c27441c
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/dnd/strategies/PropertyToAddStructuralFeatureValueActionDropStrategy.java
@@ -0,0 +1,105 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Pauline DEVILLE (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.dnd.strategies;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.uml.diagram.activity.dnd.Messages;
+import org.eclipse.papyrus.uml.diagram.activity.dnd.commands.CreateTAndUpdateCommand;
+import org.eclipse.papyrus.uml.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart;
+import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Activity;
+import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Drop strategy to create a AddStructuralFeatureAction from a Property drop and to update
+ * the "structuralFeature" reference.
+ *
+ * @since 3.5.0
+ */
+public class PropertyToAddStructuralFeatureValueActionDropStrategy extends AbstractActivityNodeStrategy {
+
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.DropStrategy#getLabel()
+ *
+ * @return
+ */
+ @Override
+ public String getLabel() {
+ return Messages.PropertyToAddStructuralFeatureValueActionDropStrategy_Label;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.DropStrategy#getDescription()
+ *
+ * @return
+ */
+ @Override
+ public String getDescription() {
+ return Messages.PropertyToAddStructuralFeatureValueActionDropStrategy_Description;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.gmfdiag.dnd.strategy.DropStrategy#getID()
+ *
+ * @return
+ */
+ @Override
+ public String getID() {
+ return UMLDiagramEditorPlugin.ID + "strategy.PropertyToAddStructuralFeatureValueAction"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.activity.dnd.strategies.AbstractActivityNodeStrategy#getCreateAndUpdateCommand(org.eclipse.gef.EditPart, org.eclipse.uml2.uml.Activity, org.eclipse.emf.ecore.EObject, org.eclipse.draw2d.geometry.Point)
+ *
+ * @param targetEditPart
+ * @param activity
+ * @param droppedNode
+ * @param location
+ * @return
+ */
+ @Override
+ protected ICommand getCreateAndUpdateCommand(EditPart targetEditPart, Activity activity, EObject droppedNode, Point location) {
+ return new CreateTAndUpdateCommand<>(
+ targetEditPart,
+ AddStructuralFeatureValueAction.class,
+ activity,
+ droppedNode,
+ false,
+ UMLElementTypes.ADD_STRUCTURAL_FEATURE_VALUE_ACTION,
+ UMLPackage.eINSTANCE.getStructuralFeatureAction_StructuralFeature(),
+ location,
+ AddStructuralFeatureValueActionEditPart.VISUAL_ID);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.activity.dnd.strategies.AbstractActivityNodeStrategy#isSourceSupportedCase(org.eclipse.emf.ecore.EObject)
+ *
+ * @param sourceElement
+ * @return
+ */
+ @Override
+ protected boolean isSourceSupportedCase(EObject sourceElement) {
+ return sourceElement instanceof Property;
+ }
+
+}

Back to the top