Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2016-12-12 13:04:04 +0000
committerFlorian Noyrit2017-04-19 09:23:10 +0000
commite3a93b499e1ff6b4ae925a83a33be67741362e95 (patch)
treec0452ffc5569a430fe554ce61deba8219ea8fb53 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus
parentf45a1c318287940a1aa794e1ca5bf4803f643666 (diff)
downloadorg.eclipse.papyrus-e3a93b499e1ff6b4ae925a83a33be67741362e95.tar.gz
org.eclipse.papyrus-e3a93b499e1ff6b4ae925a83a33be67741362e95.tar.xz
org.eclipse.papyrus-e3a93b499e1ff6b4ae925a83a33be67741362e95.zip
Bug 509074 - [ActivityDiagram] Pins of TestIdentityAction should be
create automatically Change-Id: If49ab854c2d77d8dfffaddc93a077b6fb8f1ab2e 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/TestIdentityActionEditHelperAdvice.java81
-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/TestIdentityActionPinUpdater.java73
-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, 163 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/TestIdentityActionEditHelperAdvice.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/TestIdentityActionEditHelperAdvice.java
new file mode 100644
index 00000000000..da42fe13d70
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/advices/TestIdentityActionEditHelperAdvice.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Remi Schnekenburger (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.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.diagram.activity.edit.commands.util.ImportUMLPrimitiveTypePackageCommand;
+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.UpdaterPinUtils;
+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.papyrus.uml.tools.utils.PackageUtil;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.TestIdentityAction;
+
+/**
+ *
+ * Pins of TestIdentityAction should be create automatically
+ *
+ */
+public class TestIdentityActionEditHelperAdvice extends AbstractEditHelperAdvice {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
+ // 1] get the preference for TestIdentityAction
+ final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ boolean synchronizePin = (prefStore.getString(IAutomatedModelCompletionPreferencesConstants.TEST_IDENTITY_ACTION).equals(AutomatedModelCompletionPreferencesInitializer.PIN_SYNCHRONIZATION));
+ // 2] check preference
+ if (synchronizePin) {
+ TestIdentityAction testIdentityAction = (TestIdentityAction) request.getElementToConfigure();
+ if (testIdentityAction != null) {
+ // 3] call the command for the TestIdentityAction
+ IPinUpdater<TestIdentityAction> updater = PinUpdaterFactory.getInstance().instantiate(testIdentityAction);
+ return new PinUpdateCommand<TestIdentityAction>("Update test identity action pins", updater, testIdentityAction); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @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 TestIdentityAction
+ final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
+ boolean synchronizePin = (prefStore.getString(IAutomatedModelCompletionPreferencesConstants.TEST_IDENTITY_ACTION).equals(AutomatedModelCompletionPreferencesInitializer.PIN_SYNCHRONIZATION));
+ // 2] check preference
+ if (synchronizePin) {
+ Package root = PackageUtil.getRootPackage((Element) request.getElementToConfigure());
+ if (!UpdaterPinUtils.isPrimitiveTypeLibraryImported(root)) {
+ // 3] call the command to import UML primitive types package
+ return new ImportUMLPrimitiveTypePackageCommand("Import UML primitive type package", root); //$NON-NLS-1$
+ }
+ }
+ 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 d2fca723e26..164bbee38dd 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
@@ -19,6 +19,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediatea
import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.AddStructuralFeatureValueActionPinUpdater;
import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.CreateObjectActionPinUpdater;
import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.ReadStructuralFeatureActionPinUpdater;
+import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.TestIdentityActionPinUpdater;
import org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.intermediateactions.ValueSpecificationActionPinUpdater;
import org.eclipse.uml2.uml.AcceptCallAction;
import org.eclipse.uml2.uml.AcceptEventAction;
@@ -29,6 +30,7 @@ import org.eclipse.uml2.uml.CallOperationAction;
import org.eclipse.uml2.uml.CreateObjectAction;
import org.eclipse.uml2.uml.ReadStructuralFeatureAction;
import org.eclipse.uml2.uml.SendSignalAction;
+import org.eclipse.uml2.uml.TestIdentityAction;
import org.eclipse.uml2.uml.ValueSpecificationAction;
public class PinUpdaterFactory {
@@ -87,6 +89,8 @@ public class PinUpdaterFactory {
updater = (IPinUpdater<T>) new CreateObjectActionPinUpdater();
} else if (node instanceof ValueSpecificationAction) {
updater = (IPinUpdater<T>) new ValueSpecificationActionPinUpdater();
+ } else if (node instanceof TestIdentityAction) {
+ updater = (IPinUpdater<T>) new TestIdentityActionPinUpdater();
}
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/TestIdentityActionPinUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/intermediateactions/TestIdentityActionPinUpdater.java
new file mode 100644
index 00000000000..8ec42ece5ec
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/utils/updater/intermediateactions/TestIdentityActionPinUpdater.java
@@ -0,0 +1,73 @@
+/*****************************************************************************
+ * 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:
+ * J�r�mie TATIBOUET (CEA LIST) - Initial API and implementation
+ * S�bastien REVOL (CEA LIST) - Initial API and implementation
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 496905
+ *
+ *****************************************************************************/
+
+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.OutputPin;
+import org.eclipse.uml2.uml.TestIdentityAction;
+import org.eclipse.uml2.uml.UMLFactory;
+
+/**
+ *
+ * Pins of TestIdentityAction should be create automatically
+ *
+ */
+public class TestIdentityActionPinUpdater extends AbstractActionPinUpdater<TestIdentityAction> {
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.activity.edit.utils.updater.IPinUpdater#updatePins(org.eclipse.uml2.uml.ActivityNode)
+ *
+ * @param node
+ */
+ @Override
+ public void updatePins(TestIdentityAction node) {
+ if (node != null) {
+ // 1] create result pin if it is not created yet
+ OutputPin result = node.getResult();
+ if (result == null) {
+ result = UMLFactory.eINSTANCE.createOutputPin();
+ result.setName("result"); //$NON-NLS-1$
+ result.setLower(1);
+ result.setUpper(1);
+ node.setResult(result);
+ }
+ // 2] set return pin type with boolean
+ result.setType(getUMLPrimitiveType("Boolean", node.getModel())); //$NON-NLS-1$
+ // 3] create first pin if it is not created yet
+ // this pin stay untyped
+ if (node.getFirst() == null) {
+ InputPin first = UMLFactory.eINSTANCE.createInputPin();
+ first.setName("first"); //$NON-NLS-1$
+ first.setLower(1);
+ first.setUpper(1);
+ node.setFirst(first);
+ }
+ // 4] create second pin if it is not created yet
+ // this pin stay untyped
+ if (node.getSecond() == null) {
+ InputPin second = UMLFactory.eINSTANCE.createInputPin();
+ second.setName("second"); //$NON-NLS-1$
+ second.setLower(1);
+ second.setUpper(1);
+ node.setSecond(second);
+ }
+ }
+
+ }
+
+
+}
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 5ff9453f032..fd3cdff9e62 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
@@ -24,6 +24,7 @@ import org.eclipse.uml2.uml.ActivityNode;
import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
import org.eclipse.uml2.uml.CreateObjectAction;
import org.eclipse.uml2.uml.ReadStructuralFeatureAction;
+import org.eclipse.uml2.uml.TestIdentityAction;
import org.eclipse.uml2.uml.ValueSpecificationAction;
/**
@@ -77,6 +78,7 @@ public class ActivityAutomatedModelCompletionPreferencePage extends AbstractAuto
actionList.add(AddStructuralFeatureValueAction.class);
actionList.add(CreateObjectAction.class);
actionList.add(ReadStructuralFeatureAction.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 e77d4a0ba30..7484e12723b 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
@@ -49,6 +49,7 @@ public class AutomatedModelCompletionPreferencesInitializer extends AbstractPref
store.setDefault(IAutomatedModelCompletionPreferencesConstants.ADD_STRUCTURAL_FEATURE_VALUE_ACTION_ACCELERATOR, PIN_SYNCHRONIZATION);
store.setDefault(IAutomatedModelCompletionPreferencesConstants.CREATE_OBJECT_ACTION_ACCELERATOR, PIN_SYNCHRONIZATION);
store.setDefault(IAutomatedModelCompletionPreferencesConstants.READ_STRUCTURAL_FEATURE_ACTION_ACCELERATOR, 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 ca39d698616..3dcaddc0248 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
@@ -30,5 +30,7 @@ public interface IAutomatedModelCompletionPreferencesConstants {
final public String READ_STRUCTURAL_FEATURE_ACTION_ACCELERATOR = "org.eclipse.papyrus.uml.diagram.activity.preferences.readStructuralFeatureAction";
+ 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