Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2017-04-11 14:59:49 +0000
committerptessier2017-05-08 14:55:12 +0000
commitc1d77b5a73b4768787c41ed1cd335048ab62321e (patch)
treef849d5df40506d7c83b095e4f5ab9d5570f10e36
parentf76aae8af748a7bf0fe4b7e45e35a866d4566df4 (diff)
downloadorg.eclipse.papyrus-c1d77b5a73b4768787c41ed1cd335048ab62321e.tar.gz
org.eclipse.papyrus-c1d77b5a73b4768787c41ed1cd335048ab62321e.tar.xz
org.eclipse.papyrus-c1d77b5a73b4768787c41ed1cd335048ab62321e.zip
Bug 514836 - [SequenceDiagram] add management of combinedFragment by the
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java88
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentEditPart.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionOperandEditPart.java89
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCombinedFragmentCombinedFragmentCompartmentEditPart.java)18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java)7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/InteractionOperandFigure.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/BoundForEditPart.java17
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectCombinedFragmentToGrillingEditPolicy.java207
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectEdgeToGrillingEditPolicy.java8
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectExecutionNodeToGrillingEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectInteractionOperandToGridEditPolicy.java119
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectLifeLineToGrillingEditPolicy.java241
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGridEditPolicy.java352
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGrillingEditPolicy.java245
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingBasedXYLayoutEditPolicy.java9
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingManagementEditPolicy.java54
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/InteractionOperandToGridEditPolicy.java28
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java307
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java10
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen4
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentCombinedFragmentCompartmentEditPart.java54
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java2
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandEditPart.java7
-rwxr-xr-xplugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageAsyncEditPart.java3
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestGuardEdition_364808.java7
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestInteractionConstraint_382966.java15
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/AbstractNodeTest.java2
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestElementIcon_396799.java3
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java21
37 files changed, 1175 insertions, 852 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java
new file mode 100644
index 00000000000..6ee88b4d0cd
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentCombinedFragmentCompartmentEditPart.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import java.util.Iterator;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.BoundForEditPart;
+
+/**
+ * This class has been modified for 2 reasons:
+ * - refresh in order to ensure the refresh about size of children
+ * - compute the ratio for each children.
+ *
+ */
+public class CCombinedFragmentCombinedFragmentCompartmentEditPart extends CombinedFragmentCombinedFragmentCompartmentEditPart {
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public CCombinedFragmentCombinedFragmentCompartmentEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * this method has been overloaded in order to ensure the refresh about children size
+ */
+ protected void refreshBounds() {
+ int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ Dimension size = new Dimension(width, height);
+ int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+
+ //this code has been added in order to force the refresh of Sub Combined fragment
+ if(children!=null){
+ for (Object child : children) {
+ if( child instanceof EditPart){
+ ((EditPart)child).refresh();
+ }
+ }
+ }
+ }
+
+ /**
+ * This code is specific an use to constraint the size of sub compartments.
+ * the ratio has to be recompute in order to have a good display
+ * @see GraphicalEditPart#setLayoutConstraint(EditPart, IFigure, Object)
+ */
+ public void setLayoutConstraint(EditPart child, IFigure childFigure,
+ Object childConstraint) {
+ EditPart parentEditPart=this.getParent();
+ //compute the ratio for each children
+ int parentHeight= BoundForEditPart.getHeightFromView((Node)parentEditPart.getModel());
+ if(childConstraint instanceof Rectangle){
+ double ratio= ((double)((Rectangle)childConstraint).height)/parentHeight;
+ if( ratio>=1.0){
+ ratio=0.95;
+ }
+ System.out.println("ratio"+ratio);
+ childFigure.getParent().setConstraint(childFigure, ratio);
+ }
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentEditPart.java
index 2a30b822f32..eccd48b3fdc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CCombinedFragmentEditPart.java
@@ -26,7 +26,7 @@ import org.eclipse.uml2.uml.CombinedFragment;
*
*/
public class CCombinedFragmentEditPart extends CombinedFragmentEditPart {
- public static int DEFAULT_HEIGHT=40;
+ public static int DEFAULT_HEIGHT=60;
public static int DEFAULT_WIDTH=40;
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionOperandEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionOperandEditPart.java
new file mode 100644
index 00000000000..4ec80426260
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CInteractionOperandEditPart.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.BoundForEditPart;
+
+/**
+ * This class has been modified
+ * because the container is used to manipulate as a list
+ * the refresh has been modified to take the size of the operand.
+ *
+ */
+public class CInteractionOperandEditPart extends InteractionOperandEditPart {
+
+ public static int DEFAULT_HEIGHT=40;
+ public static int DEFAULT_WIDHT=100;
+
+ /**
+ * Constructor.
+ *
+ * @param view
+ */
+ public CInteractionOperandEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * this method has been overloaded in order to set InteractionOperand transparent
+ * @see org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart#refreshVisuals()
+ *
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ getPrimaryShape().setTransparency(100);
+ }
+
+ /**
+ * this method method has been overloaded because of a mistake in the gmfgen.
+ * so we has to implement addition of sub-figures inside the primary figure...
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart#getContentPaneFor(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart)
+ *
+ * @param editPart
+ * @return
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if (editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ } else {
+ return getPrimaryShape();
+ }
+ }
+
+ /**
+ * because the container is used to manipulate as a list
+ * the refresh has been modified to take the size of the operand.
+ */
+ protected void refreshBounds() {
+ int width = BoundForEditPart.getWidthFromView((Node)getNotationView());
+ int height = BoundForEditPart.getHeightFromView((Node)getNotationView());
+ Dimension size = new Dimension(width, height);
+ int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ Point loc = new Point(x, y);
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(),new Rectangle(loc, size));
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java
index 048ff508786..63fa37fb381 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandGuardEditPart.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
@@ -126,7 +127,7 @@ import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.ValueSpecification;
/**
- * @author Jin Liu (jin.liu@soyatec.com)
+ * this class is used to edit a guard of an interaction operand
*/
public class InteractionOperandGuardEditPart extends ShapeEditPart implements ITextAwareEditPart {
@@ -295,6 +296,7 @@ public class InteractionOperandGuardEditPart extends ShapeEditPart implements IT
defaultText = getLabelTextHelper(figure);
registerVisuals();
refreshVisuals();
+ figure.setBackgroundColor(ColorConstants.red);
}
@Override
@@ -307,8 +309,17 @@ public class InteractionOperandGuardEditPart extends ShapeEditPart implements IT
return null;
}
+ /**
+ * return the interactionoperand
+ * @return
+ */
protected EObject getParserElement() {
- return getInteractionOperand(resolveSemanticElement());
+ if(this.getParent() instanceof InteractionOperandEditPart){
+ InteractionOperandEditPart interactionOperandEditPart=(InteractionOperandEditPart)this.getParent();
+ return interactionOperandEditPart.resolveSemanticElement();
+ }
+ return null;
+ //return getInteractionOperand(resolveSemanticElement());
}
protected Image getLabelIcon() {
@@ -515,6 +526,9 @@ public class InteractionOperandGuardEditPart extends ShapeEditPart implements IT
refreshFontColor();
refreshUnderline();
refreshStrikeThrough();
+
+
+
}
@Override
@@ -771,6 +785,7 @@ public class InteractionOperandGuardEditPart extends ShapeEditPart implements IT
return text;
}
+ @Deprecated
protected static InteractionOperand getInteractionOperand(Object element) {
InteractionOperand operand = null;
if (element instanceof InteractionConstraint) {
@@ -815,9 +830,12 @@ public class InteractionOperandGuardEditPart extends ShapeEditPart implements IT
@Override
public String getPrintString(IAdaptable element, int flags) {
- Object adapter = element.getAdapter(EObject.class);
- InteractionOperand operand = getInteractionOperand(adapter);
- return getGuardLabelText(operand, false);
+ EObject operand = (EObject)element.getAdapter(EObject.class);
+ //InteractionOperand operand = getInteractionOperand(adapter);
+ if( operand instanceof InteractionOperand){
+ return getGuardLabelText((InteractionOperand)operand, false);
+ }
+ return "";
}
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCombinedFragmentCombinedFragmentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.java
index e02b1072130..ddde4ef1cd0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomCombinedFragmentCombinedFragmentCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.java
@@ -45,7 +45,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.util.OperandBoundsComputeHelper;
/**
* @author Jin Liu (jin.liu@soyatec.com)
*/
-public class CustomCombinedFragmentCombinedFragmentCompartmentEditPart extends CombinedFragmentCombinedFragmentCompartmentEditPart {
+public class OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart extends CombinedFragmentCombinedFragmentCompartmentEditPart {
/**
* Children string for notification event type.
@@ -57,7 +57,7 @@ public class CustomCombinedFragmentCombinedFragmentCompartmentEditPart extends C
*
* @param view
*/
- public CustomCombinedFragmentCombinedFragmentCompartmentEditPart(View view) {
+ public OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart(View view) {
super(view);
}
@@ -139,7 +139,7 @@ public class CustomCombinedFragmentCombinedFragmentCompartmentEditPart extends C
if (type.getSemanticHint().equals(viewDescriptor.getSemanticHint())) {
// fix Scroll bars(https://bugs.eclipse.org/bugs/show_bug.cgi?id=364697), note that we use XYLayout
// to relocate both its bounds and combined fragment bounds when operand is added to combined fragment
- OperandBoundsComputeHelper.addUpdateBoundsForIOCreationCommand(CustomCombinedFragmentCombinedFragmentCompartmentEditPart.this, viewDescriptor, compositeCommand);
+ OperandBoundsComputeHelper.addUpdateBoundsForIOCreationCommand(OLDCustomCombinedFragmentCombinedFragmentCompartmentEditPart.this, viewDescriptor, compositeCommand);
}
}
return new ICommandProxy(compositeCommand.reduce());
@@ -154,8 +154,8 @@ public class CustomCombinedFragmentCombinedFragmentCompartmentEditPart extends C
@Override
protected EditPart createChild(Object model) {
EditPart child = super.createChild(model);
- if (getChildren() == null || getChildren().isEmpty() && child instanceof CustomInteractionOperandEditPart) {
- ((CustomInteractionOperandEditPart) child).setFirstOperand(true);
+ if (getChildren() == null || getChildren().isEmpty() && child instanceof OLDCustomInteractionOperandEditPart) {
+ ((OLDCustomInteractionOperandEditPart) child).setFirstOperand(true);
}
return child;
}
@@ -174,11 +174,11 @@ public class CustomCombinedFragmentCombinedFragmentCompartmentEditPart extends C
List<?> children = getChildren();
if (children != null && children.size() > 1) {
Object firstChild = children.get(0);
- if (firstChild instanceof CustomInteractionOperandEditPart) {
- CustomInteractionOperandEditPart firstOperandChild = (CustomInteractionOperandEditPart) firstChild;
+ if (firstChild instanceof OLDCustomInteractionOperandEditPart) {
+ OLDCustomInteractionOperandEditPart firstOperandChild = (OLDCustomInteractionOperandEditPart) firstChild;
Object firstChildModel = firstOperandChild.getModel();
- if (firstChildModel != null && firstChildModel.equals(event.getOldValue()) && children.get(1) instanceof CustomInteractionOperandEditPart) {
- CustomInteractionOperandEditPart secondOperandChild = (CustomInteractionOperandEditPart) children.get(1);
+ if (firstChildModel != null && firstChildModel.equals(event.getOldValue()) && children.get(1) instanceof OLDCustomInteractionOperandEditPart) {
+ OLDCustomInteractionOperandEditPart secondOperandChild = (OLDCustomInteractionOperandEditPart) children.get(1);
secondOperandChild.setFirstOperand(true);
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java
index cbed6655e7a..efc5b065d19 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomCombinedFragmentEditPart.java
@@ -289,13 +289,13 @@ public class OLDCustomCombinedFragmentEditPart extends CombinedFragmentEditPart
return super.addFixedChild(childEditPart);
}
- public List<CustomInteractionOperandEditPart> getOperandChildrenEditParts() {
- List<CustomInteractionOperandEditPart> children = new LinkedList<CustomInteractionOperandEditPart>();
+ public List<OLDCustomInteractionOperandEditPart> getOperandChildrenEditParts() {
+ List<OLDCustomInteractionOperandEditPart> children = new LinkedList<OLDCustomInteractionOperandEditPart>();
IGraphicalEditPart compartment = getChildBySemanticHint(String.valueOf(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID));
if (compartment instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
for (Object ep : compartment.getChildren()) {
- if (ep instanceof CustomInteractionOperandEditPart) {
- children.add((CustomInteractionOperandEditPart) ep);
+ if (ep instanceof OLDCustomInteractionOperandEditPart) {
+ children.add((OLDCustomInteractionOperandEditPart) ep);
}
}
}
@@ -342,7 +342,7 @@ public class OLDCustomCombinedFragmentEditPart extends CombinedFragmentEditPart
* }
*/
// update guards on enclosed operands
- for (CustomInteractionOperandEditPart ioep : getOperandChildrenEditParts()) {
+ for (OLDCustomInteractionOperandEditPart ioep : getOperandChildrenEditParts()) {
ioep.updateConstraintLabel();
}
} else if (UMLPackage.eINSTANCE.getCombinedFragment_Operand().equals(feature)) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java
index 2a691b5c956..ff73eb07c19 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomInteractionOperandEditPart.java
@@ -111,8 +111,9 @@ import org.eclipse.uml2.uml.ValueSpecification;
/**
* @author Jin Liu (jin.liu@soyatec.com)
+ * @deprecated
*/
-public class CustomInteractionOperandEditPart extends InteractionOperandEditPart implements ITextAwareEditPart {
+public class OLDCustomInteractionOperandEditPart extends InteractionOperandEditPart implements ITextAwareEditPart {
/**
* Notfier for listen and unlistend model element.
@@ -130,7 +131,7 @@ public class CustomInteractionOperandEditPart extends InteractionOperandEditPart
*
* @param view
*/
- public CustomInteractionOperandEditPart(View view) {
+ public OLDCustomInteractionOperandEditPart(View view) {
super(view);
}
@@ -174,7 +175,7 @@ public class CustomInteractionOperandEditPart extends InteractionOperandEditPart
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CombinedFragmentCreationEditPolicy());
+ //installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CombinedFragmentCreationEditPolicy());
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new GuardConditionDirectEditPolicy());
removeEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE);
// display stereotype
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
index b3d1dfdc57c..5875c04bfcc 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandAppliedStereotypeLabelDisplayEditPolicy.java
@@ -19,7 +19,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeNamedElementFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart.GuardFigure;
import org.eclipse.swt.graphics.Image;
@@ -33,10 +33,10 @@ public class InteractionOperandAppliedStereotypeLabelDisplayEditPolicy extends A
@Override
protected void refreshStereotypeDisplay() {
EditPart host = getHost();
- if (!(host instanceof CustomInteractionOperandEditPart)) {
+ if (!(host instanceof OLDCustomInteractionOperandEditPart)) {
return;
}
- IGraphicalEditPart guard = ((CustomInteractionOperandEditPart) host).getChildBySemanticHint(InteractionOperandGuardEditPart.GUARD_TYPE);
+ IGraphicalEditPart guard = ((OLDCustomInteractionOperandEditPart) host).getChildBySemanticHint(InteractionOperandGuardEditPart.GUARD_TYPE);
if (!(guard instanceof InteractionOperandGuardEditPart)) {
return;
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/InteractionOperandFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/InteractionOperandFigure.java
index eb9f908f255..c43bc9bf854 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/InteractionOperandFigure.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/InteractionOperandFigure.java
@@ -14,10 +14,13 @@
package org.eclipse.papyrus.uml.diagram.sequence.figures;
import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.XYLayout;
+import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure;
public class InteractionOperandFigure extends RoundedCompartmentFigure {
@@ -71,4 +74,29 @@ public class InteractionOperandFigure extends RoundedCompartmentFigure {
fInteractionConstraintLabel.setText("");
this.add(fInteractionConstraintLabel, new Rectangle(10,10,200,20));
}
+ /**
+ * @see org.eclipse.draw2d.Figure#getMinimumSize(int, int)
+ *
+ * @param wHint
+ * @param hHint
+ * @return
+ */
+ @Override
+ public Dimension getMinimumSize(int wHint, int hHint) {
+ // TODO Auto-generated method stub
+ Dimension dim= super.getMinimumSize(wHint, hHint);
+ //look for combinedFragmentFigure
+ IFigure cfFigure=getParent();
+ while (!(cfFigure instanceof CombinedFragmentFigure)) {
+ cfFigure= cfFigure.getParent();
+ }
+ if (cfFigure==null){
+ return dim;
+ }
+ Rectangle ccfbound=cfFigure.getBounds();
+ if( ccfbound.width!=-1){
+ return new Dimension(ccfbound.width,dim.height );
+ }
+ return dim;
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
index 4461c75d6cb..d5d57c9abfa 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomEditPartProvider.java
@@ -64,11 +64,11 @@ public class CustomEditPartProvider extends UMLEditPartProvider {
// return new CustomConsiderIgnoreFragmentEditPart(view);
case CombinedFragmentEditPart.VISUAL_ID:
return new CCombinedFragmentEditPart(view);
- // case CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID:
- // return new CCombinedCompartmentEditPart(view);
+ case CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID:
+ return new CCombinedFragmentCombinedFragmentCompartmentEditPart(view);
-// case InteractionOperandEditPart.VISUAL_ID:
-// return new CustomInteractionOperandEditPart(view);
+ case InteractionOperandEditPart.VISUAL_ID:
+ return new CInteractionOperandEditPart(view);
// case InteractionUseEditPart.VISUAL_ID:
// return new CustomInteractionUseEditPart(view);
// case InteractionUseNameEditPart.VISUAL_ID:
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
index 8dfd5a56d79..ade2e278ee6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/CustomViewProvider.java
@@ -227,9 +227,9 @@ public class CustomViewProvider extends UMLViewProvider {
Node compartment = createCompartment(node,UMLVisualIDRegistry.getType(CombinedFragmentCombinedFragmentCompartmentEditPart.VISUAL_ID),
false, false, true, true);
// Add by default InteractionOperand
- for (InteractionOperand interactionOperand : ((CombinedFragment) domainElement).getOperands()) {
- createInteractionOperand_Shape(interactionOperand, compartment, -1, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
- }
+// for (InteractionOperand interactionOperand : ((CombinedFragment) domainElement).getOperands()) {
+// createInteractionOperand_Shape(interactionOperand, compartment, -1, true, UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+// }
// initialization for the compartment visibility
PreferenceInitializerForElementHelper.initCompartmentsStatusFromPrefs(
node, prefStore, "CombinedFragment");
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java
index 50e32f84fd0..44bd9d4e636 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/PostEditPolicyProvider.java
@@ -26,7 +26,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPa
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomContinuationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDestructionOccurrenceSpecificationEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomStateInvariantEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomTimeConstraintLabelEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomTimeObservationLabelEditPart;
@@ -98,7 +98,7 @@ public class PostEditPolicyProvider implements IEditPolicyProvider {
// Replace AppliedStereotypeCommentCreationEditPolicy to a custom one.
if (editPart instanceof AbstractExecutionSpecificationEditPart || editPart instanceof CustomDestructionOccurrenceSpecificationEditPart || editPart instanceof CustomDurationConstraintEditPart || editPart instanceof CustomDurationConstraintEditPart
|| editPart instanceof CustomStateInvariantEditPart || editPart instanceof CustomTimeConstraintLabelEditPart || editPart instanceof CustomTimeObservationLabelEditPart || editPart instanceof AbstractMessageEditPart
- || editPart instanceof GeneralOrderingEditPart || editPart instanceof CustomContinuationEditPart || editPart instanceof CustomInteractionOperandEditPart || editPart instanceof GateEditPart) {
+ || editPart instanceof GeneralOrderingEditPart || editPart instanceof CustomContinuationEditPart || editPart instanceof OLDCustomInteractionOperandEditPart || editPart instanceof GateEditPart) {
editPart.installEditPolicy(AppliedStereotypeCommentEditPolicy.APPLIED_STEREOTYPE_COMMENT, new AppliedStereotypeCommentCreationEditPolicyEx());
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/BoundForEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/BoundForEditPart.java
index 68def20213e..e36f9bace7e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/BoundForEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/BoundForEditPart.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2017 CEA LIST and others.
+ * Copyright (c) 2017 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -17,6 +17,7 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
/**
* @author PT202707
@@ -24,31 +25,37 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditP
*/
public class BoundForEditPart {
- protected static Bounds getBounds(Node node){
+ public static Bounds getBounds(Node node){
return (Bounds) node.getLayoutConstraint();
}
public static int getHeightFromView(Node node){
Bounds bounds=BoundForEditPart.getBounds(node);
- if( bounds.getHeight()!=-1){
+ if( bounds!=null&& bounds.getHeight()!=-1){
return bounds.getHeight();
}
else{
if (node.getType().equals(CombinedFragmentEditPart.VISUAL_ID)){
return 40;
}
+ if (node.getType().equals(InteractionOperandEditPart.VISUAL_ID)){
+ return 40;
+ }
return 100;
}
}
public static int getWidthFromView(Node node){
Bounds bounds=BoundForEditPart.getBounds(node);
- if( bounds.getWidth()!=-1){
- return bounds.getHeight();
+ if(bounds!=null&& bounds.getWidth()!=-1){
+ return bounds.getWidth();
}
else{
if (node.getType().equals(CombinedFragmentEditPart.VISUAL_ID)){
return 40;
}
+ if (node.getType().equals(InteractionOperandEditPart.VISUAL_ID)){
+ return 100;
+ }
return 100;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectCombinedFragmentToGrillingEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectCombinedFragmentToGrillingEditPolicy.java
deleted file mode 100644
index a80b9b0e5c7..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectCombinedFragmentToGrillingEditPolicy.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
-
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.IdentityAnchor;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CCombinedCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CCombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomActionExecutionSpecificationEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExecutionSpecification;
-
-/**
- * @author PT202707
- *
- */
-public class ConnectCombinedFragmentToGrillingEditPolicy extends GraphicalEditPolicyEx implements AutomaticNotationEditPolicy, NotificationListener, IGrillingEditpolicy {
-
- protected GrillingEditpart grillingCompartment=null;
-
- public static String CONNECT_TO_GRILLING_MANAGEMENT="CONNECT_TO_GRILLING_MANAGEMENT";
-
- protected View rowStart=null;
- protected View rowFinish=null;
- protected View columnStart=null;
- protected View columnFinish=null;
-
- /**
- * Constructor.
- *
- */
- public ConnectCombinedFragmentToGrillingEditPolicy() {
- }
-
- /**
- * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate()
- *
- */
- @Override
- public void activate() {
- super.activate();
- getDiagramEventBroker().addNotificationListener(((EObject)getHost().getModel()), this);
- DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- Bounds bounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
- try{
- GrillingManagementEditPolicy grilling=(GrillingManagementEditPolicy)diagramEditPart.getEditPolicy(GrillingManagementEditPolicy.GRILLING_MANAGEMENT);
- grilling.cleanUnusedRowAndColumn();
- CombinedFragment combined=(CombinedFragment) ((GraphicalEditPart)getHost()).resolveSemanticElement();
- if (grilling!=null){
- PrecisionRectangle p=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
- rowStart=grilling.getRowTolisten(p.y(), combined);
- columnStart=grilling.getColumnTolisten(p.y(), combined);
- getDiagramEventBroker().addNotificationListener(rowStart, this);
- getDiagramEventBroker().addNotificationListener(columnStart, this);
- if( bounds.getHeight()!=-1){
- rowFinish=grilling.getRowTolisten(p.y()+bounds.getHeight(), combined);
- }
- else{
- rowFinish=grilling.getRowTolisten(p.y()+CCombinedFragmentEditPart.DEFAULT_HEIGHT, combined);
- }
-
- if( bounds.getWidth()!=-1){
- rowFinish=grilling.getColumnTolisten(p.x()+bounds.getWidth(), combined);
- }
- else{
- rowFinish=grilling.getColumnTolisten(p.x()+CCombinedFragmentEditPart.DEFAULT_WIDTH, combined);
- }
- getDiagramEventBroker().addNotificationListener(rowStart, this);
-
-
-
- }
- }catch (NoGrillElementFound e) {
- UMLDiagramEditorPlugin.log.error(e);
- }
-
- }
-
- /* Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (null != theEditingDomain) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
- }
-
-
- /**
- * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#deactivate()
- *
- */
- @Override
- public void deactivate() {
- getDiagramEventBroker().removeNotificationListener(((EObject)getHost().getModel()), this);
- super.deactivate();
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- @Override
- public void notifyChanged(Notification notification) {
- //Display imprecision
- int displayImprecision=2;
- GrillingManagementEditPolicy grilling=null;
- getDiagramEventBroker().addNotificationListener(((EObject)getHost().getModel()), this);
- DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- try{
- grilling=(GrillingManagementEditPolicy)diagramEditPart.getEditPolicy(GrillingManagementEditPolicy.GRILLING_MANAGEMENT);
- }catch (Exception e) {
- }
-
- Node nodeContainer=(Node)(((GraphicalEditPart)getHost()).getNotationView()).eContainer();
- PrecisionRectangle originPosition= NotationHelper.getAbsoluteBounds(nodeContainer);
- Bounds bounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
-
-
- //the ROW has changed so we must update the position of the combined fragment
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(rowStart))){
- //The grill is in absolute
- Location boundsRow=(Location) ((Node)rowStart).getLayoutConstraint();
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Row", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Point(bounds.getX(),boundsRow.getY()-originPosition.y()+displayImprecision ))));
- }
- //the COLUMN has changed so we must update the postion of the combined fragment
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(columnStart))){
- //The grill is in absolute
- Location boundsRow=(Location) ((Node)columnStart).getLayoutConstraint();
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Point(bounds.getX(),boundsRow.getY()-originPosition.y()+displayImprecision ))));
- }
- //the size has change
- // we must update all links.
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Bounds && (((EObject)notification.getNotifier()).eContainer().equals(((EObject)getHost().getModel())))){
- PrecisionRectangle p=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
-
-
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Height())){
- grilling.setRespectMargin(true);
- int newPosition=p.y()+notification.getNewIntValue()-displayImprecision;
- grilling.updateYpositionForRow((DecorationNode) rowFinish, p.y()+notification.getNewIntValue()-displayImprecision);
- // execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Row finish", new EObjectAdapter( rowFinish),
- // new Point(0,p.y()+notification.getNewIntValue()-displayImprecision))));
-
-
- }
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_Y())){
-
- ExecutionSpecification exec=(ExecutionSpecification) ((GraphicalEditPart)getHost()).resolveSemanticElement();
- getDiagramEventBroker().removeNotificationListener(rowStart, this);
- grilling.dissociateViewToGrill(rowStart, exec.getStart());
- //Set the coordinate in absolute
- try {
- rowStart=grilling.getRowTolisten(p.y(), exec.getStart());
- getDiagramEventBroker().addNotificationListener(rowStart, this);
- grilling.updateYpositionForRow((DecorationNode) rowFinish, p.y()+p.height-displayImprecision);
- } catch (Exception e) {
- // TODO: handle exception
- }
- }
- }
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectEdgeToGrillingEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectEdgeToGrillingEditPolicy.java
index a523c35bea1..a49cc56c368 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectEdgeToGrillingEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectEdgeToGrillingEditPolicy.java
@@ -89,7 +89,7 @@ public class ConnectEdgeToGrillingEditPolicy extends GraphicalEditPolicyEx imple
PrecisionRectangle bounds= NotationHelper.getAbsoluteBounds((Node)viewsr);
double localY=(bounds.preciseHeight()*ypercent);
double absoluteY=localY+bounds.preciseY();
- rowSource=grilling.getRowTolisten((int)absoluteY,m.getSendEvent());
+ rowSource=grilling.getorCreateRowTolisten((int)absoluteY,m.getSendEvent());
getDiagramEventBroker().addNotificationListener(rowTarget, this);
//target
@@ -98,7 +98,7 @@ public class ConnectEdgeToGrillingEditPolicy extends GraphicalEditPolicyEx imple
bounds= NotationHelper.getAbsoluteBounds((Node)viewtg);
localY=(bounds.preciseHeight()*ypercent);
absoluteY=localY+bounds.preciseY();
- rowTarget=grilling.getRowTolisten((int)absoluteY,m.getReceiveEvent());
+ rowTarget=grilling.getorCreateRowTolisten((int)absoluteY,m.getReceiveEvent());
getDiagramEventBroker().addNotificationListener(rowTarget, this);
}
@@ -150,7 +150,7 @@ public class ConnectEdgeToGrillingEditPolicy extends GraphicalEditPolicyEx imple
try{
GrillingManagementEditPolicy grilling=(GrillingManagementEditPolicy)diagramEditPart.getEditPolicy(GrillingManagementEditPolicy.GRILLING_MANAGEMENT);
if (grilling!=null){
- rowSource=grilling.getRowTolisten(anchorY,m.getSendEvent());
+ rowSource=grilling.getorCreateRowTolisten(anchorY,m.getSendEvent());
getDiagramEventBroker().addNotificationListener(rowSource, this);
}
@@ -169,7 +169,7 @@ public class ConnectEdgeToGrillingEditPolicy extends GraphicalEditPolicyEx imple
try{
GrillingManagementEditPolicy grilling=(GrillingManagementEditPolicy)diagramEditPart.getEditPolicy(GrillingManagementEditPolicy.GRILLING_MANAGEMENT);
if (grilling!=null){
- rowTarget=grilling.getRowTolisten(anchorY, m.getReceiveEvent());
+ rowTarget=grilling.getorCreateRowTolisten(anchorY, m.getReceiveEvent());
getDiagramEventBroker().addNotificationListener(rowTarget, this);
}
}catch (NoGrillElementFound e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectExecutionNodeToGrillingEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectExecutionNodeToGrillingEditPolicy.java
index 30cd6f1554f..8b1a9d29742 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectExecutionNodeToGrillingEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectExecutionNodeToGrillingEditPolicy.java
@@ -81,13 +81,13 @@ public class ConnectExecutionNodeToGrillingEditPolicy extends GraphicalEditPolic
ExecutionSpecification exec=(ExecutionSpecification) ((GraphicalEditPart)getHost()).resolveSemanticElement();
if (grilling!=null){
PrecisionRectangle p=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
- rowStart=grilling.getRowTolisten(p.y(), exec.getStart());
+ rowStart=grilling.getorCreateRowTolisten(p.y(), exec.getStart());
getDiagramEventBroker().addNotificationListener(rowStart, this);
if( bounds.getHeight()!=-1){
- rowFinish=grilling.getRowTolisten(p.y()+bounds.getHeight(), exec.getFinish());
+ rowFinish=grilling.getorCreateRowTolisten(p.y()+bounds.getHeight(), exec.getFinish());
}
else{
- rowFinish=grilling.getRowTolisten(p.y()+CustomActionExecutionSpecificationEditPart.DEFAULT_HEIGHT, exec.getFinish());
+ rowFinish=grilling.getorCreateRowTolisten(p.y()+CustomActionExecutionSpecificationEditPart.DEFAULT_HEIGHT, exec.getFinish());
}
getDiagramEventBroker().addNotificationListener(rowStart, this);
@@ -176,7 +176,6 @@ public class ConnectExecutionNodeToGrillingEditPolicy extends GraphicalEditPolic
for (Edge edge : targetEdge) {
updateAnchorFromHeight(edge,((Node)getHost().getModel()),notification.getNewIntValue()- notification.getOldIntValue());
}
-
}
if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_Y())){
@@ -185,7 +184,7 @@ public class ConnectExecutionNodeToGrillingEditPolicy extends GraphicalEditPolic
grilling.dissociateViewToGrill(rowStart, exec.getStart());
//Set the coordinate in absolute
try {
- rowStart=grilling.getRowTolisten(p.y(), exec.getStart());
+ rowStart=grilling.getorCreateRowTolisten(p.y(), exec.getStart());
getDiagramEventBroker().addNotificationListener(rowStart, this);
grilling.updateYpositionForRow((DecorationNode) rowFinish, p.y()+p.height-displayImprecision);
} catch (Exception e) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectInteractionOperandToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectInteractionOperandToGridEditPolicy.java
new file mode 100644
index 00000000000..fa3becabdca
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectInteractionOperandToGridEditPolicy.java
@@ -0,0 +1,119 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
+
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * this editpolicy is overloaded because the width of the interaction operand is managed by the editpartparent
+ *
+ */
+public class ConnectInteractionOperandToGridEditPolicy extends ConnectNodeToGridEditPolicy{
+
+ private CombinedFragmentEditPart combinedFragmentEditPart;
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#activate()
+ *
+ */
+ @Override
+ public void activate() {
+ //the parent is the compartment of combinedFragment so we look for its great parent
+ if( getHost().getParent() instanceof CombinedFragmentCombinedFragmentCompartmentEditPart){
+ if(getHost().getParent().getParent() instanceof CombinedFragmentEditPart){
+ combinedFragmentEditPart = (CombinedFragmentEditPart)getHost().getParent().getParent();
+ getDiagramEventBroker().addNotificationListener(combinedFragmentEditPart.getNotationView(), this);
+ }
+ }
+ super.activate();
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#deactivate()
+ *
+ */
+ @Override
+ public void deactivate() {
+ if( combinedFragmentEditPart!=null){
+ getDiagramEventBroker().removeNotificationListener(combinedFragmentEditPart.getNotationView(), this);
+ }
+ super.deactivate();
+ }
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#initListeningColumnFinish(org.eclipse.gmf.runtime.notation.Node, org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GrillingManagementEditPolicy, org.eclipse.uml2.uml.Element, org.eclipse.draw2d.geometry.PrecisionRectangle)
+ *
+ * @param node
+ * @param grilling
+ * @param element
+ * @param bounds
+ * @throws NoGrillElementFound
+ */
+ @Override
+ protected void initListeningColumnFinish(Node node, GrillingManagementEditPolicy grilling, Element element, PrecisionRectangle bounds) throws NoGrillElementFound {
+ if(combinedFragmentEditPart!=null){
+ Node cfNode=(Node)combinedFragmentEditPart.getNotationView();
+ columnFinish=grilling.getorCreateColumnTolisten(bounds.x+BoundForEditPart.getWidthFromView(cfNode), element);
+ getDiagramEventBroker().addNotificationListener(columnFinish, this);
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#updateColumFinishFromWitdhNotification(org.eclipse.draw2d.geometry.PrecisionRectangle)
+ *
+ * @param notationBound
+ */
+ @Override
+ protected void updateColumFinishFromWitdhNotification(PrecisionRectangle notationBound) {
+ if( combinedFragmentEditPart!=null){
+ Node cfNode=(Node)combinedFragmentEditPart.getNotationView();
+ int newX=notationBound.x+BoundForEditPart.getWidthFromView(cfNode);
+ updatePositionGridAxis(columnFinish, newX,0);
+ }
+ }
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ super.notifyChanged(notification);
+ if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Bounds && (((EObject)notification.getNotifier()).eContainer().equals(combinedFragmentEditPart.getNotationView()))){
+ PrecisionRectangle bounds=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
+ if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Width())){
+ updateColumFinishFromWitdhNotification(bounds);
+ }
+ }
+ }
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#updateWidthFromAxisNotification(org.eclipse.draw2d.geometry.PrecisionRectangle, org.eclipse.gmf.runtime.notation.Bounds)
+ *
+ * @param originPosition
+ * @param currentBounds
+ */
+ @Override
+ protected void updateWidthFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
+ //do nothing
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectLifeLineToGrillingEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectLifeLineToGrillingEditPolicy.java
index d92dd5d663e..156f33275eb 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectLifeLineToGrillingEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectLifeLineToGrillingEditPolicy.java
@@ -13,47 +13,21 @@
package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
-import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.IdentityAnchor;
-import org.eclipse.gmf.runtime.notation.Location;
import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.uml2.uml.Element;
/**
- * @author PT202707
+ * This editPolicy is specific for the Lifeline
+ * The size of the lifeline is not taken is account
*
*/
-public class ConnectLifeLineToGrillingEditPolicy extends ConnectToGridEditPolicy implements AutomaticNotationEditPolicy, NotificationListener, IGrillingEditpolicy {
+public class ConnectLifeLineToGrillingEditPolicy extends ConnectNodeToGridEditPolicy {
protected GrillingEditpart grillingCompartment=null;
- public static String CONNECT_TO_GRILLING_MANAGEMENT="CONNECT_TO_GRILLING_MANAGEMENT";
protected DecorationNode rowStart=null;
protected DecorationNode columnStart=null;
@@ -65,194 +39,77 @@ public class ConnectLifeLineToGrillingEditPolicy extends ConnectToGridEditPolicy
public ConnectLifeLineToGrillingEditPolicy() {
}
+
/**
- * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate()
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#initListeningColumnFinish(org.eclipse.gmf.runtime.notation.Node, org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GrillingManagementEditPolicy, org.eclipse.draw2d.geometry.PrecisionRectangle, org.eclipse.uml2.uml.Element, org.eclipse.draw2d.geometry.PrecisionRectangle)
*
+ * @param node
+ * @param grilling
+ * @param originPosition
+ * @param element
+ * @param p
+ * @throws NoGrillElementFound
*/
@Override
- public void activate() {
- super.activate();
- getDiagramEventBroker().addNotificationListener(((EObject)getHost().getModel()), this);
- DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- try{
- GrillingManagementEditPolicy grilling=(GrillingManagementEditPolicy)diagramEditPart.getEditPolicy(GrillingManagementEditPolicy.GRILLING_MANAGEMENT);
- grilling.cleanUnusedRowAndColumn();
- if (grilling!=null){
- rowStart=(DecorationNode)grilling.getRowTolisten( (Node)((GraphicalEditPart)getHost()).getNotationView(), (Element)((GraphicalEditPart)getHost()).resolveSemanticElement());
- getDiagramEventBroker().addNotificationListener(rowStart, this);
-
- columnStart=(DecorationNode)grilling.getColumnTolisten((Node)((GraphicalEditPart)getHost()).getNotationView(),(Element)((GraphicalEditPart)getHost()).resolveSemanticElement());
- getDiagramEventBroker().addNotificationListener(columnStart, this);
-
-
- }
- }catch (NoGrillElementFound e) {
- UMLDiagramEditorPlugin.log.error(e);
- }
-
+ protected void initListeningColumnFinish(Node node, GrillingManagementEditPolicy grilling, Element element, PrecisionRectangle p) throws NoGrillElementFound {
+ //the ColumnFinish is not listen
}
-
- /* Gets the diagram event broker from the editing domain.
+
+ /**
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#initListeningRowFinish(org.eclipse.gmf.runtime.notation.Node, org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GrillingManagementEditPolicy, org.eclipse.draw2d.geometry.PrecisionRectangle, org.eclipse.uml2.uml.Element, org.eclipse.draw2d.geometry.PrecisionRectangle)
*
- * @return the diagram event broker
+ * @param node
+ * @param grilling
+ * @param originPosition
+ * @param element
+ * @param p
+ * @throws NoGrillElementFound
*/
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (null != theEditingDomain) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
+ @Override
+ protected void initListeningRowFinish(Node node, GrillingManagementEditPolicy grilling, Element element, PrecisionRectangle p) throws NoGrillElementFound {
+ //the RowFinish is not listen
}
/**
- * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#deactivate()
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#updateWidthFromAxisNotification(org.eclipse.draw2d.geometry.PrecisionRectangle, org.eclipse.gmf.runtime.notation.Bounds)
*
+ * @param originPosition
+ * @param currentBounds
*/
@Override
- public void deactivate() {
- getDiagramEventBroker().removeNotificationListener(((EObject)getHost().getModel()), this);
- super.deactivate();
+ protected void updateWidthFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
+ //the ColumnFinish is not listen
}
+
/**
- * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#updateColumFinishFromWitdhNotification(org.eclipse.draw2d.geometry.PrecisionRectangle)
*
- * @param notification
+ * @param notationBound
*/
@Override
- public void notifyChanged(Notification notification) {
- //the ROW has changed
- Node nodeContainer=(Node)(((GraphicalEditPart)getHost()).getNotationView()).eContainer();
- PrecisionRectangle originPosition= NotationHelper.getAbsoluteBounds(nodeContainer);
- Bounds currentBounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
-
- //the ROW has changed so we must update the position of the combined fragment
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(rowStart))){
- //The grill is in absolute
- //compute next position for View.bound.y
- Location boundsRow=(Location) ((Node)rowStart).getLayoutConstraint();
- int newY=boundsRow.getY()-originPosition.y();
- updateNodePositionOfControler(currentBounds.getX(), newY);
- }
- //the COLUMN has changed so we must update the postion of the combined fragment
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(columnStart))){
- //The grill is in absolute
- Location boundsColumn=(Location) ((Node)columnStart).getLayoutConstraint();
- int newX=boundsColumn.getX()-originPosition.x();
- updateNodePositionOfControler(newX, currentBounds.getY());
-
- }
-
- //the size has change
- // we must update all links.
- //UPDATE COLUM AND ROW of THE GRID
- if( notification.getEventType()==notification.SET && notification.getNotifier() instanceof Bounds && (((EObject)notification.getNotifier()).eContainer().equals(((EObject)getHost().getModel())))){
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Height())){
- Node node=(Node)this.getHost().getModel();
- java.util.List<Edge> sourceEdge= node.getSourceEdges();
- for (Edge edge : sourceEdge) {
- updateAnchorFromHeight(edge,((Node)getHost().getModel()),notification.getNewIntValue()- notification.getOldIntValue());
- }
- java.util.List<Edge> targetEdge= node.getTargetEdges();
- for (Edge edge : targetEdge) {
- updateAnchorFromHeight(edge,((Node)getHost().getModel()),notification.getNewIntValue()- notification.getOldIntValue());
- }
-
- }
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_Y())){
- int newY=notification.getNewIntValue()+originPosition.y();
- updatePositionGridAxis(rowStart, 0, newY);
- Node node=(Node)this.getHost().getModel();
- java.util.List<Edge> sourceEdge= node.getSourceEdges();
- for (Edge edge : sourceEdge) {
- updateAnchorFromY(edge,((Node)getHost().getModel()),notification.getOldIntValue(),notification.getNewIntValue());
- }
- java.util.List<Edge> targetEdge= node.getTargetEdges();
- for (Edge edge : targetEdge) {
- updateAnchorFromY(edge,((Node)getHost().getModel()),notification.getOldIntValue(),notification.getNewIntValue());
- }
-
- }
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_X())){
- //compute next position for RowStart
- int newX=notification.getNewIntValue()+originPosition.x();
- updatePositionGridAxis(columnStart, newX, 0);
-
- }
- }
-
+ protected void updateColumFinishFromWitdhNotification(PrecisionRectangle notationBound) {
+ //the ColumnFinish is not listen
}
-
/**
- * @param sourceEdge
- * @param eObject
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#updateRowFinishStartFromHeightNotification(org.eclipse.draw2d.geometry.PrecisionRectangle)
+ *
+ * @param p
*/
- private void updateAnchorFromHeight(Edge edge, Node node, int deltaHeight) {
- IdentityAnchor anchor=null;
- if (edge.getSource().equals(node)){
- anchor=(IdentityAnchor)edge.getSourceAnchor();
- }
- else{
- anchor=(IdentityAnchor)edge.getTargetAnchor();
- }
- double yPercent=IdentityAnchorHelper.getYPercentage(anchor);
- double xPercent=IdentityAnchorHelper.getXPercentage(anchor);
-
- //calculate bounds from notation
- PrecisionRectangle bounds= NotationHelper.getAbsoluteBounds(node);
- double oldSize=bounds.preciseHeight()-deltaHeight;
- if( oldSize==-1.0){
- //it is very bad , because this is a default valued given by the figure...
- if( getHost() instanceof CLifeLineEditPart){
- oldSize=CLifeLineEditPart.DEFAUT_HEIGHT;
- }
- }
-
- double newPercentY = (yPercent*oldSize)/(bounds.preciseHeight());
- if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) {
- final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY);
- execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
- }
+ @Override
+ protected void updateRowFinishFromHeightNotification(PrecisionRectangle p) {
+ //the RowFinish is not listen
}
/**
- * @param sourceEdge
- * @param eObject
+ * @see org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy#updateHeightFromAxisNotification(org.eclipse.draw2d.geometry.PrecisionRectangle, org.eclipse.gmf.runtime.notation.Bounds)
+ *
+ * @param originPosition
+ * @param currentBounds
*/
- private void updateAnchorFromY(Edge edge, Node node, int oldY, int newY) {
- IdentityAnchor anchor=null;
- if (edge.getSource().equals(node)){
- anchor=(IdentityAnchor)edge.getSourceAnchor();
- }
- else{
- anchor=(IdentityAnchor)edge.getTargetAnchor();
- }
- if(!anchor.getId().trim().equals("")){
- double yPercent=IdentityAnchorHelper.getYPercentage(anchor);
- double xPercent=IdentityAnchorHelper.getXPercentage(anchor);
-
- //calculate bounds from notation
- PrecisionRectangle bounds= NotationHelper.getAbsoluteBounds(node);
- double height=bounds.preciseHeight();
- if( height==-1.0){
- //it is very bad , because this is a default valued given by the figure...
- if( getHost() instanceof CLifeLineEditPart){
- height=CLifeLineEditPart.DEFAUT_HEIGHT;
- }
- }
-
- double newPercentY = (oldY-newY)/(height)+yPercent;
- if(newPercentY<0){
- newPercentY=0.1;
- }
- if(newPercentY>1){
- newPercentY=0.9;
- }
- if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) {
- final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY);
- execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
- }
- }
+ @Override
+ protected void updateHeightFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
+ //theRowfinish is not Listen
}
-
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGridEditPolicy.java
index 8eb616a8e9a..da78d5ce56f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGridEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGridEditPolicy.java
@@ -16,6 +16,7 @@ package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
@@ -24,11 +25,15 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.DecorationNode;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.IdentityAnchor;
import org.eclipse.gmf.runtime.notation.Location;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
import org.eclipse.uml2.uml.Element;
@@ -56,6 +61,7 @@ public class ConnectNodeToGridEditPolicy extends ConnectToGridEditPolicy impleme
}
/**
+ * avoid to modify it directly, try to modify call of sub-methods: initListeningXXX
* @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate()
*
*/
@@ -69,27 +75,70 @@ public class ConnectNodeToGridEditPolicy extends ConnectToGridEditPolicy impleme
GrillingManagementEditPolicy grilling=(GrillingManagementEditPolicy)diagramEditPart.getEditPolicy(GrillingManagementEditPolicy.GRILLING_MANAGEMENT);
grilling.cleanUnusedRowAndColumn();
Node nodeContainer=(Node)(((GraphicalEditPart)getHost()).getNotationView()).eContainer();
- PrecisionRectangle originPosition= NotationHelper.getAbsoluteBounds(nodeContainer);
Element element=(Element) ((GraphicalEditPart)getHost()).resolveSemanticElement();
if (grilling!=null){
PrecisionRectangle p=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
- rowStart=grilling.getRowTolisten(originPosition.y+p.y(), element);
- columnStart=grilling.getColumnTolisten(originPosition.x+p.x(), element);
- getDiagramEventBroker().addNotificationListener(rowStart, this);
- getDiagramEventBroker().addNotificationListener(columnStart, this);
- rowFinish=grilling.getRowTolisten(originPosition.y+p.y()+BoundForEditPart.getHeightFromView(node), element);
- getDiagramEventBroker().addNotificationListener(rowFinish, this);
- columnFinish=grilling.getColumnTolisten(originPosition.x+p.x()+BoundForEditPart.getWidthFromView(node), element);
- getDiagramEventBroker().addNotificationListener(columnFinish, this);
-
-
-
+ initListeningRowStart(grilling,element, p);
+ initListeningColumnStart(grilling, element, p);
+ initListeningRowFinish(node, grilling, element, p);
+ initListeningColumnFinish(node, grilling, element, p);
}
}catch (NoGrillElementFound e) {
UMLDiagramEditorPlugin.log.error(e);
}
}
+ /**
+ * this method is called during the activate
+ * It initialize a columnFinish and listen it
+ * @param grilling the grid manager that allow creating rows
+ * @param element the semantic element
+ * @param bounds the absolute position of the current node (the origin of the referencial is the diagram)
+ * @throws NoGrillElementFound
+ */
+ protected void initListeningColumnFinish(Node node, GrillingManagementEditPolicy grilling, Element element, PrecisionRectangle bounds) throws NoGrillElementFound {
+ columnFinish=grilling.getorCreateColumnTolisten(bounds.x+BoundForEditPart.getWidthFromView(node), element);
+ getDiagramEventBroker().addNotificationListener(columnFinish, this);
+ }
+
+ /**
+ * this method is called during the activate
+ * It initialize a rowFinish and listen it
+ * @param grilling the grid manager that allow creating rows
+ * @param element the semantic element
+ * @param bounds the absolute position of the current node (the origin of the referential is the diagram)
+ * @throws NoGrillElementFound
+ */
+ protected void initListeningRowFinish(Node node, GrillingManagementEditPolicy grilling, Element element, PrecisionRectangle bounds) throws NoGrillElementFound {
+ rowFinish=grilling.getorCreateRowTolisten(bounds.y+BoundForEditPart.getHeightFromView(node), element);
+ getDiagramEventBroker().addNotificationListener(rowFinish, this);
+ }
+
+ /**
+ * this method is called during the activate
+ * It initialize a ColumnStart and listen it
+ * @param grilling the grid manager that allow creating rows
+ * @param element the semantic element
+ * @param bounds the absolute position of the current node ( the origin of the referential is the diagram)
+ * @throws NoGrillElementFound
+ */
+ protected void initListeningColumnStart(GrillingManagementEditPolicy grilling, Element element, PrecisionRectangle bounds) throws NoGrillElementFound {
+ columnStart=grilling.getorCreateColumnTolisten(bounds.x(), element);
+ getDiagramEventBroker().addNotificationListener(columnStart, this);
+ }
+
+ /**
+ * this method is called during the activate
+ * It initialize a rowStart and listen it
+ * @param grilling the grid manager that allow creating rows
+ * @param element the semantic element
+ * @param bounds position of the current node in absolute ( the origin is the diagram)
+ * @throws NoGrillElementFound
+ */
+ protected void initListeningRowStart(GrillingManagementEditPolicy grid, Element element, PrecisionRectangle bounds) throws NoGrillElementFound {
+ rowStart=grid.getorCreateRowTolisten(bounds.y, element);
+ getDiagramEventBroker().addNotificationListener(rowStart, this);
+ }
/* Gets the diagram event broker from the editing domain.
*
@@ -111,10 +160,23 @@ public class ConnectNodeToGridEditPolicy extends ConnectToGridEditPolicy impleme
@Override
public void deactivate() {
getDiagramEventBroker().removeNotificationListener(((EObject)getHost().getModel()), this);
+ if(rowStart!=null){
+ getDiagramEventBroker().removeNotificationListener(rowStart, this);
+ }
+ if(columnStart!=null){
+ getDiagramEventBroker().removeNotificationListener(columnStart, this);
+ }
+ if(rowFinish!=null){
+ getDiagramEventBroker().removeNotificationListener(rowFinish, this);
+ }
+ if(columnFinish!=null){
+ getDiagramEventBroker().removeNotificationListener(columnFinish, this);
+ }
super.deactivate();
}
/**
+ * avoid to modify it directly, try to modify call of sub-methods: updateXXX
* @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
*
* @param notification
@@ -122,67 +184,235 @@ public class ConnectNodeToGridEditPolicy extends ConnectToGridEditPolicy impleme
@Override
public void notifyChanged(Notification notification) {
//Display imprecision
+
Node nodeContainer=(Node)(((GraphicalEditPart)getHost()).getNotationView()).eContainer();
- PrecisionRectangle originPosition= NotationHelper.getAbsoluteBounds(nodeContainer);
- Bounds currentBounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
-
- //the ROW has changed so we must update the position of the combined fragment
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(rowStart))){
- //The grill is in absolute
- //compute next position for View.bound.y
- Location boundsRow=(Location) ((Node)rowStart).getLayoutConstraint();
- int newY=boundsRow.getY()-originPosition.y();
- updateNodePositionOfControler(currentBounds.getX(), newY);
+ if( nodeContainer!=null){
+ PrecisionRectangle originPosition= NotationHelper.getAbsoluteBounds(nodeContainer);
+ Bounds currentBounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
+
+ //the ROW has changed so we must update the position of the combined fragment
+ if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(rowStart))){
+ //The grid is in absolute
+ //compute next position for View.bound.y
+ updateYFromAxisNotification(originPosition, currentBounds);
+ }
+ //the COLUMN has changed so we must update the postion of the combined fragment
+ if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(columnStart))){
+ //The grill is in absolute
+ updateXFromAxisNotification(originPosition, currentBounds);
+
+ }
+ if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(rowFinish))){
+ //The grill is in absolute
+ updateHeightFromAxisNotification(originPosition, currentBounds);
+
+ }
+ if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(columnFinish))){
+ //The grill is in absolute
+ updateWidthFromAxisNotification(originPosition, currentBounds);
+
+ }
+
+ //UPDATE COLUM AND ROW of THE GRID
+ if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Bounds){
+ PrecisionRectangle bounds=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
+
+ if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Height())){
+ updateRowFinishFromHeightNotification(bounds);
+ //update acnchors
+ if( (((EObject)notification.getNotifier()).eContainer().equals(((EObject)getHost().getModel())))){
+ Node node=(Node)this.getHost().getModel();
+ java.util.List<Edge> sourceEdge= node.getSourceEdges();
+ for (Edge edge : sourceEdge) {
+ updateAnchorFromHeight(edge,((Node)getHost().getModel()),notification.getNewIntValue()- notification.getOldIntValue());
+ }
+ java.util.List<Edge> targetEdge= node.getTargetEdges();
+ for (Edge edge : targetEdge) {
+ updateAnchorFromHeight(edge,((Node)getHost().getModel()),notification.getNewIntValue()- notification.getOldIntValue());
+ }
+ }
+ }
+ if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Width())){
+ updateColumFinishFromWitdhNotification(bounds);
+ }
+ if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_Y())){
+ //compute next position for RowStart
+ updateRowStartFromYNotification(bounds);
+ //updateAnchors
+ if (((EObject)notification.getNotifier()).eContainer().equals(((EObject)getHost().getModel()))){
+ Node node=(Node)this.getHost().getModel();
+ java.util.List<Edge> sourceEdge= node.getSourceEdges();
+ for (Edge edge : sourceEdge) {
+ updateAnchorFromY(edge,((Node)getHost().getModel()),notification.getOldIntValue(),notification.getNewIntValue());
+ }
+ java.util.List<Edge> targetEdge= node.getTargetEdges();
+ for (Edge edge : targetEdge) {
+ updateAnchorFromY(edge,((Node)getHost().getModel()),notification.getOldIntValue(),notification.getNewIntValue());
+ }
+ }
+ }
+ if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_X())){
+ //compute next position for RowStart
+ updateColumnStartFromXNotification(bounds);
+ }
+ }
}
- //the COLUMN has changed so we must update the postion of the combined fragment
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(columnStart))){
- //The grill is in absolute
- Location boundsColumn=(Location) ((Node)columnStart).getLayoutConstraint();
- int newX=boundsColumn.getX()-originPosition.x();
- updateNodePositionOfControler(newX, currentBounds.getY());
-
+ }
+
+ /**
+ * When the bounds of the notation has change the axis must change
+ * In this case this is the height that has change so rowFinish must change
+ * @param originPosition the position of the node is the relative position ( relative to the container)
+ */
+ protected void updateRowFinishFromHeightNotification(PrecisionRectangle p) {
+ int newY=p.y+p.height;
+ updatePositionGridAxis(rowFinish, 0, newY);
+ }
+
+ /**
+ * When the bounds of the notation has change the axis must change
+ * In this case this is the width that has changed so ColumnFinish must change
+ * @param notationBound the position of the node is the absolute position ( the origin to the referential is the diagram)
+ */
+ protected void updateColumFinishFromWitdhNotification(PrecisionRectangle notationBound) {
+ int newX=notationBound.x+notationBound.width;
+ updatePositionGridAxis(columnFinish, newX,0);
+ }
+
+ /**
+ * When the bounds of the notation has change the axis must change
+ * In this case this is the position Y that has change so RowStart must change
+ * @param bounds the position of the node is the absolute position ( the origin to the referential is the diagram)
+ */
+ protected void updateRowStartFromYNotification(PrecisionRectangle bounds) {
+ int newY=bounds.y();
+ updatePositionGridAxis(rowStart, 0, newY);
+ }
+
+ /**
+ * When the bounds of the notation has change the axis must change
+ * In this case this is the position X that has change so ColumnStart must change
+ @param bounds the position of the node is the absolute position ( the origin to the referential is the diagram)
+ */
+ protected void updateColumnStartFromXNotification(PrecisionRectangle bounds) {
+ int newX=bounds.x();
+ updatePositionGridAxis(columnStart, newX, 0);
+ }
+ /**
+ * When the axis columnFinish has changed , the width of the controler has to change
+ * @param originPosition the position of the container in absolute (origin the diagram)
+ * @param currentBounds the current position of the node (relative to the container)
+ */
+ protected void updateWidthFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
+ Location boundsColumn=(Location) ((Node)columnFinish).getLayoutConstraint();
+ int newX=boundsColumn.getX()-originPosition.x()-currentBounds.getX();
+ updateSizeOfControler(newX, currentBounds.getHeight());
+ }
+ /**
+ * When the axis rowFinish has changed , the height of the controler has to change
+ * @param originPosition the position of the container in absolute (origin the diagram)
+ * @param currentBounds the current position of the node (relative to the container)
+ */
+ protected void updateHeightFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
+ Location boundsColumn=(Location) ((Node)rowFinish).getLayoutConstraint();
+ int newHeight=boundsColumn.getY()-originPosition.y()-currentBounds.getY();
+ updateSizeOfControler(currentBounds.getWidth(), newHeight);
+ }
+ /**
+ * When the axis columnStart has changed , the position X of the controler has to change
+ * @param originPosition the position of the container in absolute (origin the diagram)
+ * @param currentBounds the current position of the node (relative to the container)
+ */
+ protected void updateXFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
+ Location boundsColumn=(Location) ((Node)columnStart).getLayoutConstraint();
+ int newX=boundsColumn.getX()-originPosition.x();
+ updateNodePositionOfControler(newX, currentBounds.getY());
+ }
+
+ /**
+ * When the axis rowStart has changed , the position Y of the controler has to change
+ * @param originPosition the position of the container in absolute (origin the diagram)
+ * @param currentBounds the current position of the node (relative to the container)
+ */
+ protected void updateYFromAxisNotification(PrecisionRectangle originPosition, Bounds currentBounds) {
+ Location boundsRow=(Location) ((Node)rowStart).getLayoutConstraint();
+ int newY=boundsRow.getY()-originPosition.y();
+ updateNodePositionOfControler(currentBounds.getX(), newY);
+ }
+
+
+ /**
+ * this class update the position of anchor after the resize
+ * @param sourceEdge
+ * @param eObject
+ */
+ protected void updateAnchorFromHeight(Edge edge, Node node, int deltaHeight) {
+ IdentityAnchor anchor=null;
+ if (edge.getSource().equals(node)){
+ anchor=(IdentityAnchor)edge.getSourceAnchor();
}
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(rowFinish))){
- //The grill is in absolute
- Location boundsColumn=(Location) ((Node)rowFinish).getLayoutConstraint();
- int newHeight=boundsColumn.getY()-originPosition.y()-currentBounds.getY();
- updateSizeOfControler(currentBounds.getWidth(), newHeight);
-
+ else{
+ anchor=(IdentityAnchor)edge.getTargetAnchor();
}
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(columnFinish))){
- //The grill is in absolute
- Location boundsColumn=(Location) ((Node)columnFinish).getLayoutConstraint();
- int newX=boundsColumn.getX()-originPosition.x()-currentBounds.getX();
- updateSizeOfControler(newX, currentBounds.getHeight());
-
+ double yPercent=IdentityAnchorHelper.getYPercentage(anchor);
+ double xPercent=IdentityAnchorHelper.getXPercentage(anchor);
+
+ //calculate bounds from notation
+ PrecisionRectangle bounds= NotationHelper.getAbsoluteBounds(node);
+ double oldSize=bounds.preciseHeight()-deltaHeight;
+ if( oldSize==-1.0){
+ //it is very bad , because this is a default valued given by the figure...
+ if( getHost() instanceof CLifeLineEditPart){
+ oldSize=CLifeLineEditPart.DEFAUT_HEIGHT;
+ }
}
-
- //UPDATE COLUM AND ROW of THE GRID
- if( notification.getEventType()==Notification.SET && notification.getNotifier() instanceof Bounds && (((EObject)notification.getNotifier()).eContainer().equals(((EObject)getHost().getModel())))){
- PrecisionRectangle p=NotationHelper.getAbsoluteBounds((Node)((GraphicalEditPart)getHost()).getNotationView());
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Height())){
- int newY=p.y+p.height;
- updatePositionGridAxis(rowFinish, 0, newY);
+ double newPercentY = (yPercent*oldSize)/(bounds.preciseHeight());
+ if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) {
+ final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY);
+ execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
+ }
+ }
+ /**
+ * /**
+ * this class update the position of anchor after the move
+ * @param sourceEdge
+ * @param eObject
+ */
+ protected void updateAnchorFromY(Edge edge, Node node, int oldY, int newY) {
+ IdentityAnchor anchor=null;
+ if (edge.getSource().equals(node)){
+ anchor=(IdentityAnchor)edge.getSourceAnchor();
+ }
+ else{
+ anchor=(IdentityAnchor)edge.getTargetAnchor();
+ }
+ if(!anchor.getId().trim().equals("")){
+ double yPercent=IdentityAnchorHelper.getYPercentage(anchor);
+ double xPercent=IdentityAnchorHelper.getXPercentage(anchor);
+ //calculate bounds from notation
+ PrecisionRectangle bounds= NotationHelper.getAbsoluteBounds(node);
+ double height=bounds.preciseHeight();
+ if( height==-1.0){
+ //it is very bad , because this is a default valued given by the figure...
+ if( getHost() instanceof CLifeLineEditPart){
+ height=CLifeLineEditPart.DEFAUT_HEIGHT;
+ }
}
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Width())){
- int newX=p.x+p.width;
- updatePositionGridAxis(columnFinish, newX,0);
+ double newPercentY = (oldY-newY)/(height)+yPercent;
+ if(newPercentY<0){
+ newPercentY=0.1;
}
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_Y())){
- //compute next position for RowStart
- int newY=notification.getNewIntValue()+originPosition.y();
- updatePositionGridAxis(rowStart, 0, newY);
-
+ if(newPercentY>1){
+ newPercentY=0.9;
}
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_X())){
- //compute next position for RowStart
- int newX=notification.getNewIntValue()+originPosition.x();
- updatePositionGridAxis(columnStart, newX, 0);
-
+ if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) {
+ final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY);
+ execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
}
}
}
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGrillingEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGrillingEditPolicy.java
deleted file mode 100644
index 3282de4971b..00000000000
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectNodeToGrillingEditPolicy.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
-
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.draw2d.geometry.PrecisionRectangle;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
-import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.DecorationNode;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.IdentityAnchor;
-import org.eclipse.gmf.runtime.notation.Location;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin;
-import org.eclipse.uml2.uml.Element;
-
-/**
- * @author PT202707
- *
- */
-public class ConnectNodeToGrillingEditPolicy extends GraphicalEditPolicyEx implements AutomaticNotationEditPolicy, NotificationListener, IGrillingEditpolicy {
-
- protected GrillingEditpart grillingCompartment=null;
-
- public static String CONNECT_TO_GRILLING_MANAGEMENT="CONNECT_TO_GRILLING_MANAGEMENT";
-
- protected View row=null;
- protected View column=null;
-
- /**
- * Constructor.
- *
- */
- public ConnectNodeToGrillingEditPolicy() {
- }
-
- /**
- * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate()
- *
- */
- @Override
- public void activate() {
- super.activate();
- getDiagramEventBroker().addNotificationListener(((EObject)getHost().getModel()), this);
- DiagramEditPart diagramEditPart=getDiagramEditPart(getHost());
- try{
- GrillingManagementEditPolicy grilling=(GrillingManagementEditPolicy)diagramEditPart.getEditPolicy(GrillingManagementEditPolicy.GRILLING_MANAGEMENT);
- grilling.cleanUnusedRowAndColumn();
- if (grilling!=null){
- row=grilling.getRowTolisten( (Node)((GraphicalEditPart)getHost()).getNotationView(), (Element)((GraphicalEditPart)getHost()).resolveSemanticElement());
- getDiagramEventBroker().addNotificationListener(row, this);
-
- column=grilling.getColumnTolisten((Node)((GraphicalEditPart)getHost()).getNotationView(),(Element)((GraphicalEditPart)getHost()).resolveSemanticElement());
- getDiagramEventBroker().addNotificationListener(column, this);
-
-
- }
- }catch (NoGrillElementFound e) {
- UMLDiagramEditorPlugin.log.error(e);
- }
-
- }
-
- /* Gets the diagram event broker from the editing domain.
- *
- * @return the diagram event broker
- */
- protected DiagramEventBroker getDiagramEventBroker() {
- TransactionalEditingDomain theEditingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
- if (null != theEditingDomain) {
- return DiagramEventBroker.getInstance(theEditingDomain);
- }
- return null;
- }
-
-
- /**
- * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#deactivate()
- *
- */
- @Override
- public void deactivate() {
- getDiagramEventBroker().removeNotificationListener(((EObject)getHost().getModel()), this);
- super.deactivate();
- }
-
- /**
- * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- @Override
- public void notifyChanged(Notification notification) {
- //the ROW has changed
- Bounds bounds=(Bounds) ((Node)((GraphicalEditPart)getHost()).getNotationView()).getLayoutConstraint();
- if( notification.getEventType()==notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(row))){
- Location boundsRow=(Location) ((Node)row).getLayoutConstraint();
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Row", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Point(bounds.getX(),boundsRow.getY() ))));
- }
- // the column has changed
- if( notification.getEventType()==notification.SET && notification.getNotifier() instanceof Location && (((EObject)notification.getNotifier()).eContainer().equals(column))){
- Location boundsRow=(Location) ((Node)column).getLayoutConstraint();
- execute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update column", new EObjectAdapter( ((GraphicalEditPart)getHost()).getNotationView()),
- new Point(boundsRow.getX(),bounds.getY() ))));
- }
-
- //the size has change
- // we must update all links.
- if( notification.getEventType()==notification.SET && notification.getNotifier() instanceof Bounds && (((EObject)notification.getNotifier()).eContainer().equals(((EObject)getHost().getModel())))){
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getSize_Height())){
- Node node=(Node)this.getHost().getModel();
- java.util.List<Edge> sourceEdge= node.getSourceEdges();
- for (Edge edge : sourceEdge) {
- updateAnchorFromHeight(edge,((Node)getHost().getModel()),notification.getNewIntValue()- notification.getOldIntValue());
- }
- java.util.List<Edge> targetEdge= node.getTargetEdges();
- for (Edge edge : targetEdge) {
- updateAnchorFromHeight(edge,((Node)getHost().getModel()),notification.getNewIntValue()- notification.getOldIntValue());
- }
-
- }
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_Y())){
- execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(row), new Point(0,notification.getNewIntValue())));
- Node node=(Node)this.getHost().getModel();
- java.util.List<Edge> sourceEdge= node.getSourceEdges();
- for (Edge edge : sourceEdge) {
- updateAnchorFromY(edge,((Node)getHost().getModel()),notification.getOldIntValue(),notification.getNewIntValue());
- }
- java.util.List<Edge> targetEdge= node.getTargetEdges();
- for (Edge edge : targetEdge) {
- updateAnchorFromY(edge,((Node)getHost().getModel()),notification.getOldIntValue(),notification.getNewIntValue());
- }
-
- }
- if( notification.getFeature().equals(NotationPackage.eINSTANCE.getLocation_X())){
- execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update column", new EObjectAdapter(column), new Point(notification.getNewIntValue(),0)));
- }
- }
-
- }
-
- /**
- * @param sourceEdge
- * @param eObject
- */
- private void updateAnchorFromHeight(Edge edge, Node node, int deltaHeight) {
- IdentityAnchor anchor=null;
- if (edge.getSource().equals(node)){
- anchor=(IdentityAnchor)edge.getSourceAnchor();
- }
- else{
- anchor=(IdentityAnchor)edge.getTargetAnchor();
- }
- double yPercent=IdentityAnchorHelper.getYPercentage(anchor);
- double xPercent=IdentityAnchorHelper.getXPercentage(anchor);
-
- //calculate bounds from notation
- PrecisionRectangle bounds= NotationHelper.getAbsoluteBounds(node);
- double oldSize=bounds.preciseHeight()-deltaHeight;
- if( oldSize==-1.0){
- //it is very bad , because this is a default valued given by the figure...
- if( getHost() instanceof CLifeLineEditPart){
- oldSize=CLifeLineEditPart.DEFAUT_HEIGHT;
- }
- }
-
- double newPercentY = (yPercent*oldSize)/(bounds.preciseHeight());
- if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) {
- final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY);
- execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
- }
- }
- /**
- * @param sourceEdge
- * @param eObject
- */
- private void updateAnchorFromY(Edge edge, Node node, int oldY, int newY) {
- IdentityAnchor anchor=null;
- if (edge.getSource().equals(node)){
- anchor=(IdentityAnchor)edge.getSourceAnchor();
- }
- else{
- anchor=(IdentityAnchor)edge.getTargetAnchor();
- }
- if(!anchor.getId().trim().equals("")){
- double yPercent=IdentityAnchorHelper.getYPercentage(anchor);
- double xPercent=IdentityAnchorHelper.getXPercentage(anchor);
-
- //calculate bounds from notation
- PrecisionRectangle bounds= NotationHelper.getAbsoluteBounds(node);
- double height=bounds.preciseHeight();
- if( height==-1.0){
- //it is very bad , because this is a default valued given by the figure...
- if( getHost() instanceof CLifeLineEditPart){
- height=CLifeLineEditPart.DEFAUT_HEIGHT;
- }
- }
-
- double newPercentY = (oldY-newY)/(height)+yPercent;
- if(newPercentY<0){
- newPercentY=0.1;
- }
- if(newPercentY>1){
- newPercentY=0.9;
- }
- if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) {
- final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY);
- execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue));
- }
- }
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingBasedXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingBasedXYLayoutEditPolicy.java
index 79e77100e03..ebf98964242 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingBasedXYLayoutEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingBasedXYLayoutEditPolicy.java
@@ -25,6 +25,7 @@ import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.requests.ChangeBoundsRequest;
import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
@@ -76,6 +77,14 @@ public class GrillingBasedXYLayoutEditPolicy extends XYLayoutWithConstrainedResi
}
}
+ if( request instanceof CreateViewAndElementRequest){
+ CreateViewAndElementRequest req=(CreateViewAndElementRequest)request;
+ ViewAndElementDescriptor descriptor=(req).getViewAndElementDescriptor();
+ IElementType elementType = (IElementType) descriptor.getElementAdapter().getAdapter(IElementType.class);
+ if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.COMBINED_FRAGMENT_SHAPE)){
+ System.out.println("toto");
+ }
+ }
return super.getCreateCommand(request);
}
/* Override to use to deal with causes where the point is UNDERFINED
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingManagementEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingManagementEditPolicy.java
index f0c6a05d6ed..457f61ed913 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingManagementEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GrillingManagementEditPolicy.java
@@ -58,6 +58,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.command.CreateGrillingStructureC
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ExecutionSpecification;
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.UMLPackage;
@@ -221,8 +222,10 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
Collections.sort(new ArrayList<>(rows),RowComparator );
Collections.sort(new ArrayList<>(columns),ColumnComparator );
}
+
/** this class is very specific the the sequence diagram
- * this purpose of this method is to ensure the consistency of event in the the represented diagram**/
+ * this purpose of this method is to ensure the consistency of event in the the represented diagram
+ * **/
public void updateSemanticAfterUpdate(){
//1. look for all Lifelines
//There are columns.
@@ -243,7 +246,7 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
for (DecorationNode row : rows) {
if ((getRef(row))!=null){
for (EObject referedElement : getRef(row)) {
- if( referedElement instanceof InteractionFragment){
+ if( referedElement instanceof InteractionFragment && (!(referedElement instanceof InteractionOperand))){
InteractionFragment interactionFragment=(InteractionFragment)(referedElement);
if( lifeline.getCoveredBys().contains(interactionFragment)){
covered.add(interactionFragment);
@@ -255,17 +258,42 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
}
}
+
+ //3. managment of InteractionOperand
+ //There are columns.
+
+ ArrayList<InteractionOperand> coveredbyInteractionOperand=new ArrayList<InteractionOperand>();
+ for (DecorationNode column : columns) {
+ if ((getRef(column))!=null){
+ for (EObject referedElement : getRef(column)) {
+ if( referedElement instanceof InteractionOperand){
+ if(!(coveredbyInteractionOperand.contains(referedElement))){
+ coveredbyInteractionOperand.add((InteractionOperand)referedElement);
+ }
+ else{
+ coveredbyInteractionOperand.remove((InteractionOperand)referedElement);
+ }
+ }
+ if( referedElement.equals(lifeline)){
+ covered.addAll(coveredbyInteractionOperand);
+ }
+ }
+ }
+
+ }
+
if(covered.size()== lifeline.getCoveredBys().size()){
System.err.println("equality");
execute(new SetCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), covered));
}
else if( covered.size()<lifeline.getCoveredBys().size()){
System.err.println("Event not managed or in being created");
- covered.addAll(lifeline.getCoveredBys());
+ //covered.addAll(lifeline.getCoveredBys());
execute(new SetCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), covered));
}
else if( covered.size()>lifeline.getCoveredBys().size()){
- System.err.println("more event that in the lifeline");
+ System.err.println("more event that in the lifeline due to combined fragment");
+ execute(new SetCommand(((IGraphicalEditPart) getHost()).getEditingDomain(), lifeline, UMLPackage.eINSTANCE.getLifeline_CoveredBy(), covered));
}
}
@@ -273,7 +301,7 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
public void cleanUnusedRowAndColumn(){
ArrayList<DecorationNode> unusedDcorationNode= new ArrayList<DecorationNode>();
-
+
if(grillingCompartment!=null){
List persistedChildren=grillingCompartment.getNotationView().getPersistedChildren();
for (int i=0;i<persistedChildren.size(); i++){
@@ -352,10 +380,10 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
* @param notationObject
* @return
*/
- public View getRowTolisten(Node graphic, Element semantic) throws NoGrillElementFound{
+ public View getorCreateRowTolisten(Node graphic, Element semantic) throws NoGrillElementFound{
LayoutConstraint layoutConstraint=((Node)graphic).getLayoutConstraint();
if(layoutConstraint instanceof Bounds){
- return getRowTolisten(((Bounds) layoutConstraint).getY(),semantic);
+ return getorCreateRowTolisten(((Bounds) layoutConstraint).getY(),semantic);
}
throw new NoGrillElementFound();
}
@@ -366,7 +394,7 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
* @param x the position x for the column
* @return the decoration node
*/
- public DecorationNode getColumnTolisten( int x, Element semantic) throws NoGrillElementFound{
+ public DecorationNode getorCreateColumnTolisten( int x, Element semantic) throws NoGrillElementFound{
try{
DecorationNode column=existCoulumnAtPosition(x);
}
@@ -423,7 +451,7 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
* @param y the position y for the line
* @return the decoration node
*/
- public DecorationNode getRowTolisten( int y, Element semantic) throws NoGrillElementFound{
+ public DecorationNode getorCreateRowTolisten( int y, Element semantic) throws NoGrillElementFound{
try{
return existRowAtPosition(y, semantic);
}
@@ -443,10 +471,10 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
* @param graphic the graphical element
* @return
*/
- public View getColumnTolisten( Node graphic, Element semantic ) throws NoGrillElementFound{
+ public View getorCreateColumnTolisten( Node graphic, Element semantic ) throws NoGrillElementFound{
LayoutConstraint layoutConstraint=((Node)graphic).getLayoutConstraint();
if(layoutConstraint instanceof Bounds){
- return getColumnTolisten(((Bounds)layoutConstraint).getX(),semantic);
+ return getorCreateColumnTolisten(((Bounds)layoutConstraint).getX(),semantic);
}
throw new NoGrillElementFound();
@@ -543,7 +571,9 @@ public class GrillingManagementEditPolicy extends GraphicalEditPolicyEx implemen
if(respectMargin){
if( nextdistance<margin){
boolean after=false;
- for (DecorationNode currentRow : rows) {
+ ArrayList<DecorationNode> rowsCopy= new ArrayList<DecorationNode>();
+ rowsCopy.addAll(rows);
+ for (DecorationNode currentRow : rowsCopy) {
if( after){
LayoutConstraint currentConstraint=currentRow.getLayoutConstraint();
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/InteractionOperandToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/InteractionOperandToGridEditPolicy.java
new file mode 100644
index 00000000000..4865fa677bc
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/InteractionOperandToGridEditPolicy.java
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
+
+/**
+ * this class overload classical, becuase tha width of a interaction operand is the width of the combined fragment
+ */
+public class InteractionOperandToGridEditPolicy extends ConnectNodeToGridEditPolicy {
+
+ /**
+ * Constructor.
+ *
+ */
+ public InteractionOperandToGridEditPolicy() {
+ super();
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
new file mode 100644
index 00000000000..34f9fe39391
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java
@@ -0,0 +1,307 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.IdentityCommand;
+import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker;
+import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+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.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CCombinedFragmentEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CInteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
+import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes;
+import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
+
+
+/**
+ * This class is used to allow the resize and adding of children of the combined Fragment
+ *
+ */
+public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements AutomaticNotationEditPolicy, NotificationListener{
+
+
+ /**
+ * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate()
+ *
+ */
+ @Override
+ public void activate() {
+ super.activate();
+ getDiagramEventBroker().addNotificationListener(((EObject)getHost().getModel()), this);
+ }
+
+ /**
+ * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate()
+ *
+ */
+ @Override
+ public void deactivate() {
+ getDiagramEventBroker().removeNotificationListener(((EObject)getHost().getModel()), this);
+ super.activate();
+ }
+ /* Gets the diagram event broker from the editing domain.
+ *
+ * @return the diagram event broker
+ */
+ protected DiagramEventBroker getDiagramEventBroker() {
+ TransactionalEditingDomain theEditingDomain = getEditingDomain();
+ if (null != theEditingDomain) {
+ return DiagramEventBroker.getInstance(theEditingDomain);
+ }
+ return null;
+ }
+ /**
+ * Factors incoming requests into various specific methods.
+ *
+ * @see org.eclipse.gef.EditPolicy#getCommand(Request)
+ */
+ public Command getCommand(Request request) {
+ if( request instanceof CreateViewAndElementRequest){
+ CreateViewAndElementRequest req=(CreateViewAndElementRequest)request;
+ ViewAndElementDescriptor descriptor=(req).getViewAndElementDescriptor();
+ IElementType elementType = (IElementType) descriptor.getElementAdapter().getAdapter(IElementType.class);
+ if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.INTERACTION_OPERAND_SHAPE)){
+ Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView();
+ //we add a new Operand so we add the default height
+ int newHeight = getComputedCombinedFragmentHeight()+CInteractionOperandEditPart.DEFAULT_HEIGHT;
+ return new ICommandProxy(new SetBoundsCommand(getEditingDomain(), "Resize CombinedFragments", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight)));
+
+ }
+ }
+ if( RequestConstants.REQ_RESIZE_CHILDREN.equals(request.getType())){
+ CompositeCommand compositeCommand= new CompositeCommand("Resize Operands");
+ ChangeBoundsRequest changeBoundsRequest=(ChangeBoundsRequest)request;
+ List<?> editParts =changeBoundsRequest.getEditParts();
+ // the user can resize only one InteractionOperand
+ if( editParts.size()>1){
+ return null;
+ }
+
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+
+ Object currentEditPart= editParts.get(0);
+ if(changeBoundsRequest.getMoveDelta().y==0){
+ if( currentEditPart instanceof GraphicalEditPart){
+ //update the current Node
+ updateCurrentChildSize(compositeCommand, changeBoundsRequest, editingDomain, currentEditPart);
+
+ //update the combinedfragment if this the last
+ if( istheLastDisplayedOperand((GraphicalEditPart)currentEditPart)){
+ compositeCommand.add(getResizeCompartmentCommand(changeBoundsRequest));
+ }
+ else{
+ //update the next view if this is not the last
+ View nextView=getNextView((GraphicalEditPart)currentEditPart);
+ Dimension size= new Dimension(BoundForEditPart.getWidthFromView((Node)nextView), BoundForEditPart.getHeightFromView((Node)nextView));
+ size.expand(changeBoundsRequest.getSizeDelta().width*-1, changeBoundsRequest.getSizeDelta().height*-1);
+ SetBoundsCommand setBoundsCommand= new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(nextView), size);
+ compositeCommand.add(setBoundsCommand);
+ }
+ }
+ }
+ else if(changeBoundsRequest.getMoveDelta().y!=0){
+ if( currentEditPart instanceof GraphicalEditPart){
+ updateCurrentChildSize(compositeCommand, changeBoundsRequest, editingDomain, currentEditPart);
+ }
+ if( istheFirstDisplayedOperand((GraphicalEditPart)currentEditPart)){
+ compositeCommand.add(getMoveCompartmentCommand(changeBoundsRequest));
+ }
+ else{
+ //update the next view if this is not the last
+ View previousView=getPreviousView((GraphicalEditPart)currentEditPart);
+ Dimension size= new Dimension(BoundForEditPart.getWidthFromView((Node)previousView), BoundForEditPart.getHeightFromView((Node)previousView));
+ size.expand(changeBoundsRequest.getSizeDelta().width*-1, changeBoundsRequest.getSizeDelta().height*-1);
+ SetBoundsCommand setBoundsCommand= new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(previousView), size);
+ compositeCommand.add(setBoundsCommand);
+ }
+ }
+ return new ICommandProxy(compositeCommand);
+ }
+ return null;
+ }
+
+ protected TransactionalEditingDomain getEditingDomain() {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ return editingDomain;
+ }
+
+ private void updateCurrentChildSize(CompositeCommand compositeCommand, ChangeBoundsRequest changeBoundsRequest, TransactionalEditingDomain editingDomain, Object currentEditPart) {
+ Node shapeView=(Node)((GraphicalEditPart)currentEditPart).getNotationView();
+ Dimension size= new Dimension(BoundForEditPart.getWidthFromView(shapeView), BoundForEditPart.getHeightFromView(shapeView));
+ size.expand(changeBoundsRequest.getSizeDelta().width, changeBoundsRequest.getSizeDelta().height);
+ SetBoundsCommand setBoundsCommand= new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(shapeView), size);
+ compositeCommand.add(setBoundsCommand);
+ }
+
+ /**
+ *
+ * @param operandEditPart
+ * @return true if this the last children of the compartment.
+ */
+ protected boolean istheLastDisplayedOperand(GraphicalEditPart operandEditPart){
+ View operandView=operandEditPart.getNotationView();
+ int index=((View)operandView.eContainer()).getChildren().indexOf(operandView);
+ int listSize=((View)operandView.eContainer()).getChildren().size();
+ return index==listSize-1;
+ }
+ /**
+ *
+ * @param operandEditPart
+ * @return true if this the first children of the compartment.
+ */
+ protected boolean istheFirstDisplayedOperand(GraphicalEditPart operandEditPart){
+ View operandView=operandEditPart.getNotationView();
+ int index=((View)operandView.eContainer()).getChildren().indexOf(operandView);
+ return index==0;
+ }
+
+ /** get the next view at the same level at the current editPart
+ *
+ * @param operandEditPart
+ * @return can return null if this the last;
+ */
+ protected View getNextView(GraphicalEditPart operandEditPart){
+ View operandView=operandEditPart.getNotationView();
+ int index=((View)operandView.eContainer()).getChildren().indexOf(operandView);
+ int listSize=((View)operandView.eContainer()).getChildren().size();
+ if( index+1<listSize){
+ return (View) ((View)operandView.eContainer()).getChildren().get(index+1);
+ }
+ return null;
+ }
+
+ /** get the next view at the same level at the current editPart
+ *
+ * @param operandEditPart
+ * @return can return null if this the last;
+ */
+ protected View getPreviousView(GraphicalEditPart operandEditPart){
+ View operandView=operandEditPart.getNotationView();
+ int index=((View)operandView.eContainer()).getChildren().indexOf(operandView);
+ if( index-1>=0){
+ return (View) ((View)operandView.eContainer()).getChildren().get(index-1);
+ }
+ return null;
+ }
+ /**
+ * the border effect is to resize the combined fragment
+ * @param changeBoundsRequest
+ * @return a command to to resize the combinedfragment
+ */
+ protected ICommand getResizeCompartmentCommand(ChangeBoundsRequest changeBoundsRequest){
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView();
+ int combinedFragmentHeight=BoundForEditPart.getHeightFromView(combinedFragmentNode);
+ int newHeight = getComputedCombinedFragmentHeight()+changeBoundsRequest.getSizeDelta().height;
+ if(newHeight!=combinedFragmentHeight){
+ return new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight));
+ }
+ return IdentityCommand.INSTANCE;
+ }
+
+ /**
+ * the border effect is to move the combined fragment
+ * @param changeBoundsRequest
+ * @return a command to to resize the combinedfragment
+ */
+ protected ICommand getMoveCompartmentCommand(ChangeBoundsRequest changeBoundsRequest){
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ //1 get all children size
+ Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView();
+ int newHeight = getComputedCombinedFragmentHeight()+changeBoundsRequest.getSizeDelta().height;
+
+ int combinedFragmentHeight=BoundForEditPart.getHeightFromView(combinedFragmentNode);
+ Bounds combinedFragmentBound=BoundForEditPart.getBounds(combinedFragmentNode);
+ int newY= combinedFragmentBound.getY()+changeBoundsRequest.getMoveDelta().y;
+
+ if(newHeight!=combinedFragmentHeight){
+ return new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Rectangle( combinedFragmentBound.getX(),newY,BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight));
+ }
+ return IdentityCommand.INSTANCE;
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ if( notification.getEventType()==Notification.REMOVE && (notification.getNotifier().equals(getHost().getModel()))){
+ //1 get all children size
+ Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView();
+ int newHeight = getComputedCombinedFragmentHeight();
+ int combinedFragmentHeight=BoundForEditPart.getHeightFromView(combinedFragmentNode);
+ if(newHeight!=combinedFragmentHeight){
+ execute(new SetBoundsCommand(getEditingDomain(), "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight)));
+ }
+ }
+ }
+
+ /**
+ *
+ * @return the height of the combined fragment by computing the size of interaction operand
+ */
+ protected int getComputedCombinedFragmentHeight() {
+ double childrenCumulativeHeight = getOperandCumulativeHeight();
+
+ //add the size of the label
+ int newHeight= (int)childrenCumulativeHeight+CCombinedFragmentEditPart.DEFAULT_HEIGHT-CInteractionOperandEditPart.DEFAULT_HEIGHT;
+ //there is a minimum size
+ if( newHeight<CCombinedFragmentEditPart.DEFAULT_HEIGHT){
+ newHeight= CCombinedFragmentEditPart.DEFAULT_HEIGHT;
+ }
+ return newHeight;
+ }
+
+ /**@return the Height of all interaction operand inside the compartment
+ * **/
+ protected double getOperandCumulativeHeight() {
+ Node compartmentNode=(Node)((GraphicalEditPart)(getHost())).getNotationView();
+ double childrenCumulativeHeight =0.0;
+ for (Iterator<?> iterator = compartmentNode.getChildren().iterator(); iterator.hasNext();) {
+ Node childView = (Node) iterator.next();
+ childrenCumulativeHeight= childrenCumulativeHeight+BoundForEditPart.getHeightFromView(childView);
+ }
+ return childrenCumulativeHeight;
+ }
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java
index a1f00362b4f..1c04db6cb38 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/CombinedFragmentMoveHelper.java
@@ -35,7 +35,7 @@ import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper;
import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomCombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionCompartmentXYLayoutEditPolicy;
@@ -81,11 +81,11 @@ public class CombinedFragmentMoveHelper {
if (hostEP.getParent() instanceof OLDCustomCombinedFragmentEditPart) {
// Select which InteractionOperand we're dropping to
OLDCustomCombinedFragmentEditPart hostCFEP = (OLDCustomCombinedFragmentEditPart) hostEP.getParent();
- List<CustomInteractionOperandEditPart> operands = hostCFEP.getOperandChildrenEditParts();
+ List<OLDCustomInteractionOperandEditPart> operands = hostCFEP.getOperandChildrenEditParts();
if (!operands.isEmpty()) {
Point location = request.getLocation();
parentEP = operands.get(0);
- for (CustomInteractionOperandEditPart operand : operands) {
+ for (OLDCustomInteractionOperandEditPart operand : operands) {
Rectangle bounds = operand.getFigure().getBounds().getCopy();
operand.getFigure().translateToAbsolute(bounds);
if (bounds.contains(location)) {
@@ -104,10 +104,10 @@ public class CombinedFragmentMoveHelper {
public static void adjustNewParentOperands(CompoundCommand cc, Rectangle newParentNewRect, Rectangle newParentOldRect, EditPart hostEP) {
Set<Object> alreadyMovedBlocks = new HashSet<Object>();
OLDCustomCombinedFragmentEditPart hostCFEP = (OLDCustomCombinedFragmentEditPart) hostEP.getParent();
- List<CustomInteractionOperandEditPart> operands = hostCFEP.getOperandChildrenEditParts();
+ List<OLDCustomInteractionOperandEditPart> operands = hostCFEP.getOperandChildrenEditParts();
int moveUpperYOffset = newParentNewRect.y - newParentOldRect.y;
int moveLowerYOffset = newParentNewRect.height - newParentOldRect.height;
- for (CustomInteractionOperandEditPart operand : operands) {
+ for (OLDCustomInteractionOperandEditPart operand : operands) {
Rectangle rectangleOperand = operand.getFigure().getBounds().getCopy();
operand.getFigure().translateToAbsolute(rectangleOperand);
Bounds operandBounds = OperandBoundsComputeHelper.getEditPartBounds(operand);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
index cab779a5c45..15fcbe4766b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
@@ -69,7 +69,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPa
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomCombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.GateEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
@@ -780,8 +780,8 @@ public class OperandBoundsComputeHelper {
continue;
}
OLDCustomCombinedFragmentEditPart childCF = (OLDCustomCombinedFragmentEditPart) children.get(i);
- List<CustomInteractionOperandEditPart> childOperands = childCF.getOperandChildrenEditParts();
- for (CustomInteractionOperandEditPart childOperand : childOperands) {
+ List<OLDCustomInteractionOperandEditPart> childOperands = childCF.getOperandChildrenEditParts();
+ for (OLDCustomInteractionOperandEditPart childOperand : childOperands) {
cc.add(getForcedShiftEnclosedFragmentsCommand(childOperand, movedY, alreadyMovedItems));
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen
index 9311781611f..8b1ea8f338a 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.gmfgen
@@ -2264,6 +2264,10 @@
xsi:type="gmfgen:ParentAssignedViewmap"
getterName="getCompartmentFigure"
figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ <behaviour
+ xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ResizeOperandEditPolicy"/>
</compartments>
<palette>
<groups
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentCombinedFragmentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentCombinedFragmentCompartmentEditPart.java
index 99b1857b3c5..501d9e16b66 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentCombinedFragmentCompartmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentCombinedFragmentCompartmentEditPart.java
@@ -8,7 +8,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * CEA LIST - Initial API and implementation
+ * CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
@@ -40,7 +40,9 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentS
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.part.Messages;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.BoundForEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.GrillingBasedXYLayoutEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ResizeOperandEditPolicy;
/**
* @generated
@@ -91,7 +93,7 @@ public class CombinedFragmentCombinedFragmentCompartmentEditPart extends ListCom
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy());
- installEditPolicy(EditPolicy.LAYOUT_ROLE, new GrillingBasedXYLayoutEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new ResizeOperandEditPolicy());
// in Papyrus diagrams are not strongly synchronised
// installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.sequence.edit.policies.CombinedFragmentCombinedFragmentCompartmentCanonicalEditPolicy());
@@ -140,6 +142,15 @@ public class CombinedFragmentCombinedFragmentCompartmentEditPart extends ListCom
int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point loc = new Point(x, y);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size));
+
+ //this code has been added in order to force the refresh of Sub Combined fragment
+ if(children!=null){
+ for (Object child : children) {
+ if( child instanceof EditPart){
+ ((EditPart)child).refresh();
+ }
+ }
+ }
}
/**
@@ -149,42 +160,5 @@ public class CombinedFragmentCombinedFragmentCompartmentEditPart extends ListCom
super.refreshVisuals();
refreshBounds();
}
-
- /**
- * @see GraphicalEditPart#setLayoutConstraint(EditPart, IFigure, Object)
- */
- public void setLayoutConstraint(EditPart child, IFigure childFigure,
- Object constraint) {
-//1 get all childrsize of childreen
- double size =0.0;
- Node currentNode = (Node)getNotationView();
- for (Iterator iterator = currentNode.getChildren().iterator(); iterator.hasNext();) {
- Node view = (Node) iterator.next();
- if( view.getLayoutConstraint() instanceof Bounds){
- if(((Bounds)view.getLayoutConstraint()).getHeight()==-1){
- size= size+40;
- }
- else{
- size= size+((Bounds)view.getLayoutConstraint()).getHeight();
- }
- }
-
- }
-
- if( currentNode.getLayoutConstraint() instanceof Bounds){
- Bounds newBounds=((Bounds)currentNode.getLayoutConstraint());
- if( size>((Bounds)currentNode.getLayoutConstraint()).getHeight()){
- //executeCommand(new GMFtoGEFCommandWrapper( new SetBoundsCommand(getEditingDomain(), "resize", new EObjectAdapter(currentNode), new Dimension(newBounds.getWidth(),(int)size))));
- }
- }
-
-
-
- PrecisionRectangle bounds=new PrecisionRectangle(getFigure().getBounds());
- if(constraint instanceof Rectangle){
- double ratio= ((double)((Rectangle)constraint).height)/bounds.height;
- System.out.println("Ratio:"+ratio);
- childFigure.getParent().setConstraint(childFigure, ratio);
- }
- }
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java
index 464f575139e..4dd0d040bba 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CombinedFragmentEditPart.java
@@ -84,7 +84,7 @@ public class CombinedFragmentEditPart extends InteractionFragmentEditPart {
installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY,
new ShowHideCompartmentEditPolicy());
- installEditPolicy(ConnectNodeToGridEditPolicy.CONNECT_TO_GRILLING_MANAGEMENT, new ConnectNodeToGridEditPolicy());
+ //installEditPolicy(ConnectNodeToGridEditPolicy.CONNECT_TO_GRILLING_MANAGEMENT, new ConnectNodeToGridEditPolicy());
//installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new OLDSequenceGraphicalNodeEditPolicy());
// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandEditPart.java
index f6c86d20ddf..cfb006226bd 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/InteractionOperandEditPart.java
@@ -41,6 +41,8 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionOperand
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDSequenceGraphicalNodeEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.figures.InteractionOperandFigure;
import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectInteractionOperandToGridEditPolicy;
+import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGridEditPolicy;
import org.eclipse.swt.graphics.Color;
/**
@@ -88,8 +90,9 @@ public class InteractionOperandEditPart extends RoundedCompartmentEditPart {
installEditPolicy(EditPolicy.LAYOUT_ROLE, new InteractionOperandLayoutEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new InteractionOperandDragDropEditPolicy());
installEditPolicy(EditPolicy.COMPONENT_ROLE, new InteractionOperandComponentEditPolicy());
- installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CombinedFragmentCreationEditPolicy());
- installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new OLDSequenceGraphicalNodeEditPolicy());
+ //installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CombinedFragmentCreationEditPolicy());
+ //installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new OLDSequenceGraphicalNodeEditPolicy());
+ installEditPolicy(ConnectNodeToGridEditPolicy.CONNECT_TO_GRILLING_MANAGEMENT, new ConnectInteractionOperandToGridEditPolicy());
// XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
// removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageAsyncEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageAsyncEditPart.java
index 007bb7f4c36..667e5b8110c 100755
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageAsyncEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/MessageAsyncEditPart.java
@@ -13,7 +13,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDMessageConnecti
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageConnectionLineSegEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.figures.MessageAsync;
import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectEdgeToGrillingEditPolicy;
-import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.ConnectNodeToGrillingEditPolicy;
/**
* @generated
@@ -43,7 +42,7 @@ public class MessageAsyncEditPart extends AbstractMessageEditPart implements ITr
installEditPolicy(AppliedStereotypeLinkLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY,
new AppliedStereotypeLinkLabelDisplayEditPolicy());
installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, new MessageConnectionLineSegEditPolicy());
- installEditPolicy(ConnectNodeToGrillingEditPolicy.CONNECT_TO_GRILLING_MANAGEMENT, new ConnectEdgeToGrillingEditPolicy());
+ installEditPolicy(ConnectEdgeToGrillingEditPolicy.CONNECT_TO_GRILLING_MANAGEMENT, new ConnectEdgeToGrillingEditPolicy());
}
/**
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF
index 8e028bf8a8c..7602bed60ac 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/META-INF/MANIFEST.MF
@@ -16,7 +16,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.papyrus.junit.framework;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.junit.utils;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.papyrus.tests.framework;bundle-version="[1.2.0,2.0.0)",
org.eclipse.xtend.lib;bundle-version="2.8.1",
org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.papyrus.uml.diagram.stereotypeproperty.tests;bundle-version="[1.2.0,2.0.0)"
@@ -29,4 +28,4 @@ Bundle-Name: %Bundle-Name
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.uml.diagram.sequence.tests.Activator
Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.sequence.tests;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7 \ No newline at end of file
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestGuardEdition_364808.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestGuardEdition_364808.java
index 1805d056a04..f25a3635186 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestGuardEdition_364808.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestGuardEdition_364808.java
@@ -35,9 +35,9 @@ import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandGuardEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
@@ -148,7 +148,8 @@ public class TestGuardEdition_364808 extends TestTopNode {
protected WrappingLabel performEditRequest(InteractionOperandEditPart op) {
//Introduced a Guard EditPart for displaying operand label.
- WrappingLabel label = op instanceof CustomInteractionOperandEditPart ? ((CustomInteractionOperandEditPart)op).getInteractionConstraintLabel() : op.getPrimaryShape().getInteractionConstraintLabel();
+ if( op instanceof CInteractionOperandEditPart){
+ WrappingLabel label = op.getPrimaryShape().getInteractionConstraintLabel();
Rectangle b = label.getBounds().getCopy();
label.translateToAbsolute(b);
DirectEditRequest req = new DirectEditRequest();
@@ -160,6 +161,8 @@ public class TestGuardEdition_364808 extends TestTopNode {
op.performRequest(req);
}
return label;
+ }
+ return null;
}
private Text findEditor(Composite composite, WrappingLabel label) {
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestInteractionConstraint_382966.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestInteractionConstraint_382966.java
index f98b25da5ec..c0fdf2050e0 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestInteractionConstraint_382966.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/TestInteractionConstraint_382966.java
@@ -39,9 +39,9 @@ import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
@@ -99,8 +99,10 @@ public class TestInteractionConstraint_382966 extends TestTopNode {
waitForComplete();
//introduced a guard edit part for displaying operand label.
- WrappingLabel label = op instanceof CustomInteractionOperandEditPart ? ((CustomInteractionOperandEditPart)op).getInteractionConstraintLabel() : op.getPrimaryShape().getInteractionConstraintLabel();
- assertTrue(TEST_THE_EXECUTION, label.getText().equals(""));
+ if( op instanceof CInteractionOperandEditPart){
+ WrappingLabel label = op.getPrimaryShape().getInteractionConstraintLabel();
+ assertTrue(TEST_THE_EXECUTION, label.getText().equals(""));
+ }
}
@Test
@@ -121,9 +123,10 @@ public class TestInteractionConstraint_382966 extends TestTopNode {
}
}, true);
waitForComplete();
-
- WrappingLabel label = op instanceof CustomInteractionOperandEditPart ? ((CustomInteractionOperandEditPart)op).getInteractionConstraintLabel() : op.getPrimaryShape().getInteractionConstraintLabel();
- assertTrue(TEST_THE_EXECUTION, label.getText().equals(""));
+ if( op instanceof CInteractionOperandEditPart){
+ WrappingLabel label = op.getPrimaryShape().getInteractionConstraintLabel();
+ assertTrue(TEST_THE_EXECUTION, label.getText().equals(""));
+ }
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/AbstractNodeTest.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/AbstractNodeTest.java
index d6cfebb1fdc..5c89f2901e7 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/AbstractNodeTest.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/AbstractNodeTest.java
@@ -295,7 +295,7 @@ public abstract class AbstractNodeTest extends TestTopNode {
location = eventAndLocation.getKey();
events = eventAndLocation.getValue();
}
- request.getExtendedData().put(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION, events);
+ //request.getExtendedData().put(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.NEAREST_OCCURRENCE_SPECIFICATION, events);
request.getExtendedData().put(SequenceRequestConstant.OCCURRENCE_SPECIFICATION_LOCATION, location);
if(location != null) {
request.setLocation(location);
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestElementIcon_396799.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestElementIcon_396799.java
index 647e7d44753..c1d6861bee4 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestElementIcon_396799.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestElementIcon_396799.java
@@ -46,7 +46,6 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentBodyEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CommentEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.Constraint2EditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ConstraintEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionNameEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
@@ -213,7 +212,7 @@ public class TestElementIcon_396799 extends AbstractNodeTest {
assertNotNull(compartment);
InteractionOperandEditPart operand = (InteractionOperandEditPart) compartment.getChildBySemanticHint("" + InteractionOperandEditPart.VISUAL_ID);
assertNotNull(operand);
- WrappingLabel label = operand instanceof CustomInteractionOperandEditPart ? ((CustomInteractionOperandEditPart) operand).getInteractionConstraintLabel() : operand.getPrimaryShape().getInteractionConstraintLabel();
+ WrappingLabel label = operand.getPrimaryShape().getInteractionConstraintLabel();
testElementIcon(label, operand.getNotationView(), true);
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java
index 6dad394fb7a..2d0bf9ffe88 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence.tests/src/org/eclipse/papyrus/uml/diagram/sequence/tests/bug/m7/TestGuardVisibility_402966.java
@@ -16,43 +16,24 @@ package org.eclipse.papyrus.uml.diagram.sequence.tests.bug.m7;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.jface.preference.IPreferencePage;
import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.junit.framework.classification.InvalidTest;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomInteractionOperandEditPart;
import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.tests.ISequenceDiagramTestsConstants;
-import org.eclipse.papyrus.uml.diagram.sequence.util.InteractionOperandModelElementFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.views.properties.PropertySheet;
-import org.eclipse.ui.views.properties.tabbed.ITabDescriptor;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.junit.Test;
/**
@@ -117,7 +98,7 @@ public class TestGuardVisibility_402966 extends AbstractNodeTest {
public void testGuardVisibility(InteractionOperandEditPart op, boolean visible) {
assertNotNull(op);
- WrappingLabel constraintLabel = op instanceof CustomInteractionOperandEditPart ? ((CustomInteractionOperandEditPart)op).getInteractionConstraintLabel() : op.getPrimaryShape().getInteractionConstraintLabel();
+ WrappingLabel constraintLabel = op.getPrimaryShape().getInteractionConstraintLabel();
assertNotNull(constraintLabel);
if(visible) {
String text = ((ITextAwareEditPart)op).getParser().getPrintString(new EObjectAdapter(op.resolveSemanticElement()), ParserOptions.NONE.intValue());

Back to the top