Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2017-05-29 17:46:09 +0000
committerPatrick Tessier2017-05-29 19:04:48 +0000
commita0a99d74d9c1b6eb066cd64a8f30e43a2e17dfba (patch)
tree67c3de654028d9338973443eb2dfffbbd1dda0e3 /plugins
parentad92e970c43b8d565e6f5261ee80d66e1f72b0e2 (diff)
downloadorg.eclipse.papyrus-a0a99d74d9c1b6eb066cd64a8f30e43a2e17dfba.tar.gz
org.eclipse.papyrus-a0a99d74d9c1b6eb066cd64a8f30e43a2e17dfba.tar.xz
org.eclipse.papyrus-a0a99d74d9c1b6eb066cd64a8f30e43a2e17dfba.zip
Bug 517396 - [SequenceDiagram] remove event linked to message or
ExecutionSpecification Change-Id: Ia8861414a6c49a634196ee49a7f3547f3ff5b284
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java18
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExecutionSpecificationEditHelper.java5
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ExecutionSpecificationHelperAdvice.java57
-rw-r--r--plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/OccurrenceSpecificationHelperAdvice.java51
5 files changed, 102 insertions, 37 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java
index 26059dc3ead..f17d56d337c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java
@@ -329,7 +329,12 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
double newPercentY = localY / bounds.preciseHeight();
double oldPercentY = IdentityAnchorHelper.getYPercentage(anchor);
- if (Math.abs(oldPercentY - newPercentY) > 0.05) {
+ double oldPosition=oldPercentY*bounds.preciseHeight();
+ double newPosition=newPercentY*bounds.preciseHeight();
+ DiagramEditPart diagramEditPart = getDiagramEditPart(getHost());
+ GridManagementEditPolicy grilling = (GridManagementEditPolicy) diagramEditPart.getEditPolicy(GridManagementEditPolicy.GRILLING_MANAGEMENT);
+ if (grilling != null) {
+ if (Math.abs(oldPosition - newPosition) >grilling.threshold ) {
if (newPercentY > 1) {
newPercentY = 0.99;
}
@@ -342,6 +347,7 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem
execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
}
}
+ }
}
public static int computeAnchorPositionNotation(IdentityAnchor anchor, GraphicalEditPart nodeEditPart) {
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 f2f8b5cc0b8..d380c7c3f74 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
@@ -72,7 +72,23 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A
public static String COLUMN = "COLUMN_";
public static String ROW = "ROW_";
- public int threshold = 10;
+ public int threshold = 5;
+ /**
+ * @return the threshold
+ */
+ public int getThreshold() {
+ return threshold;
+ }
+
+ /**
+ * @param threshold the threshold to set
+ */
+ public void setThreshold(int threshold) {
+ this.threshold = threshold;
+ }
+
+
+
public int margin = 50;
public boolean respectMargin = true;
public boolean moveAllLinesAtSamePosition = false;
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExecutionSpecificationEditHelper.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExecutionSpecificationEditHelper.java
index 6ffe1b6bb2a..c155ccffa53 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExecutionSpecificationEditHelper.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/ExecutionSpecificationEditHelper.java
@@ -33,6 +33,7 @@ import org.eclipse.uml2.uml.InteractionFragment;
import org.eclipse.uml2.uml.InteractionOperand;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
import org.eclipse.uml2.uml.OccurrenceSpecification;
@@ -66,11 +67,11 @@ public abstract class ExecutionSpecificationEditHelper extends ElementEditHelper
destroyIntermediateInteractionFragments(es, req.getEditingDomain(), deleteElementsCommand);
- if (es.getStart() != null) {
+ if (es.getStart() != null && !(es.getStart() instanceof MessageEnd)) {
DestroyElementRequest delStart = new DestroyElementRequest(req.getEditingDomain(), es.getStart(), false);
deleteElementsCommand.add(new DestroyElementCommand(delStart));
}
- if (es.getFinish() != null) {
+ if (es.getFinish() != null&&!(es.getFinish() instanceof MessageEnd)) {
DestroyElementRequest delEnd = new DestroyElementRequest(req.getEditingDomain(), es.getFinish(), false);
deleteElementsCommand.add(new DestroyElementCommand(delEnd));
}
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ExecutionSpecificationHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ExecutionSpecificationHelperAdvice.java
index 8fa91f44524..67ac06ac9f9 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ExecutionSpecificationHelperAdvice.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/ExecutionSpecificationHelperAdvice.java
@@ -41,6 +41,7 @@ import org.eclipse.uml2.uml.Interaction;
import org.eclipse.uml2.uml.InteractionFragment;
import org.eclipse.uml2.uml.Lifeline;
import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
import org.eclipse.uml2.uml.MessageSort;
import org.eclipse.uml2.uml.OccurrenceSpecification;
@@ -148,44 +149,44 @@ public class ExecutionSpecificationHelperAdvice extends AbstractEditHelperAdvice
// Check whether start - finish referenced OccurrenceSpecification should be added to the dependents list
OccurrenceSpecification osStart = es.getStart();
- if (shouldDestroyOccurrenceSpecification(es, osStart)) {
+ if (shouldDestroyOccurrenceSpecification(es, osStart)&& (!(osStart instanceof MessageEnd))) {
dependentsToDestroy.add(osStart);
}
OccurrenceSpecification osFinish = es.getFinish();
- if (shouldDestroyOccurrenceSpecification(es, osFinish)) {
+ if (shouldDestroyOccurrenceSpecification(es, osFinish)&& (!(osFinish instanceof MessageEnd))) {
dependentsToDestroy.add(osFinish);
}
Set<Lifeline> coveredLifelines = new HashSet<Lifeline>(es.getCovereds());
// find initiating MOS of a synch message
- InteractionFragment previousIft = InteractionFragmentHelper.findPreviousFragment(osStart, es.getOwner());
- while (previousIft != null) {
- // keep the first ift with the same lifelines, and check it
- if (coveredLifelines.equals(new HashSet<Lifeline>(previousIft.getCovereds()))) {
- if (previousIft instanceof MessageOccurrenceSpecification) {
- Message msg = ((MessageOccurrenceSpecification) previousIft).getMessage();
- if (msg != null && MessageSort.SYNCH_CALL_LITERAL.equals(msg.getMessageSort())) {
- dependentsToDestroy.add(previousIft);
- }
- }
- break;
- }
- previousIft = InteractionFragmentHelper.findPreviousFragment(previousIft, es.getOwner());
- }
-
- // find MOS between the start and finish
- InteractionFragment fragment = osStart;
- while (fragment != null && !fragment.equals(osFinish)) {
- // remove MOS if it have the same covered lifelines as the ES
- if (fragment instanceof MessageOccurrenceSpecification && coveredLifelines.equals(new HashSet<Lifeline>(fragment.getCovereds()))) {
- dependentsToDestroy.add(fragment);
- }
-
- fragment = InteractionFragmentHelper.findNextFragment(fragment, es.getOwner());
- }
-
+// InteractionFragment previousIft = InteractionFragmentHelper.findPreviousFragment(osStart, es.getOwner());
+// while (previousIft != null) {
+// // keep the first ift with the same lifelines, and check it
+// if (coveredLifelines.equals(new HashSet<Lifeline>(previousIft.getCovereds()))) {
+// if (previousIft instanceof MessageOccurrenceSpecification) {
+// Message msg = ((MessageOccurrenceSpecification) previousIft).getMessage();
+// if (msg != null && MessageSort.SYNCH_CALL_LITERAL.equals(msg.getMessageSort())) {
+// dependentsToDestroy.add(previousIft);
+// }
+// }
+// break;
+// }
+// previousIft = InteractionFragmentHelper.findPreviousFragment(previousIft, es.getOwner());
+// }
+//
+// // find MOS between the start and finish
+// InteractionFragment fragment = osStart;
+// while (fragment != null && !fragment.equals(osFinish)) {
+// // remove MOS if it have the same covered lifelines as the ES
+// if (fragment instanceof MessageOccurrenceSpecification && coveredLifelines.equals(new HashSet<Lifeline>(fragment.getCovereds()))) {
+// dependentsToDestroy.add(fragment);
+// }
+//
+// fragment = InteractionFragmentHelper.findNextFragment(fragment, es.getOwner());
+// }
+//
// return command to destroy dependents
if (!dependentsToDestroy.isEmpty()) {
return request.getDestroyDependentsCommand(dependentsToDestroy);
diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/OccurrenceSpecificationHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/OccurrenceSpecificationHelperAdvice.java
index 39f7f91f764..0ea2a5fe816 100644
--- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/OccurrenceSpecificationHelperAdvice.java
+++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/OccurrenceSpecificationHelperAdvice.java
@@ -14,6 +14,7 @@
package org.eclipse.papyrus.uml.service.types.helper.advice;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.eclipse.core.commands.ExecutionException;
@@ -31,15 +32,21 @@ import org.eclipse.papyrus.uml.diagram.common.helper.DurationObservationHelper;
import org.eclipse.papyrus.uml.diagram.common.helper.TimeConstraintHelper;
import org.eclipse.papyrus.uml.diagram.common.helper.TimeObservationHelper;
import org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant;
+import org.eclipse.uml2.uml.ExecutionOccurrenceSpecification;
+import org.eclipse.uml2.uml.ExecutionSpecification;
+import org.eclipse.uml2.uml.InteractionFragment;
import org.eclipse.uml2.uml.Lifeline;
+import org.eclipse.uml2.uml.Message;
+import org.eclipse.uml2.uml.MessageEnd;
import org.eclipse.uml2.uml.OccurrenceSpecification;
+import org.eclipse.uml2.uml.Package;
/**
* Helper advice for all {@link OccurrenceSpecification} elements.
*/
public class OccurrenceSpecificationHelperAdvice extends AbstractEditHelperAdvice {
-
+
/**
* <pre>
* {@inheritDoc}
@@ -60,19 +67,19 @@ public class OccurrenceSpecificationHelperAdvice extends AbstractEditHelperAdvic
if (coveredParam instanceof Lifeline) {
coveredLifeline = (Lifeline) coveredParam;
}
-
+
final OccurrenceSpecification occurrenceSpecification = (OccurrenceSpecification) request.getElementToConfigure();
if( coveredLifeline!=null){
occurrenceSpecification.setCovered(coveredLifeline);
}
-
+
return CommandResult.newOKCommandResult(occurrenceSpecification);
}
};
}
-
-
+
+
/**
* <pre>
* Add a command to destroy :
@@ -92,6 +99,40 @@ public class OccurrenceSpecificationHelperAdvice extends AbstractEditHelperAdvic
OccurrenceSpecification os = (OccurrenceSpecification)request.getElementToDestroy();
+ //look for all Execution that references this Occurrence specification
+ InteractionFragment containerPackage= (InteractionFragment)os.getOwner();
+ if( containerPackage!=null) {
+ Iterator<EObject> contentIterator=containerPackage.eAllContents();
+ while (contentIterator.hasNext()) {
+ EObject currentEObject= contentIterator.next();
+ if( currentEObject instanceof Message) {
+ Message m=(Message)currentEObject;
+ if( os.equals(m.getSendEvent())) {
+ dependentsToDestroy.add(m);
+ dependentsToDestroy.add(m.getReceiveEvent());
+ }
+ if( os.equals(m.getReceiveEvent())) {
+ dependentsToDestroy.add(m);
+ dependentsToDestroy.add(m.getSendEvent());
+ }
+ }
+ if( currentEObject instanceof ExecutionSpecification) {
+ ExecutionSpecification exec=(ExecutionSpecification)currentEObject;
+ if( os.equals(exec.getStart())) {
+ dependentsToDestroy.add(exec);
+ if( !(exec.getFinish() instanceof MessageEnd)) {
+ dependentsToDestroy.add(exec.getFinish());
+ }
+ }
+ if( os.equals(exec.getStart())) {
+ dependentsToDestroy.add(exec);
+ if( !(exec.getStart() instanceof MessageEnd)) {
+ dependentsToDestroy.add(exec.getStart());
+ }
+ }
+ }
+ }
+ }
// delete linked time elements
dependentsToDestroy.addAll(TimeObservationHelper.getTimeObservations(os));
dependentsToDestroy.addAll(TimeConstraintHelper.getTimeConstraintsOn(os));

Back to the top