Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2015-12-22 15:47:08 -0500
committerNicolas FAUVERGUE2018-06-29 10:56:39 -0400
commit55095e6b32ca10711ce107807dce6c23e66e0183 (patch)
tree2f2226c0b5ced34b9bc752a7f268e5bcaaaf3c2a
parentc05f764506ed73159895b3989e346752f86c1d74 (diff)
downloadorg.eclipse.papyrus-55095e6b32ca10711ce107807dce6c23e66e0183.tar.gz
org.eclipse.papyrus-55095e6b32ca10711ce107807dce6c23e66e0183.tar.xz
org.eclipse.papyrus-55095e6b32ca10711ce107807dce6c23e66e0183.zip
Bug 481499 - It is possible to add a region in a final state in State
machine diagram Change-Id: Iaf7106a5da345c3aafd7733d406998a8d2ca96c8 Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/pom.xml2
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/FinalStateHelper.java49
4 files changed, 52 insertions, 3 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF
index 9cf925d949c..e6385b81b7b 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/META-INF/MANIFEST.MF
@@ -19,7 +19,7 @@ Require-Bundle: org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.
org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.100,2.0.0)"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
-Bundle-Version: 4.0.0.qualifier
+Bundle-Version: 4.1.0.qualifier
Bundle-Localization: plugin
Bundle-Name: %pluginName
Bundle-Activator: org.eclipse.papyrus.uml.service.types.Activator
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations b/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
index 6b6a08968c6..17b34d06b36 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations
@@ -465,7 +465,7 @@
<iconEntry xmi:type="elementtypesconfigurations:IconEntry" xmi:id="_Scj-sVYCEeS0WsAAtVmToA" iconPath="/icons/full/obj16/FinalNode.gif" bundleId="org.eclipse.uml2.uml.edit"/>
<eClass xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//FinalNode"/>
</elementTypeConfigurations>
- <elementTypeConfigurations xmi:type="elementtypesconfigurations:MetamodelTypeConfiguration" xmi:id="org.eclipse.papyrus.uml.FinalState" identifier="org.eclipse.papyrus.uml.FinalState" name="UML::FinalState" hint="UML::FinalState" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" editHelperClassName="org.eclipse.papyrus.uml.service.types.helper.ElementEditHelper">
+ <elementTypeConfigurations xmi:type="elementtypesconfigurations:MetamodelTypeConfiguration" xmi:id="org.eclipse.papyrus.uml.FinalState" identifier="org.eclipse.papyrus.uml.FinalState" name="UML::FinalState" hint="UML::FinalState" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" editHelperClassName="org.eclipse.papyrus.uml.service.types.helper.FinalStateHelper">
<iconEntry xmi:type="elementtypesconfigurations:IconEntry" xmi:id="_ScklwFYCEeS0WsAAtVmToA" iconPath="/icons/full/obj16/FinalState.gif" bundleId="org.eclipse.uml2.uml.edit"/>
<eClass xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//FinalState"/>
</elementTypeConfigurations>
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/pom.xml b/plugins/uml/org.eclipse.papyrus.uml.service.types/pom.xml
index 7c0e30ff595..110d8a0e31e 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/pom.xml
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/pom.xml
@@ -7,6 +7,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.service.types</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/FinalStateHelper.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/FinalStateHelper.java
new file mode 100644
index 00000000000..964803345b5
--- /dev/null
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/FinalStateHelper.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2018 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.service.types.helper;
+
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.FinalState;
+import org.eclipse.uml2.uml.Region;
+
+/**
+ * Edit helper class for {@link FinalState}
+ *
+ * Expected behavior:
+ * - Avoid to create a {@link Region} as child node of the {@link FinalState}
+ *
+ * @since 4.1
+ */
+public class FinalStateHelper extends ElementEditHelper {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ICommand getCreateCommand(final CreateElementRequest req) {
+ if (!(req.getContainer() instanceof FinalState)) {
+ return null;
+ }
+ IElementType elementToCreate = req.getElementType();
+ if (UMLElementTypes.REGION == elementToCreate) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ return super.getCreateCommand(req);
+ }
+
+}

Back to the top