diff options
author | ptessier | 2019-01-18 15:01:36 +0000 |
---|---|---|
committer | Patrick Tessier | 2019-01-21 09:43:25 +0000 |
commit | c696b02ef658c459be448dc6eef043f4e0fcb59a (patch) | |
tree | 00401f75c56d0fbeb73c5e09d5d87060380be39a | |
parent | c022864a86c36b495cf76c2f67eb165464b46720 (diff) | |
download | org.eclipse.papyrus-c696b02ef658c459be448dc6eef043f4e0fcb59a.tar.gz org.eclipse.papyrus-c696b02ef658c459be448dc6eef043f4e0fcb59a.tar.xz org.eclipse.papyrus-c696b02ef658c459be448dc6eef043f4e0fcb59a.zip |
Bug 539241: [sequence diagram] problem fragments ordering
https://bugs.eclipse.org/bugs/show_bug.cgi?id=539241
Update covered
Change-Id: I564bd47a67fce9f19a7de132359535122a1d06b9
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java index e2c8cf41fcd..89f783dc9fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java @@ -56,6 +56,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions; import org.eclipse.papyrus.uml.diagram.sequence.util.RedirectionOperationListener; import org.eclipse.swt.widgets.Display; +import org.eclipse.uml2.uml.CombinedFragment; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification; import org.eclipse.uml2.uml.Interaction; @@ -293,7 +294,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A for (Lifeline lifeline : lifelineList) { ArrayList<InteractionFragment> covered = new ArrayList<>(); for (DecorationNode row : rows) { - if (row.getElement() instanceof InteractionFragment && (!(row.getElement() instanceof InteractionOperand))) { + if (row.getElement() instanceof InteractionFragment) { InteractionFragment interactionFragment = (InteractionFragment) (row.getElement()); if (lifeline.getCoveredBys().contains(interactionFragment)) { if (!covered.contains(interactionFragment)) { @@ -323,7 +324,7 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A // There are columns. ArrayList<InteractionOperand> coveredbyInteractionOperand = new ArrayList<>(); - covered = new ArrayList<>(); + // covered = new ArrayList<>(); for (DecorationNode column : columns) { if (column.getElement() instanceof InteractionOperand) { // Except for the initial operand creation, coverage is managed @@ -335,6 +336,35 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A } } + + // 4. put the combined fragment before the owner of the first interactionOperand + // remove all CombiendFragment from this list + { + int index = 0; + while (index < covered.size()) { + if (covered.get(index) instanceof CombinedFragment) { + covered.remove(index); + } else { + index++; + } + } + } + // remove CF owner before the first interactionOperand + int index = 0; + while (index < covered.size()) { + if (covered.get(index) instanceof InteractionOperand) { + if (covered.get(index - 1) instanceof CombinedFragment) { + index++; + + } else { + CombinedFragment cf = (CombinedFragment) ((InteractionOperand) covered.get(index)).eContainer(); + covered.add(index, cf); + index++; + } + } + index++; + } + if (covered.size() > 0) { UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "Add Interraction operand");//$NON-NLS-1$ covered.addAll(lifeline.getCoveredBys()); |