Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2018-09-04 04:56:24 -0400
committerQuentin Le Menez2018-09-05 05:47:32 -0400
commit59fba7ccc58ec06c340e99f65ecf22f7e10688bf (patch)
tree7b7ac92a7bca056c8747909fef8f0763a2c44bad
parentc8bda1499131c103794418659698f9918c16dced (diff)
downloadorg.eclipse.papyrus-59fba7ccc58ec06c340e99f65ecf22f7e10688bf.tar.gz
org.eclipse.papyrus-59fba7ccc58ec06c340e99f65ecf22f7e10688bf.tar.xz
org.eclipse.papyrus-59fba7ccc58ec06c340e99f65ecf22f7e10688bf.zip
Bug 538575: [Sequence Diagram] The InteractionOperation LayoutEP creates4.1.0_RC1
semantic elements (potentially twice); it shouldn't https://bugs.eclipse.org/bugs/show_bug.cgi?id=538575 Change-Id: I8507b630fc0998caf3ac5d8029acae34c585d2d3 Signed-off-by: Camille Letavernier <cletavernier@eclipsesource.com>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java22
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/CustomInteractionOperandCreationEditPolicy.java11
2 files changed, 14 insertions, 19 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java
index c035d985ef4..f060bf8a55a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandLayoutEditPolicy.java
@@ -16,7 +16,6 @@
package org.eclipse.papyrus.uml.diagram.sequence.edit.policies;
import java.util.List;
-import java.util.Map;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.EditPart;
@@ -30,12 +29,9 @@ import org.eclipse.gef.requests.GroupRequest;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest;
-import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
-import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
/**
* The custom LayoutEditPolicy for InteractionOperandEditPart.
@@ -59,6 +55,8 @@ public class InteractionOperandLayoutEditPolicy extends XYLayoutEditPolicy {
/**
* Handle create InteractionOperand hover InteractionOperand {@inheritDoc}
*/
+ // FIXME This is a layout policy; it shouldn't be responsible for any semantic
+ // operation. At best, it may handle a CreateViewRequest (e.g. during D&D of an existing Operand)
@Override
public Command getCommand(Request request) {
EditPart combinedFragmentCompartment = getHost().getParent();
@@ -67,19 +65,7 @@ public class InteractionOperandLayoutEditPolicy extends XYLayoutEditPolicy {
}
EditPart combinedFragment = combinedFragmentCompartment.getParent();
EditPart interactionCompartment = combinedFragment.getParent();
- if (REQ_CREATE.equals(request.getType()) && request instanceof CreateUnspecifiedTypeRequest) {
- if (UMLElementTypes.InteractionOperand_Shape.equals(((CreateUnspecifiedTypeRequest) request).getElementTypes().get(0))) {
- Map<? super String, Object> extendedData = request.getExtendedData();
- int hostIndex = combinedFragmentCompartment.getChildren().indexOf(getHost());
- extendedData.put(RequestParameterConstants.INSERT_AT, hostIndex + 1); // Insert after the target
- return combinedFragmentCompartment.getCommand(request);
- } else if (UMLElementTypes.CombinedFragment_Shape.equals(((CreateUnspecifiedTypeRequest) request).getElementTypes().get(0))) {
- // Fixed bug about creating on InteractionOperand. (executed Twice).
- // return interactionCompartment.getCommand(request);
- } else if (UMLElementTypes.Lifeline_Shape.equals(((CreateUnspecifiedTypeRequest) request).getElementTypes().get(0))) {
- return interactionCompartment.getCommand(request);
- }
- } else if (request instanceof CreateConnectionViewAndElementRequest) {
+ if (request instanceof CreateConnectionViewAndElementRequest) {
CreateConnectionRequest createConnectionRequest = (CreateConnectionRequest) request;
if (getHost().equals(createConnectionRequest.getSourceEditPart())) {
createConnectionRequest.setSourceEditPart(combinedFragment);
@@ -131,7 +117,7 @@ public class InteractionOperandLayoutEditPolicy extends XYLayoutEditPolicy {
protected Command getOrphanChildrenCommand(Request request) {
// Do NOT allow orphan Guard.
if (request instanceof GroupRequest) {
- List editParts = ((GroupRequest) request).getEditParts();
+ List<?> editParts = ((GroupRequest) request).getEditParts();
for (Object object : editParts) {
if (object instanceof InteractionOperandGuardEditPart) {
return UnexecutableCommand.INSTANCE;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/CustomInteractionOperandCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/CustomInteractionOperandCreationEditPolicy.java
index c95e4cd2be5..4252ce7f9de 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/CustomInteractionOperandCreationEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/CustomInteractionOperandCreationEditPolicy.java
@@ -49,11 +49,12 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest.ViewAndElementDescriptor;
import org.eclipse.gmf.runtime.emf.type.core.IElementType;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
+import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants;
+import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.uml2.uml.UMLPackage;
/**
* This allows to define the creation edit policy for the interaction operand.
@@ -68,6 +69,14 @@ public class CustomInteractionOperandCreationEditPolicy extends DefaultCreationE
@Override
public Command getCommand(Request request) {
if (understandsRequest(request)) {
+ EditPart combinedFragmentCompartment = getHost().getParent();
+ if (combinedFragmentCompartment != null && REQ_CREATE.equals(request.getType()) && request instanceof CreateUnspecifiedTypeRequest) {
+ if (UMLElementTypes.InteractionOperand_Shape.equals(((CreateUnspecifiedTypeRequest) request).getElementTypes().get(0))) {
+ Map<? super String, Object> extendedData = request.getExtendedData();
+ int hostIndex = combinedFragmentCompartment.getChildren().indexOf(getHost());
+ extendedData.put(RequestParameterConstants.INSERT_AT, hostIndex + 1); // Insert after the target
+ }
+ }
if (request instanceof CreateUnspecifiedTypeRequest) {
return getUnspecifiedTypeCreateCommand((CreateUnspecifiedTypeRequest) request);
}

Back to the top