Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2017-01-24 10:37:21 +0000
committerFlorian Noyrit2017-04-19 09:24:53 +0000
commitbfc914f11e72c5091f0ff5d3d410bdf2af3520c7 (patch)
tree76fc51d8fd2e2c3a9c8c331052cd0eb770a6c99a /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus
parent32052bf471aa6fb854509129da7df3ad2c69ece6 (diff)
downloadorg.eclipse.papyrus-bfc914f11e72c5091f0ff5d3d410bdf2af3520c7.tar.gz
org.eclipse.papyrus-bfc914f11e72c5091f0ff5d3d410bdf2af3520c7.tar.xz
org.eclipse.papyrus-bfc914f11e72c5091f0ff5d3d410bdf2af3520c7.zip
Bug 510131 - [ActivityDiagram] Pin of StartClassifierBehaviorAction
should be create and update automatically Change-Id: Ib5799da629561d47289ed43ea39b805e120f4bfa Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/StartClassifierBehaviorActionEditHelperAdvice.java59
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/PinUpdaterFactory.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/intermediateactions/StartClassifierBehaviorActionPinUpdater.java49
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/ActivityAutomatedModelCompletionPreferencePage.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/AutomatedModelCompletionPreferencesInitializer.java1
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/IAutomatedModelCompletionPreferencesConstants.java2
6 files changed, 117 insertions, 0 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/StartClassifierBehaviorActionEditHelperAdvice.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/StartClassifierBehaviorActionEditHelperAdvice.java
new file mode 100644
index 00000000000..df03e45372a
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/StartClassifierBehaviorActionEditHelperAdvice.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.edit.advices;
+
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.diagram.activity.edit.commands.util.PinUpdateCommand;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.IPinUpdater;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.PinUpdaterFactory;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.AutomatedModelCompletionPreferencesInitializer;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.preferences.IAutomatedModelCompletionPreferencesConstants;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.uml2.uml.StartClassifierBehaviorAction;
+
+/**
+ *
+ * Pin of StartClassifierBehaviorAction should be create and update automatically
+ *
+ */
+public class StartClassifierBehaviorActionEditHelperAdvice extends AbstractEditHelperAdvice {
+
+ /**
+ * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getBeforeConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest)
+ *
+ * @param request
+ * @return
+ */
+ @Override
+ protected ICommand getBeforeConfigureCommand(ConfigureRequest request) {
+ // 1] get the preference for StartClassifierBehaviorAction
+ final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ boolean synchronizePin = (prefStore.getString(IAutomatedModelCompletionPreferencesConstants.START_CLASSIFIER_BEHAVIOR_ACTION).equals(AutomatedModelCompletionPreferencesInitializer.PIN_SYNCHRONIZATION));
+ // 2] check preference
+ if (synchronizePin) {
+ StartClassifierBehaviorAction startClassifierBehaviorAction = (StartClassifierBehaviorAction) request.getElementToConfigure();
+ if (startClassifierBehaviorAction != null) {
+ // 3] call the command for the StartClassifierBehaviorAction
+ IPinUpdater<StartClassifierBehaviorAction> updater = PinUpdaterFactory.getInstance().instantiate(startClassifierBehaviorAction);
+ return new PinUpdateCommand<StartClassifierBehaviorAction>("Update pins of start classifier behavior action", //$NON-NLS-1$
+ updater, startClassifierBehaviorAction);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/PinUpdaterFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/PinUpdaterFactory.java
index 89469b30da9..f921020acbe 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/PinUpdaterFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/PinUpdaterFactory.java
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediatea
import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.ValueSpecificationActionPinUpdater;
import org.eclipse.uml2.uml.AcceptCallAction;
import org.eclipse.uml2.uml.AcceptEventAction;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.StartClassifierBehaviorActionPinUpdater;
import org.eclipse.uml2.uml.ActivityNode;
import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
import org.eclipse.uml2.uml.CallBehaviorAction;
@@ -38,6 +39,7 @@ import org.eclipse.uml2.uml.ReadStructuralFeatureAction;
import org.eclipse.uml2.uml.SendSignalAction;
import org.eclipse.uml2.uml.TestIdentityAction;
import org.eclipse.uml2.uml.ValueSpecificationAction;
+import org.eclipse.uml2.uml.StartClassifierBehaviorAction;
public class PinUpdaterFactory {
@@ -103,6 +105,8 @@ public class PinUpdaterFactory {
updater = (IPinUpdater<T>) new LinkActionPinUpdater();
} else if (node instanceof ReadLinkAction) {
updater = (IPinUpdater<T>) new ReadLinkActionPinUpdater();
+ } else if (node instanceof StartClassifierBehaviorAction) {
+ updater = (IPinUpdater<T>) new StartClassifierBehaviorActionPinUpdater();
}
return updater;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/intermediateactions/StartClassifierBehaviorActionPinUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/intermediateactions/StartClassifierBehaviorActionPinUpdater.java
new file mode 100644
index 00000000000..0dd876de47b
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/intermediateactions/StartClassifierBehaviorActionPinUpdater.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions;
+
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.AbstractActionPinUpdater;
+import org.eclipse.uml2.uml.InputPin;
+import org.eclipse.uml2.uml.StartClassifierBehaviorAction;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ *
+ * Pin of StartClassifierBehaviorAction should be create and update automatically
+ *
+ */
+public class StartClassifierBehaviorActionPinUpdater extends AbstractActionPinUpdater<StartClassifierBehaviorAction> {
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.IPinUpdater#updatePins(org.eclipse.uml2.uml.ActivityNode)
+ *
+ * @param node
+ */
+ @Override
+ public void updatePins(StartClassifierBehaviorAction node) {
+ if (node != null) {
+ // 1] create the object pin if it is not created yet
+ // the object pin stay untyped because we can not deduce its type
+ InputPin object = node.getObject();
+ if (object == null) {
+ object = UMLFactory.eINSTANCE.createInputPin();
+ object.setName("object");
+ }
+ object.setLower(1);
+ object.setUpper(1);
+ node.setObject(object);
+ }
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/ActivityAutomatedModelCompletionPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/ActivityAutomatedModelCompletionPreferencePage.java
index 1bd0d2e2176..c9c3fb1b053 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/ActivityAutomatedModelCompletionPreferencePage.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/ActivityAutomatedModelCompletionPreferencePage.java
@@ -27,6 +27,7 @@ import org.eclipse.uml2.uml.CreateObjectAction;
import org.eclipse.uml2.uml.DestroyLinkAction;
import org.eclipse.uml2.uml.ReadLinkAction;
import org.eclipse.uml2.uml.ReadStructuralFeatureAction;
+import org.eclipse.uml2.uml.StartClassifierBehaviorAction;
import org.eclipse.uml2.uml.TestIdentityAction;
import org.eclipse.uml2.uml.ValueSpecificationAction;
@@ -84,6 +85,7 @@ public class ActivityAutomatedModelCompletionPreferencePage extends AbstractAuto
actionList.add(DestroyLinkAction.class);
actionList.add(ReadLinkAction.class);
actionList.add(ReadStructuralFeatureAction.class);
+ actionList.add(StartClassifierBehaviorAction.class);
actionList.add(TestIdentityAction.class);
actionList.add(ValueSpecificationAction.class);
return actionList;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/AutomatedModelCompletionPreferencesInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/AutomatedModelCompletionPreferencesInitializer.java
index 8652f81e5aa..27bc3b0f7c6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/AutomatedModelCompletionPreferencesInitializer.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/AutomatedModelCompletionPreferencesInitializer.java
@@ -52,6 +52,7 @@ public class AutomatedModelCompletionPreferencesInitializer extends AbstractPref
store.setDefault(IAutomatedModelCompletionPreferencesConstants.DESTROY_LINK_ACTION_ACCELERATOR, PIN_SYNCHRONIZATION);
store.setDefault(IAutomatedModelCompletionPreferencesConstants.READ_LINK_ACTION_ACCELERATOR, PIN_SYNCHRONIZATION);
store.setDefault(IAutomatedModelCompletionPreferencesConstants.READ_STRUCTURAL_FEATURE_ACTION_ACCELERATOR, PIN_SYNCHRONIZATION);
+ store.setDefault(IAutomatedModelCompletionPreferencesConstants.START_CLASSIFIER_BEHAVIOR_ACTION, PIN_SYNCHRONIZATION);
store.setDefault(IAutomatedModelCompletionPreferencesConstants.TEST_IDENTITY_ACTION, PIN_SYNCHRONIZATION);
store.setDefault(IAutomatedModelCompletionPreferencesConstants.VALUE_SPECIFICATION_ACTION, PIN_SYNCHRONIZATION);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/IAutomatedModelCompletionPreferencesConstants.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/IAutomatedModelCompletionPreferencesConstants.java
index 0fb578ac8d4..82a009cb250 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/IAutomatedModelCompletionPreferencesConstants.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/preferences/IAutomatedModelCompletionPreferencesConstants.java
@@ -36,6 +36,8 @@ public interface IAutomatedModelCompletionPreferencesConstants {
final public String READ_STRUCTURAL_FEATURE_ACTION_ACCELERATOR = "org.eclipse.papyrus.uml.diagram.activity.preferences.readStructuralFeatureAction";
+ final public String START_CLASSIFIER_BEHAVIOR_ACTION = "org.eclipse.papyrus.uml.diagram.activity.preferences.startClassifierBehaviorAction";
+
final public String TEST_IDENTITY_ACTION = "org.eclipse.papyrus.uml.diagram.activity.preferences.testIdentityAction";
final public String VALUE_SPECIFICATION_ACTION = "org.eclipse.papyrus.uml.diagram.activity.preferences.valueSpecificationAction";

Back to the top