aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2017-10-02 10:30:48 -0400
committerPatrick Tessier2017-10-06 04:37:54 -0400
commit73f16b0552516204dadc63f1f801ceeccd7b619f (patch)
tree06e272a515c22c2de83fe2a3ee2ffb75608a61d5
parent7b34cbeb964e630f00a02ff0780ce663c3c79a81 (diff)
downloadorg.eclipse.papyrus-73f16b0552516204dadc63f1f801ceeccd7b619f.zip
org.eclipse.papyrus-73f16b0552516204dadc63f1f801ceeccd7b619f.tar.gz
org.eclipse.papyrus-73f16b0552516204dadc63f1f801ceeccd7b619f.tar.xz
Bug 525369 - [SequenceDiagram] ExecutionSpecification order in fragment
list https://bugs.eclipse.org/bugs/show_bug.cgi?id=525369 Execution specification are not present into the grill notation, so it was just add at the end of the sort of element. This patch add the execution specification at the right position when it is add by get the position of it's start element. Change-Id: I08948a28b9fc763aa829361702700738aee88d8f Signed-off-by: Mickael ADAM <mickael.adam@all4tec.net>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java
index 3f3b055..5f8890f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ComputeOwnerHelper.java
@@ -8,7 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 525369
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
+import org.eclipse.uml2.uml.ExecutionSpecification;
import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.InteractionFragment;
import org.eclipse.uml2.uml.InteractionOperand;
@@ -152,7 +153,23 @@ public class ComputeOwnerHelper implements IComputeOwnerHelper {
ArrayList<InteractionFragment> existedFragments = new ArrayList<InteractionFragment>();
ArrayList<InteractionFragment> sorted = sortSemanticFromRows(elementForInteraction, rows);
existedFragments.addAll(sorted);
- existedFragments.addAll(interaction.getFragments());
+ // Add not sorted element existing into fragment
+ for (InteractionFragment interactionFragment : interaction.getFragments()) {
+ if (!existedFragments.contains(interactionFragment)) {
+ if (interactionFragment instanceof ExecutionSpecification) {
+ // if its an execution specification place it after the start
+ int indexOfStartOS = existedFragments.indexOf(((ExecutionSpecification) interactionFragment).getStart());
+ if (0 <= indexOfStartOS) {
+ existedFragments.add(indexOfStartOS + 1, interactionFragment);
+ } else {
+ existedFragments.add(interactionFragment);
+ }
+ } else {
+ // else add it to the end of the list
+ existedFragments.add(interactionFragment);
+ }
+ }
+ }
grid.execute(new SetCommand(domain, interaction, UMLPackage.eINSTANCE.getInteraction_Fragment(), existedFragments));
}
}