Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPauline DEVILLE2015-12-22 20:47:08 +0000
committerNicolas FAUVERGUE2018-06-29 14:56:39 +0000
commit55095e6b32ca10711ce107807dce6c23e66e0183 (patch)
tree2f2226c0b5ced34b9bc752a7f268e5bcaaaf3c2a /plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/FinalStateHelper.java
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>
Diffstat (limited to 'plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/FinalStateHelper.java')
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/FinalStateHelper.java49
1 files changed, 49 insertions, 0 deletions
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