Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2019-06-12 09:41:58 -0400
committerNicolas FAUVERGUE2019-06-17 07:24:44 -0400
commit1dc89045f2a3acd3b70a0912f1638c60f69255cc (patch)
tree6ed8a46e89dff4844c6249e849f192897d32c3b6
parentb7f513de85288011267f83c88389254745f03ae0 (diff)
downloadorg.eclipse.papyrus-1dc89045f2a3acd3b70a0912f1638c60f69255cc.tar.gz
org.eclipse.papyrus-1dc89045f2a3acd3b70a0912f1638c60f69255cc.tar.xz
org.eclipse.papyrus-1dc89045f2a3acd3b70a0912f1638c60f69255cc.zip
Bug 533248: [Activity Diagram] Moving an activityNode between
ActivityPartitions using drag&drop does not update InPartition and Node properties correctly The move out/in of ActivityPartition was managed but the move from ActivityPartition to another one not. So this patch do it. Change-Id: I1f002f99f289829e62ac6de6e49991d68b60101e Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCompartmentCreationEditPolicy.java16
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ActivityNodeHelper.java54
2 files changed, 63 insertions, 7 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCompartmentCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCompartmentCreationEditPolicy.java
index 7a7b93785ca..7c5a87fb49b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCompartmentCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCompartmentCreationEditPolicy.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2015 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
@@ -10,7 +10,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ *
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.activity.edit.policies;
@@ -69,9 +69,21 @@ public class ActivityCompartmentCreationEditPolicy extends DefaultCreationEditPo
EObject currentParentSemantic = ((IGraphicalEditPart) gep.getParent()).resolveSemanticElement();
if (currentParentSemantic instanceof ActivityPartition) {
req.setParameter(ActivityNodeHelper.OUT_FROM_PARTITION, currentParentSemantic);
+ if (context instanceof ActivityPartition) {
+ req.setParameter(ActivityNodeHelper.IN_PARTITION, context);
+ }
+ if (context instanceof InterruptibleActivityRegion) {
+ req.setParameter(ActivityNodeHelper.IN_INTERRUPTIBLE_ACTIVITY_REGION, context);
+ }
}
if (currentParentSemantic instanceof InterruptibleActivityRegion) {
req.setParameter(ActivityNodeHelper.OUT_FROM_INTERRUPTIBLE_REGION, currentParentSemantic);
+ if (context instanceof ActivityPartition) {
+ req.setParameter(ActivityNodeHelper.IN_PARTITION, context);
+ }
+ if (context instanceof InterruptibleActivityRegion) {
+ req.setParameter(ActivityNodeHelper.IN_INTERRUPTIBLE_ACTIVITY_REGION, context);
+ }
}
Command moveSemanticCmd = getHost().getCommand(new EditCommandRequestWrapper(req));
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ActivityNodeHelper.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ActivityNodeHelper.java
index c61199a9b3c..25b7b2e65fe 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ActivityNodeHelper.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ActivityNodeHelper.java
@@ -12,7 +12,7 @@
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
* Christian W. Damus - bug 462979
- * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 494514
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bugs 494514, 533248
*
*****************************************************************************/
package org.eclipse.papyrus.uml.service.types.helper;
@@ -189,10 +189,32 @@ public class ActivityNodeHelper extends ElementEditHelper {
}
ActivityNode node = (ActivityNode) elementToMove;
List<ActivityPartition> inPartitions = new LinkedList<>(node.getInPartitions());
+ boolean change = false;
if (inPartitions.contains(outFromPartition)) {
inPartitions.remove(outFromPartition);
+ change = true;
+ }
+ // We know we have to remove the out inPartition, but we maybe have to add another inPartition
+ if (req.getParameter(IN_PARTITION) != null) {
+ ActivityPartition inPartition = (ActivityPartition) req.getParameter(IN_PARTITION);
+ if (!inPartitions.contains(inPartition)) {
+ inPartitions.add(inPartition);
+ change = true;
+ }
+ }
+ if (change) {
cc.add(new SetValueCommand(new SetRequest(node, UMLPackage.eINSTANCE.getActivityNode_InPartition(), inPartitions)));
}
+
+ // We know we have to remove the out inPartition, but maybe the inInterruptibleRegion must be filled
+ if (req.getParameter(IN_INTERRUPTIBLE_ACTIVITY_REGION) != null) {
+ InterruptibleActivityRegion inRegion = (InterruptibleActivityRegion) req.getParameter(IN_INTERRUPTIBLE_ACTIVITY_REGION);
+ List<InterruptibleActivityRegion> inRegions = new LinkedList<>(node.getInInterruptibleRegions());
+ if (!inRegions.contains(inRegion)) {
+ inRegions.add(inRegion);
+ cc.add(new SetValueCommand(new SetRequest(node, UMLPackage.eINSTANCE.getActivityNode_InInterruptibleRegion(), inRegions)));
+ }
+ }
}
return cc.isEmpty() ? null : cc.reduce();
}
@@ -208,10 +230,32 @@ public class ActivityNodeHelper extends ElementEditHelper {
continue;
}
ActivityNode node = (ActivityNode) elementToMove;
- List<InterruptibleActivityRegion> inRegion = new LinkedList<>(node.getInInterruptibleRegions());
- if (inRegion.contains(outFromRegion)) {
- inRegion.remove(outFromRegion);
- cc.add(new SetValueCommand(new SetRequest(node, UMLPackage.eINSTANCE.getActivityNode_InInterruptibleRegion(), inRegion)));
+ List<InterruptibleActivityRegion> inRegions = new LinkedList<>(node.getInInterruptibleRegions());
+ boolean change = false;
+ if (inRegions.contains(outFromRegion)) {
+ inRegions.remove(outFromRegion);
+ change = true;
+ }
+ // We know we have to remove the out inInterruptibleRegion, but we maybe have to add another inInterruptibleRegion
+ if (req.getParameter(IN_INTERRUPTIBLE_ACTIVITY_REGION) != null) {
+ InterruptibleActivityRegion inRegion = (InterruptibleActivityRegion) req.getParameter(IN_INTERRUPTIBLE_ACTIVITY_REGION);
+ if (!inRegions.contains(inRegion)) {
+ inRegions.add(inRegion);
+ change = true;
+ }
+ }
+ if (change) {
+ cc.add(new SetValueCommand(new SetRequest(node, UMLPackage.eINSTANCE.getActivityNode_InInterruptibleRegion(), inRegions)));
+ }
+
+ // We know we have to remove the out inInterruptibleRegion, but maybe the inPartition must be filled
+ if (req.getParameter(IN_PARTITION) != null) {
+ ActivityPartition inPartition = (ActivityPartition) req.getParameter(IN_PARTITION);
+ List<ActivityPartition> inPartitions = new LinkedList<>(node.getInPartitions());
+ if (!inPartitions.contains(inPartition)) {
+ inPartitions.add(inPartition);
+ cc.add(new SetValueCommand(new SetRequest(node, UMLPackage.eINSTANCE.getActivityNode_InPartition(), inPartitions)));
+ }
}
}
return cc.isEmpty() ? null : cc.reduce();

Back to the top