Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCéline Janssens2014-08-08 12:12:56 -0400
committerCéline Janssens2014-08-22 11:35:46 -0400
commit62e91bc3965a1ac29ca041c114194785625d3afc (patch)
treed8b949e2579b2d76227b31954fa8f3aa83c61be5
parentb582f5e9c7c584c96d1121a6a387216040bd0b34 (diff)
downloadorg.eclipse.papyrus-streams/0.10-maintenance.tar.gz
org.eclipse.papyrus-streams/0.10-maintenance.tar.xz
org.eclipse.papyrus-streams/0.10-maintenance.zip
440224: [All Diagrams] Allow Labels Alignmentsstreams/0.10-maintenance
https://bugs.eclipse.org/bugs/show_bug.cgi?id=440224 Implement Label Alignment and refactor of the CustomAlignAction class Change-Id: I822a9a2dc0dcf1f501ed12c3d95b7187836e21ad Signed-off-by: Céline Janssens <Celine.Janssens@all4tec.net>
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java12
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/LabelAlignmentEditPolicy.java174
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/layout/AlignmentTree.java47
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomPortNameEditPart.java48
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomUMLEditPartFactory.java3
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortNameEditPart.java49
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java16
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/AlignActionHelper.java356
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/CustomAlignAction.java670
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java1
14 files changed, 998 insertions, 424 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
index e2d6cca2167..b17fa0ab467 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpart/PapyrusLabelEditPart.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2014 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,11 +8,13 @@
*
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net
*****************************************************************************/
package org.eclipse.papyrus.infra.gmfdiag.common.editpart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.LabelAlignmentEditPolicy;
public abstract class PapyrusLabelEditPart extends LabelEditPart {
@@ -21,4 +23,12 @@ public abstract class PapyrusLabelEditPart extends LabelEditPart {
super(view);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(LabelAlignmentEditPolicy.LABEL_ALIGNMENT_KEY, new LabelAlignmentEditPolicy());
+ }
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/LabelAlignmentEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/LabelAlignmentEditPolicy.java
new file mode 100644
index 00000000000..dfdc14db294
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/LabelAlignmentEditPolicy.java
@@ -0,0 +1,174 @@
+package org.eclipse.papyrus.infra.gmfdiag.common.editpolicies;
+
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * 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:
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gef.editpolicies.AbstractEditPolicy;
+import org.eclipse.gef.requests.AlignmentRequest;
+import org.eclipse.gef.requests.ChangeBoundsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+
+/**
+ * This EditPolicy provides the command for the alignment. In the case of
+ * Label.
+ */
+public class LabelAlignmentEditPolicy extends AbstractEditPolicy{
+
+ /**
+ * the key for the Port Alignment EditPolicy
+ */
+ public static final String LABEL_ALIGNMENT_KEY = "Label Alignment"; //$NON-NLS-1$
+
+
+ /** Integer corresponding to the alignment type ( p.e. Left = 1, Bottom = 32) */
+ private int alignment ;
+
+ /** Current edit Part */
+ private GraphicalEditPart label ;
+
+ /** Reference rectangle on which the Label is aligned */
+ private Rectangle refBounds;
+
+ /** Bounds of the current label */
+ private Rectangle bounds;
+
+ /**
+ * Get Command associate to the corresponding Request
+ * Only REQ_ALIGN request return a Command
+ * @return Command to move the label in case of REQ_ALIGN, null if not.
+ * @param request Request for which a command is required.
+ */
+ public Command getCommand(Request request) {
+ Command cmd = null;
+ if (REQ_ALIGN.equals(request.getType())){
+ cmd = getAlignLabelCommand ((AlignmentRequest) request);
+ }
+ return cmd;
+ }
+
+ /**
+ * Get The alignment Command for the corresponding Alignment Request.
+ * This method transforms the alignment Request into a move request and return the move command associated to this new Request.
+ *
+ * @param request Alignment Request for which the Alignment Command is returned
+ * @return Alignment command
+ */
+ private Command getAlignLabelCommand(AlignmentRequest request) {
+
+ alignment = request.getAlignment();
+ // get the Alignment rectangle on which the selected edit part should be aligned.
+ refBounds = request.getAlignmentRectangle().getCopy();
+
+ label = (GraphicalEditPart) getHost();
+ bounds = getAbsolutePosition(label);
+
+ Point moveDelta = new Point(0, 0);
+
+ if (isAlignmentAllowed()){
+ switch (alignment ){
+ case PositionConstants.LEFT:
+ moveDelta.setX(refBounds.x - bounds.x );
+ break;
+ case PositionConstants.RIGHT:
+ moveDelta.setX(refBounds.getRight().x - bounds.getRight().x );
+ break;
+ case PositionConstants.TOP:
+ moveDelta.setY(refBounds.y - bounds.y );
+ break;
+ case PositionConstants.BOTTOM:
+ moveDelta.setY(refBounds.getBottom().y - bounds.getBottom().y );
+ break;
+ case PositionConstants.CENTER:
+ moveDelta.setX(refBounds.getTop().x - bounds.getTop().x );
+ break;
+ case PositionConstants.MIDDLE:
+ moveDelta.setY(refBounds.getLeft().y - bounds.getLeft().y );
+ break;
+ }
+
+
+ //build the Move request
+ ChangeBoundsRequest req = new ChangeBoundsRequest(REQ_MOVE);
+
+ req.setEditParts(((ChangeBoundsRequest)request).getEditParts());
+ req.setMoveDelta(moveDelta);
+ req.setExtendedData(request.getExtendedData());
+
+ return getHost().getCommand(req);
+
+ }
+ else {
+ // if alignment not allowed return no command
+ return null;
+
+ }
+
+ }
+
+ /**
+ * Determine if the current edit part can be aligned.
+ *
+ * The label cannot be aligned if its connector target or source moves as well
+ * Because if the source/target moves, the connector moves as well and the label linked to the connector translates with the Edge
+ * Same if the Affixed node is selected.
+ */
+ private boolean isAlignmentAllowed() {
+ EditPart parent = label.getParent();
+ boolean isAllow = true;
+ if (parent instanceof AbstractConnectionEditPart){
+ // Label alignment is not allowed if it should moves at the same time as the connector
+ // That means if the Source or target of the connector is part of the selection
+ int sourceSelectionType = ((ConnectionEditPart)label.getParent()).getSource().getSelected();
+ int targetSelectionType = ((ConnectionEditPart)label.getParent()).getTarget().getSelected();
+
+ isAllow = !((sourceSelectionType == EditPart.SELECTED)||(targetSelectionType == EditPart.SELECTED)) ;
+
+ } else if (parent instanceof AbstractBorderItemEditPart) {
+ // if the label is an affixed label and if the affixed node is part of the selection, the label is not aligned
+ isAllow = !(parent.getSelected() == EditPart.SELECTED);
+ }
+
+ return isAllow;
+ }
+
+
+ /**
+ *
+ * A {@link Rectangle} with the absolute position from the {@link EditPart}
+ *
+ * @param ep
+ * the {@link EditPart} that we want the position
+ * @return a {@link Rectangle} with the absolute position from the {@link EditPart}
+ *
+ */
+ public static Rectangle getAbsolutePosition(EditPart ep) {
+ GraphicalEditPart part = (GraphicalEditPart)ep;
+ Rectangle rect = part.getFigure().getBounds().getCopy();
+ part.getFigure().translateToAbsolute(rect);
+ return rect;
+ }
+
+
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
index 93bd6729a22..feb51a41be1 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/part/AbstractElementLabelEditPart.java
@@ -9,6 +9,7 @@
* Contributors:
*
* CEA LIST - Initial API and implementation
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Add LabelAlignment EditPolicy
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.edit.part;
@@ -72,6 +73,7 @@ import org.eclipse.papyrus.gmf.diagram.common.locator.TextCellEditorLocator;
import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
import org.eclipse.papyrus.infra.gmfdiag.common.commands.SemanticAdapter;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.LabelAlignmentEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.preferences.PreferencesConstantsHelper;
import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
@@ -128,6 +130,7 @@ public abstract class AbstractElementLabelEditPart extends LabelEditPart impleme
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new TextSelectionEditPolicy());
installEditPolicy(EditPolicyRoles.SNAP_FEEDBACK_ROLE, new DefaultSnapBackEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new LabelDefaultSemanticEditPolicy());
+ installEditPolicy(LabelAlignmentEditPolicy.LABEL_ALIGNMENT_KEY, new LabelAlignmentEditPolicy());
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/layout/AlignmentTree.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/layout/AlignmentTree.java
index 07c3e25438e..9057e05829d 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/layout/AlignmentTree.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/layout/AlignmentTree.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010- 2014 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Céline Janssens (All4TEC) celine.Janssens@all4tec.net - Bug 440224: Label Alignment
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.common.layout;
@@ -18,7 +19,9 @@ import java.util.List;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.gef.EditPart;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
import org.eclipse.gef.tools.ToolUtilities;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart;
/**
*
@@ -89,13 +92,31 @@ public class AlignmentTree extends EditPartTree {
// shift between the two positions
Point shift = newParentLocation.getTranslated(oldParentLocation.getNegated());
-
+ PrecisionRectangle oldContainerBounds;
// we want know the final position for the container
- PrecisionRectangle oldContainerBounds = LayoutUtils.getAbsolutePosition(this.getEditPart().getParent());
+ if (getEditPart().getParent() instanceof AbstractBorderItemEditPart) {
+ // in case of Port Label the container is the grand grand parent
+ oldContainerBounds = LayoutUtils.getAbsolutePosition(getEditPart().getParent().getParent().getParent());
+ }else if (getEditPart().getParent() instanceof AbstractConnectionEditPart){
+ // in case of edge label the container is the grand parent
+ oldContainerBounds = LayoutUtils.getAbsolutePosition(getEditPart().getParent().getParent());
+ }else{
+ // in all the case the container is the direct parent
+ oldContainerBounds = LayoutUtils.getAbsolutePosition(getEditPart().getParent());
+ }
newContainerBounds = new PrecisionRectangle(oldContainerBounds);
newContainerBounds.translate(shift);
} else {// treeParent is the root of the tree
- EditPart containerEditPart = this.getEditPart().getParent();
+ EditPart containerEditPart;
+ // in case of a label, the container is the grand-parent
+ if (getEditPart().getParent() instanceof AbstractConnectionEditPart ) {
+ containerEditPart = getEditPart().getParent().getParent();
+ } else if (getEditPart().getParent() instanceof AbstractBorderItemEditPart) {
+ containerEditPart = getEditPart().getParent().getParent().getParent();
+ } else {
+ containerEditPart = getEditPart().getParent();
+ }
+
newContainerBounds = LayoutUtils.getAbsolutePosition(containerEditPart);
}
return newContainerBounds;
@@ -109,11 +130,21 @@ public class AlignmentTree extends EditPartTree {
* moved, and the editpart hasn't moved
*/
public PrecisionRectangle getAbsolutePositionInTheNewContainerPosition() {
- PrecisionRectangle newPosition = new PrecisionRectangle(LayoutUtils.getAbsolutePosition(getEditPart()));
+ EditPart editPart = getEditPart();
+ EditPart parent = editPart.getParent();
+ PrecisionRectangle oldContainerPosition;
+ PrecisionRectangle newPosition = new PrecisionRectangle(LayoutUtils.getAbsolutePosition(editPart));
PrecisionRectangle newContainerPosition = getNewContainerBounds();
- PrecisionRectangle oldContainerPosition = LayoutUtils.getAbsolutePosition(getEditPart().getParent());
- PrecisionRectangle distance = (PrecisionRectangle)newContainerPosition.translate(oldContainerPosition.getLocation().getNegated());
- return (PrecisionRectangle)newPosition.translate(distance.getLocation());
+ if (parent instanceof AbstractConnectionEditPart){
+ oldContainerPosition = LayoutUtils.getAbsolutePosition(parent.getParent());
+ }else if (parent instanceof AbstractBorderItemEditPart){
+ oldContainerPosition = LayoutUtils.getAbsolutePosition(parent.getParent().getParent());
+ }else {
+ oldContainerPosition = LayoutUtils.getAbsolutePosition(parent);
+ }
+
+ PrecisionRectangle absoluteNewContainer = (PrecisionRectangle)newContainerPosition.translate(oldContainerPosition.getLocation().getNegated());
+ return (PrecisionRectangle)newPosition.translate(absoluteNewContainer.getLocation());
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomPortNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomPortNameEditPart.java
new file mode 100644
index 00000000000..fc550ae84d4
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomPortNameEditPart.java
@@ -0,0 +1,48 @@
+package org.eclipse.papyrus.uml.diagram.component.custom.factory;
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * 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:
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 440224 : Label Alignment
+ *
+ *****************************************************************************/
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.component.edit.parts.PortNameEditPart;
+
+public class CustomPortNameEditPart extends PortNameEditPart {
+
+ public CustomPortNameEditPart(View view) {
+ super(view);
+
+ }
+
+
+ /**
+ *Refresh Bounds of PortName EditPart in case of Move
+ */
+ @Override
+ public void refreshBounds() {
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+
+ // Update locator constraint
+ IBorderItemLocator locator = getBorderItemLocator();
+ locator.setConstraint(new Rectangle(x, y, width, height));
+
+ // Set new constraint on parent figure
+ getFigure().getParent().setConstraint(getFigure(), locator);
+
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomUMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomUMLEditPartFactory.java
index 724d07b279a..59e1dc755cf 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomUMLEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/factory/CustomUMLEditPartFactory.java
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.uml.diagram.component.edit.parts.ModelEditPart;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.ModelEditPartCN;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.PackageEditPart;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.PackageEditPartCN;
+import org.eclipse.papyrus.uml.diagram.component.edit.parts.PortNameEditPart;
import org.eclipse.papyrus.uml.diagram.component.edit.parts.UMLEditPartFactory;
import org.eclipse.papyrus.uml.diagram.component.part.UMLVisualIDRegistry;
@@ -48,6 +49,8 @@ public class CustomUMLEditPartFactory extends UMLEditPartFactory {
return new CustomDependencyNodeEditPart(view);
case DependencyBranchEditPart.VISUAL_ID:
return new CustomDependencyBranchEditPart(view);
+ case PortNameEditPart.VISUAL_ID:
+ return new CustomPortNameEditPart(view);
}
}
return super.createEditPart(context, model);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java
index 1bd3a2c11a4..1722c7e84c9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src/org/eclipse/papyrus/uml/diagram/component/edit/parts/PortNameEditPart.java
@@ -9,6 +9,7 @@
*
* Contributors:
* Amine EL KOUHEN (CEA LIST/LIFL) & Nizar GUEDIDI (CEA LIST) - Initial API and implementation
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 440224 Label Alignment
/*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.component.edit.parts;
@@ -61,10 +62,12 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.LabelAlignmentEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.PortLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.PropertyLabelEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.component.edit.policies.UMLTextSelectionEditPolicy;
@@ -137,14 +140,18 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
}
/**
- * @generated
+ * @generated NOT
*/
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
+
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new PropertyLabelEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new PortLabelEditPolicy());
+ // New edit policy to allow Label Alignment
+ installEditPolicy(LabelAlignmentEditPolicy.LABEL_ALIGNMENT_KEY, new LabelAlignmentEditPolicy());
+
}
/**
@@ -169,6 +176,7 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
index 2bc06189538..0acba58f9b6 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomEditPartFactory.java
@@ -9,13 +9,14 @@
* Contributors:
*
* CEA LIST - Initial API and implementation
+ * Cline Janssens (ALL4TEC) celine.Janssens@all4tec.net - Bug 440224: Label Alignment
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.uml.diagram.composite.edit.parts.BehaviorPortEditPart;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortNameEditPart;
import org.eclipse.papyrus.uml.diagram.composite.edit.parts.UMLEditPartFactory;
import org.eclipse.papyrus.uml.diagram.composite.part.UMLVisualIDRegistry;
@@ -38,8 +39,10 @@ public class CustomEditPartFactory extends UMLEditPartFactory {
case ConnectorMultiplicityTargetEditPart.VISUAL_ID:
return new ConnectorMultiplicityTargetEditPart(view);
+
+ case PortNameEditPart.VISUAL_ID:
+ return new CustomPortNameEditPart(view);
-
}
}
return super.createEditPart(context, model);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortNameEditPart.java
new file mode 100644
index 00000000000..63614d0ec32
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/parts/CustomPortNameEditPart.java
@@ -0,0 +1,49 @@
+package org.eclipse.papyrus.uml.diagram.composite.custom.edit.parts;
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * 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:
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 440224 : Label Alignment
+ *
+ *****************************************************************************/
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.uml.diagram.composite.edit.parts.PortNameEditPart;
+
+public class CustomPortNameEditPart extends PortNameEditPart {
+
+ public CustomPortNameEditPart(View view) {
+ super(view);
+
+ }
+
+
+ /**
+ *Refresh Bounds of PortName EditPart in case of Move
+ */
+ @Override
+ public void refreshBounds() {
+ int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
+
+ // Update locator constraint
+ IBorderItemLocator locator = getBorderItemLocator();
+ locator.setConstraint(new Rectangle(x, y, width, height));
+
+ // Set new constraint on parent figure
+ getFigure().getParent().setConstraint(getFigure(), locator);
+
+ }
+
+
+} \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
index f517a9992c5..f91b8948159 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java
@@ -9,6 +9,7 @@
*
* Contributors:
* Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Bug 440224 Label Alignment
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
@@ -16,17 +17,23 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.edit.policies;
import java.util.Collections;
import java.util.List;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gef.requests.AlignmentRequest;
import org.eclipse.gef.requests.ChangeBoundsRequest;
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;
import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.internal.figures.BorderItemContainerFigure;
import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.notation.View;
@@ -53,8 +60,14 @@ public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEdi
// FeedBack - Port + Delta
Rectangle updatedRect = new Rectangle();
PrecisionRectangle initialRect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
- updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated());
+ // in case of bordered item figure bounds is 1x1, real parent figure is then the grandParent
+ if (getHostFigure().getParent() instanceof BorderItemContainerFigure){
+ updatedRect = initialRect.getTranslated(getHostFigure().getParent().getParent().getBounds().getLocation().getNegated());
+ }else{
+ updatedRect = initialRect.getTranslated(getHostFigure().getParent().getBounds().getLocation().getNegated());
+ }
updatedRect = updatedRect.getTranslated(request.getMoveDelta());
+
// translate the feedback figure
PrecisionRectangle rect = new PrecisionRectangle(getInitialFeedbackBounds().getCopy());
@@ -64,6 +77,11 @@ public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEdi
getHostFigure().translateToRelative(rect);
ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View)editPart.getModel()), updatedRect);
+
return new ICommandProxy(moveCommand);
+
}
+
+
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
index 7adf20f03c3..3c91ae93974 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/src/org/eclipse/papyrus/uml/diagram/composite/edit/parts/PortNameEditPart.java
@@ -9,6 +9,7 @@
*
* Contributors:
* Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Cline Janssens (All4TEC) celine.Janssens@all4tec.net - Bug 440224 : Label Alignment
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.edit.parts;
@@ -63,7 +64,8 @@ import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
import org.eclipse.papyrus.infra.emf.appearance.helper.NameLabelIconHelper;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.LabelAlignmentEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
import org.eclipse.papyrus.uml.diagram.common.editparts.ILabelRoleProvider;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
@@ -140,13 +142,16 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
}
/**
- * @generated
+ * @generated NOT
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
+
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new PortLabelEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
+ installEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY, new PortLabelEditPolicy());
+ // New Edit Policy for the Label Alignment
+ installEditPolicy(LabelAlignmentEditPolicy.LABEL_ALIGNMENT_KEY, new LabelAlignmentEditPolicy());
}
/**
@@ -170,6 +175,9 @@ public class PortNameEditPart extends LabelEditPart implements ITextAwareEditPar
int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue();
int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue();
getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height));
+
+
+
}
/**
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/AlignActionHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/AlignActionHelper.java
new file mode 100644
index 00000000000..d367d427db8
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/AlignActionHelper.java
@@ -0,0 +1,356 @@
+package org.eclipse.papyrus.uml.diagram.menu.actions;
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Code refractor and documentation
+ *
+ *****************************************************************************/
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.PrecisionRectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gef.tools.ToolUtilities;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.layout.EditPartTree;
+import org.eclipse.papyrus.uml.diagram.common.layout.LayoutUtils;
+
+
+/**
+ * Helper for the CustomAlignAction class.
+ * It contains all the technical methods required for the Alignment.
+ * Basically, it makes the CustomAlignAction class lighter.
+ *
+ * @author Cline JANSSENS
+ *
+ */
+public class AlignActionHelper {
+
+ private CustomAlignAction action;
+
+ /**
+ * Default Constructor
+ */
+ public AlignActionHelper() {
+ // Default constructor
+ }
+
+ /**
+ * Constructor
+ * @param customAlignAction
+ */
+ public AlignActionHelper(CustomAlignAction customAlignAction){
+ this.action = customAlignAction;
+
+ }
+
+ /**
+ * Create the new bounds of the unselected child of an EditPartTree compare to the RefEP.
+ *
+ * @param ept EditPartTree where there is an Unselected Child
+ * @param refEP Reference EditPart
+ * @return Bounds Rectangle of the unselected Child
+ */
+ protected PrecisionRectangle getUnselectedChildNewBounds(EditPartTree ept, EditPart refEP) {
+ PrecisionRectangle boundsLimit = null;
+ List<EditPart> parent = new ArrayList<EditPart>(1);
+ parent.add(ept.getEditPart());
+ int distance = ept.getDistanceWithTheFirstUnselectedChild();
+ EditPartTree unselectedTree = ept.getFirstUnselectedChild();
+
+ //we don't need to correct unselected element location when the reference is not inside them
+ if(ToolUtilities.isAncestorContainedIn(parent, refEP)) {
+ boundsLimit = new PrecisionRectangle(LayoutUtils.getAbsolutePosition(unselectedTree.getEditPart()));
+ //we increase the size of the child, to avoid scrollbar in its parent
+ boundsLimit.setPreciseX(boundsLimit.x - (distance * LayoutUtils.scrollBarSize));
+ boundsLimit.setPreciseY(boundsLimit.y - (distance * LayoutUtils.scrollBarSize));
+ boundsLimit.setPreciseWidth(boundsLimit.width + (2 * distance * LayoutUtils.scrollBarSize));
+ boundsLimit.setPreciseHeight(boundsLimit.height + (2 * distance * LayoutUtils.scrollBarSize));
+ if(action.getAlignment() == PositionConstants.TOP) {
+ double dist = getLabelHeightToRemove(ept);
+ boundsLimit.setPreciseY(boundsLimit.y() - dist);
+ }
+ }
+ return boundsLimit;
+ }
+
+
+ /**
+ * Returns the height of the label for the current editpart contained in {@code ept}, more the height of the children's label
+ *
+ * @param ept
+ * The {@link EditPartTree} containing the {@link EditPart} used to calculate height
+ * @return
+ * The height of the label for the current editpart, more the height of the children's label
+ *
+ */
+ protected double getLabelHeightToRemove(EditPartTree ept) {
+ double dist = 0;
+ List<?> children = ept.getEditPart().getChildren();
+ //we search the correct compartment
+ for(int iter = 0; iter < children.size(); iter++) {
+ if(children.get(iter) instanceof CompartmentEditPart) {
+ CompartmentEditPart child = (CompartmentEditPart)children.get(iter);
+ EditPolicy policy = child.getEditPolicy(EditPolicy.LAYOUT_ROLE);
+ if(policy != null) {
+ PrecisionRectangle cptSize = LayoutUtils.getAbsolutePosition(child);
+ dist += cptSize.y() - LayoutUtils.getAbsolutePosition(ept.getEditPart()).y();
+ break;
+ }
+ }
+ }
+ Enumeration<?> eptChildren = ept.children();
+ double max = 0;
+ while(eptChildren.hasMoreElements()) {
+ EditPartTree currentElement = (EditPartTree)eptChildren.nextElement();
+ if(currentElement.isSelected() && (!currentElement.isReference())) {
+ double tmp = getLabelHeightToRemove(currentElement);
+ max = (tmp > max) ? tmp : max;
+ }
+ }
+ dist += max;
+ return dist;
+ }
+
+
+ /**
+ * Tests the selection (nodes and edges). If Selection contains nodes (or Labels) and edges the method returns true
+ * If it contains only nodes and labels, or only Edges
+ * @param editparts
+ *
+ * @return
+ * <ul>
+ * <li> {@code true}</li> if the selection contains links and nodes
+ * <li> {@code false}</li> if not
+ * </ul>
+ *
+ */
+ protected boolean isMixedSelection(List<?> editparts) {
+ boolean node = false;
+ boolean edge = false;
+ boolean isMixed = ((node) && (edge));
+
+ Iterator<?> iter = editparts.iterator();
+ while(iter.hasNext() && !isMixed){
+ if(iter.next() instanceof AbstractConnectionEditPart) {
+ edge = true;
+ } else {
+ node = true;
+ }
+ isMixed = ((node) && (edge));
+ }
+
+ return isMixed;
+
+
+ }
+
+ /**
+ * Create a List of editPart from an EditPartTree from the root element to the passed element.
+ * @param ept The EditPartTree we want the Path from the root
+ * @return the List of EditPart with the Path from the root to the EditPartTree
+ */
+ protected List<EditPart> getPathRootEditPartList(EditPartTree ept) {
+ List<EditPart> nodeChild = new ArrayList<EditPart>();
+
+ //used to calculate the shift between each element!
+ Enumeration<?> vectorisedChildren = ((EditPartTree)ept.getPath()[1]).breadthFirstEnumeration();
+ while(vectorisedChildren.hasMoreElements()) {
+ nodeChild.add(((EditPartTree)vectorisedChildren.nextElement()).getEditPart());
+ }
+ return nodeChild;
+ }
+
+ /**
+ * Add scrollbar width to the Rectangle bounds to avoid to show them
+ * @param containerBounds
+ */
+ protected void addScrollBar(PrecisionRectangle containerBounds) {
+ containerBounds.setPreciseX(containerBounds.x + LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseY(containerBounds.y + LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseWidth(containerBounds.width - 2 * LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseHeight(containerBounds.height - 2 * LayoutUtils.scrollBarSize);
+
+ }
+
+ /**
+ * Calculate the shift (level) between the EditPartTree and the Reference EP.
+ *
+ * @param ept EditPartTree
+ * @param refEP Reference EditPart
+ * @return shift (number of level) between ept and refEP
+ */
+ protected int getShift(EditPartTree ept, EditPart refEP) {
+ /*
+ * calculus of the shift
+ *
+ * the shift is the first selected element when the reference is not a child of the editpart
+ * the shift is the number of levels between the current editpart and the reference if this reference is a child
+ */
+ int level;
+ if(ToolUtilities.isAncestorContainedIn(getPathRootEditPartList(ept), refEP)) {
+ level = action.getRootTree().getTree(refEP).getLevel();
+ int currentLevel = ept.getLevel();
+ level = level - currentLevel + 1;
+
+ } else{
+ level = ept.getLevelForFirstSelectedElement();
+ }
+ return level;
+ }
+
+
+
+ /**
+ * Tests if all the selected elements are instance of {@linkplain AbstractConnectionEditPart}
+ *
+ * @param editparts
+ * the editparts list to test
+ * @return
+ * <ul>
+ * <li> {@code true}</li> if all the editparts represents a link
+ * <li>{@code false}</li> if not
+ * </ul>
+ */
+ protected boolean isLinkSelection(List<?> editparts) {
+ if(editparts.size() == 0) {
+ return false;
+ }
+ for(Object object : editparts) {
+ if(!(object instanceof AbstractConnectionEditPart)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ /**
+ * Define if Alignment is allowed.
+ * @param editparts
+ * @return
+ */
+ protected boolean isAlignAllowed(List<EditPart> editparts) {
+
+ boolean alignAllowable = true;
+ // Alignment is not allowed if selection is a mixed with edges and nodes (or labels)
+ alignAllowable = alignAllowable && !isMixedSelection(editparts);
+
+ return alignAllowable;
+ }
+
+ /**
+ * Return the list of Edit Parts based on the selected Elements.
+ * @return
+ * List of EditParts
+ */
+ protected List<EditPart> getEditPartList() {
+ List<EditPart> editparts = new ArrayList<EditPart>();
+ for(IGraphicalEditPart current : action.getSelectedElements()) {
+ editparts.add(current);
+ }
+ return editparts;
+ }
+
+
+ /**
+ * Adjust AlignBounds to take scrollBar size into account in order to avoid to show them.
+ *
+ * @param alignRef The reference bounds to modify
+ * @param boundsRef Absolute bounds of reference EP
+ * @param ept EditPartTree
+ * @param refEP Reference EditPart
+ */
+ protected void adjustAlignRefBounds(PrecisionRectangle alignRef,
+ PrecisionRectangle boundsRef, EditPartTree ept, EditPart refEP) {
+
+ // AlignRef Bounds should not be adjust in case of LabelEdit Part
+ if( !(ept.getEditPart() instanceof LabelEditPart) ){
+
+ int level = getShift(ept, refEP);
+
+ // depends on the alignment modify the reference rectangle
+ switch(action.getAlignment()) {
+ case PositionConstants.LEFT:
+ alignRef.setPreciseX(boundsRef.x - ((level - 1) * LayoutUtils.scrollBarSize));
+ alignRef.setPreciseWidth(boundsRef.width + 2 * ((level - 1) * LayoutUtils.scrollBarSize));
+ break;
+ case PositionConstants.CENTER:
+ break;
+ case PositionConstants.RIGHT:
+
+ alignRef.setPreciseX(boundsRef.x + ((-level + 1) * LayoutUtils.scrollBarSize));
+ alignRef.setPreciseWidth(boundsRef.preciseWidth() - 2 * ((-level + 1) * LayoutUtils.scrollBarSize));
+ break;
+
+ case PositionConstants.BOTTOM:
+ alignRef.setPreciseY(boundsRef.y + ((-level + 1) * LayoutUtils.scrollBarSize));
+ alignRef.setPreciseHeight(boundsRef.preciseHeight() - 2 * ((-level + 1) * LayoutUtils.scrollBarSize));
+ break;
+ case PositionConstants.MIDDLE:
+ // get the size of the highest child
+ double heightMax = 0;
+ Enumeration<?> children = ept.children();
+ while(children.hasMoreElements()) {
+ EditPartTree currentChild = (EditPartTree)children.nextElement();
+ double height = LayoutUtils.getAbsolutePosition(currentChild.getEditPart()).preciseHeight();
+ heightMax = Math.max(height, heightMax);
+ }
+
+
+ // get the size of the compartment for this figure!
+ List<?> childrenEP = ept.getEditPart().getChildren();
+ double compartmentHeight = 0;
+ Iterator<?> iter = childrenEP.iterator();
+ while(iter.hasNext() && compartmentHeight == 0){
+ if(iter.next() instanceof CompartmentEditPart) {
+ CompartmentEditPart child = (CompartmentEditPart)iter.next();
+ EditPolicy policy = child.getEditPolicy(EditPolicy.LAYOUT_ROLE);
+ if(policy != null) {
+ compartmentHeight = LayoutUtils.getAbsolutePosition(child).preciseHeight();
+ }
+ }
+ }
+
+ double heightToRemove = getLabelHeightToRemove(ept);
+ //test to know if the initial alignment is possible without seeing the scrollbar
+ if(compartmentHeight < (heightMax + LayoutUtils.scrollBarSize + heightToRemove)) {
+ alignRef.setPreciseY(alignRef.y - heightToRemove);
+ alignRef.setPreciseHeight(alignRef.preciseHeight() + heightToRemove);
+ }
+
+ break;
+ case PositionConstants.TOP: //here we can have a problem with the label for the element inheriting from Package
+ alignRef.setPreciseY(boundsRef.y - ((level - 1) * LayoutUtils.scrollBarSize));
+ alignRef.setPreciseHeight(boundsRef.preciseHeight() + 2 * ((level - 1) * LayoutUtils.scrollBarSize));
+
+ // we don't want that the scrollbar appears, with the top alignment, we need to consider the label of the container element
+ if(ept.children().hasMoreElements()) {
+ double dist = getLabelHeightToRemove(ept);
+ alignRef.setPreciseY(alignRef.y() - dist);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ }
+
+
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/CustomAlignAction.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/CustomAlignAction.java
index 66b433fcee0..10984180be1 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/CustomAlignAction.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/CustomAlignAction.java
@@ -8,17 +8,18 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Cline Janssens (ALL4TEC) celine.janssens@all4tec.net - Code refactor and documentation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.menu.actions;
-import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
@@ -26,7 +27,6 @@ import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.editparts.AbstractConnectionEditPart;
import org.eclipse.gef.requests.AlignmentRequest;
import org.eclipse.gef.tools.ToolUtilities;
import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
@@ -63,11 +63,16 @@ public class CustomAlignAction {
*/
private AlignmentTree rootTree;
+
/** The alignment. */
private int alignment;
-
/** the selected elements */
private List<IGraphicalEditPart> selectedElements;
+ /** List of selected edit Parts*/
+ private List<EditPart> editparts;
+
+ /** Helper for specific treatment*/
+ private AlignActionHelper helper = new AlignActionHelper(this);
/**
*
@@ -81,7 +86,6 @@ public class CustomAlignAction {
this.selectedElements = selectedElements;
}
-
/**
* Returns the command for this action
*
@@ -89,41 +93,68 @@ public class CustomAlignAction {
* the command for this action
*/
public Command getCommand() {
- List<EditPart> editparts = new ArrayList<EditPart>();
- for(IGraphicalEditPart current : this.selectedElements) {
- editparts.add(current);
+
+ editparts = helper.getEditPartList();
+
+ Command cmd = null;
+
+ // In case of alignment not allowed no command is returned.
+ if (!helper.isAlignAllowed(editparts)){
+ cmd = UnexecutableCommand.INSTANCE;
}
- if(!isMixedSelection(editparts)) {//if selection contains links and nodes, we do nothing
- if(isLinkSelection(editparts)) {
- AlignmentLinkHelper helper = new AlignmentLinkHelper(editparts, alignment);
- return helper.createCommand();
- }
+ // In case of only Edges selected, a specific alignment is done
+ if(helper.isLinkSelection(editparts)) {
+ // Align Source and target Nodes of the edge depending on the alignment type
+ AlignmentLinkHelper helper = new AlignmentLinkHelper(editparts, alignment);
+ cmd = helper.createCommand();
+ }
- if(editparts.size() >= 2) {
- rootTree = new AlignmentTree(editparts);
+ // If only 1 Nodes is selected no Alignment is possible
+ if(editparts.size() < 2) {
+ cmd = UnexecutableCommand.INSTANCE;
- createRequests(editparts);
+ }else{
- CompoundCommand command = new CompoundCommand("Alignment Command"); //$NON-NLS-1$
- Enumeration eptEnum = rootTree.breadthFirstEnumeration();
- while(eptEnum.hasMoreElements()) {
- EditPartTree ept = (EditPartTree)eptEnum.nextElement();
- if(ept.getEditPart() != null) {
- AlignmentRequest currentReq = (AlignmentRequest)ept.getRequest();
- if(currentReq != null) {
- Command curCommand = null;
- curCommand = ept.getEditPart().getCommand(currentReq);
- if(curCommand != null) {
- command.add(curCommand);
- }
- }
+ rootTree = new AlignmentTree(editparts);
+ // create the alignment requests
+ createRequests();
+ // return the associated command
+ cmd = getAlignmentCommand();
+ }
+
+ return cmd;
+ }
+
+ /**
+ * Get the Alignment Commands of selected editParts
+ * @return
+ * the Command related to the selected editParts and the Alignment Request
+ */
+ private Command getAlignmentCommand() {
+
+ CompoundCommand commands = new CompoundCommand("Alignment Commandssss"); //$NON-NLS-1$
+ // Create a enumeration with the sub tree element ordered by breadth
+ Enumeration<?> eptEnum = rootTree.breadthFirstEnumeration();
+ while(eptEnum.hasMoreElements()) {//for each selected element
+ // Create an EditPartTree - hierarchy between selected editparts
+ EditPartTree ept = (EditPartTree)eptEnum.nextElement();
+
+ if(ept.getEditPart() != null) {
+ // get the alignment request associated to the EditPartTree
+ AlignmentRequest currentReq = (AlignmentRequest)ept.getRequest();
+ if(currentReq != null) {
+ Command curCommand = null;
+ // if this request is not null, get the associated command for this editPart
+ curCommand = ept.getEditPart().getCommand(currentReq);
+ if(curCommand != null) {
+ // Add it to the compound command
+ commands.add(curCommand);
}
}
- return command.isEmpty() ? UnexecutableCommand.INSTANCE : (Command)command;
}
}
- return UnexecutableCommand.INSTANCE;
+ return commands.isEmpty() ? UnexecutableCommand.INSTANCE : (Command)commands;
}
/**
@@ -138,178 +169,56 @@ public class CustomAlignAction {
* @param request
* the initial request
*/
- protected void createRequests(List<?> editparts) {
+ protected void createRequests() {
+ // The reference EP is the last selected
EditPart refEP = (EditPart)editparts.get(editparts.size() - 1);
+ // Get absolute bounds of the Ref EP
PrecisionRectangle boundsRef = LayoutUtils.getAbsolutePosition(refEP);
+ // Get the depth of the Align Tree
int depth = this.rootTree.getDepth();
for(int i = 1; i <= depth; i++) {//we iterate by level in the rootTree
List<EditPartTree> epTrees = rootTree.getChildLevel(i);
-
-
- for(EditPartTree ept : epTrees) {//we create the request for each children
- List<EditPart> nodeChild = new ArrayList<EditPart>();
-
- //used to calculate the shift between each element!
- Enumeration vectorisedChildren = ((EditPartTree)ept.getPath()[1]).breadthFirstEnumeration();
- while(vectorisedChildren.hasMoreElements()) {
- nodeChild.add(((EditPartTree)vectorisedChildren.nextElement()).getEditPart());
- }
-
+
+ for(EditPartTree ept : epTrees) {
+ List<EditPart> nodeChild = helper.getPathRootEditPartList(ept);
+
if(ept.isSelected()) {//the edit part is selected
if(ept.getEditPart() != refEP && (!ept.existsUnselectedChild())) {
- /*
- * calculus of the shift
- *
- * the shift is the first selected element when the reference is not a child of the editpart
- * the shift is the number of levels between the current editpart and the reference if this reference is a child
- */
- int level = ept.getLevelForFirstSelectedElement();
- if(ToolUtilities.isAncestorContainedIn(nodeChild, refEP)) {
- level = rootTree.getTree(refEP).getLevel();
- int currentLevel = ept.getLevel();
- level = level - currentLevel + 1;
- }
-
- /* collection used to test if the ept.getEditPart() contains the refEP */
- List<EditPart> coll = new ArrayList<EditPart>(1);
- coll.add(ept.getEditPart());
- /* the reference used for the alignment */
+ // the reference used for the alignment
PrecisionRectangle alignRef = new PrecisionRectangle(boundsRef);
-
PrecisionRectangle containerBounds = ((AlignmentTree)ept).getNewContainerBounds();
-
+ // if container bounds is not the same as diagram then take the scrollbar width into account
if(!containerBounds.equals(LayoutUtils.getAbsolutePosition(ept.getEditPart().getRoot()))) {
- containerBounds.setX(containerBounds.preciseX + LayoutUtils.scrollBarSize);
- containerBounds.setY(containerBounds.preciseY + LayoutUtils.scrollBarSize);
- containerBounds.setWidth(containerBounds.preciseWidth - 2 * LayoutUtils.scrollBarSize);
- containerBounds.setHeight(containerBounds.preciseHeight - 2 * LayoutUtils.scrollBarSize);
+ helper.addScrollBar(containerBounds);
}
- switch(this.alignment) {
- case PositionConstants.LEFT:
- alignRef.setX(boundsRef.preciseX - ((level - 1) * LayoutUtils.scrollBarSize));
- alignRef.setWidth(boundsRef.preciseWidth + 2 * ((level - 1) * LayoutUtils.scrollBarSize));
-
- break;
- case PositionConstants.CENTER://Useful?
- // alignRef.setX(boundsRef.preciseX - ((level - 1) * LayoutUtils.scrollBarSize));
- // alignRef.setWidth(boundsRef.preciseWidth + 2 * ((level - 1) * LayoutUtils.scrollBarSize));
- break;
- case PositionConstants.RIGHT:
-
- alignRef.setX(boundsRef.preciseX + ((-level + 1) * LayoutUtils.scrollBarSize));
- alignRef.setWidth(boundsRef.preciseWidth - 2 * ((-level + 1) * LayoutUtils.scrollBarSize));
- break;
-
- case PositionConstants.BOTTOM:
- alignRef.setY(boundsRef.preciseY + ((-level + 1) * LayoutUtils.scrollBarSize));
- alignRef.setHeight(boundsRef.preciseHeight - 2 * ((-level + 1) * LayoutUtils.scrollBarSize));
- break;
- case PositionConstants.MIDDLE://here we can have a problem with the label for the element inheriting from Package
-
- //useful?
- // alignRef.setY(boundsRef.preciseY - ((level - 1) * LayoutUtils.scrollBarSize));
- // alignRef.setHeight(boundsRef.preciseHeight + 2 * ((level - 1) * LayoutUtils.scrollBarSize));
-
- /*
- * we don't want that the scrollbar appears
- * with the top alignment, we need to consider the label of the container element
- */
-
-
- /* obtain the size of the highest child */
- double heightMax = 0;
- Enumeration children = ept.children();
- while(children.hasMoreElements()) {
- EditPartTree currentChild = (EditPartTree)children.nextElement();
- double height = LayoutUtils.getAbsolutePosition(currentChild.getEditPart()).preciseHeight();
- heightMax = (height > heightMax) ? height : heightMax;
- }
-
-
- /* obtain the size of the compartment for this figure! */
- List childrenEP = ept.getEditPart().getChildren();
- double compartmentHeight = 0;
- for(int iter = 0; iter < childrenEP.size(); iter++) {
- if(childrenEP.get(iter) instanceof CompartmentEditPart) {
- CompartmentEditPart child = (CompartmentEditPart)childrenEP.get(iter);
- EditPolicy policy = child.getEditPolicy(EditPolicy.LAYOUT_ROLE);
- if(policy != null) {
- compartmentHeight = LayoutUtils.getAbsolutePosition(child).preciseHeight();
- break;
- }
- }
- }
-
- double heightToRemove = getLabelHeightToRemove(ept);
- //test to know if the initial alignment is possible without seeing the scrollbar
- if(compartmentHeight < (heightMax + LayoutUtils.scrollBarSize + heightToRemove)) {
- alignRef.setY(alignRef.preciseY - heightToRemove);
- alignRef.setHeight(alignRef.preciseHeight + heightToRemove);
- }
-
- break;
- case PositionConstants.TOP: //here we can have a problem with the label for the element inheriting from Package
- alignRef.setY(boundsRef.preciseY - ((level - 1) * LayoutUtils.scrollBarSize));
- alignRef.setHeight(boundsRef.preciseHeight + 2 * ((level - 1) * LayoutUtils.scrollBarSize));
- /*
- * we don't want that the scrollbar appears
- * with the top alignment, we need to consider the label of the container element
- */
- if(ept.children().hasMoreElements()) {
- double dist = getLabelHeightToRemove(ept);
- alignRef.setY(alignRef.preciseY() - dist);
- }
- break;
- default:
- break;
- }
+ // Adjust Ref Bounds with scrollbar, labels and compartment height
+ helper.adjustAlignRefBounds(alignRef, boundsRef, ept , refEP );
+ // create the request
createConstrainedRequest(alignRef, containerBounds, null, (AlignmentTree)ept);
-
+ //The current editPart has not selected child
} else if(ept.getEditPart() != refEP && (ept.existsUnselectedChild())) {
- List<EditPart> parent = new ArrayList<EditPart>(1);
- parent.add(ept.getEditPart());
-
- int distance = ept.getDistanceWithTheFirstUnselectedChild();
- EditPartTree unselectedTree = ept.getFirstUnselectedChild();
-
- PrecisionRectangle boundsLimit = null;
- //we needn't correct unselected element location when the reference is not inside them
- if(ToolUtilities.isAncestorContainedIn(parent, refEP)) {
- boundsLimit = new PrecisionRectangle(LayoutUtils.getAbsolutePosition(unselectedTree.getEditPart()));
- //we increase the size of the child, to avoid scrollbar in its parent
- boundsLimit.setX(boundsLimit.preciseX - (distance * LayoutUtils.scrollBarSize));
- boundsLimit.setY(boundsLimit.preciseY - (distance * LayoutUtils.scrollBarSize));
- boundsLimit.setWidth(boundsLimit.width + (2 * distance * LayoutUtils.scrollBarSize));
- boundsLimit.setHeight(boundsLimit.height + (2 * distance * LayoutUtils.scrollBarSize));
- if(this.alignment == PositionConstants.TOP) {
- double dist = getLabelHeightToRemove(ept);
- boundsLimit.setY(boundsLimit.preciseY() - dist);
- }
- }
+ PrecisionRectangle boundsLimit = helper.getUnselectedChildNewBounds(ept , refEP);
PrecisionRectangle containerBounds = ((AlignmentTree)ept).getNewContainerBounds();
if(!containerBounds.equals(LayoutUtils.getAbsolutePosition(ept.getEditPart().getRoot()))) {
//we reduce the container bounds used to avoid scrollbar
- containerBounds.setX(containerBounds.preciseX + LayoutUtils.scrollBarSize);
- containerBounds.setY(containerBounds.preciseY + LayoutUtils.scrollBarSize);
- containerBounds.setWidth(containerBounds.width - 2 * LayoutUtils.scrollBarSize);
- containerBounds.setHeight(containerBounds.height - 2 * LayoutUtils.scrollBarSize);
+ helper.addScrollBar(containerBounds);
}
createConstrainedRequest(boundsRef, containerBounds, boundsLimit, (AlignmentTree)ept);
} else if(ept.getEditPart() == refEP && ToolUtilities.isAncestorContainedIn(nodeChild, refEP)) {
- if(!((EditPartTree)ept.getParent()).isSelected()) {
- //nothing to do
- } else {
+
+ if(((EditPartTree)ept.getParent()).isSelected()) {
+
/*
* we need to create a command for the reference, only if
@@ -318,35 +227,31 @@ public class CustomAlignAction {
* reference, because it's the ancestor which must move.
*/
PrecisionRectangle containerBounds = ((AlignmentTree)ept).getNewContainerBounds();
- containerBounds.setX(containerBounds.preciseX + LayoutUtils.scrollBarSize);
- containerBounds.setY(containerBounds.preciseY + LayoutUtils.scrollBarSize);
- containerBounds.setWidth(containerBounds.width - 2 * LayoutUtils.scrollBarSize);
- containerBounds.setHeight(containerBounds.height - 2 * LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseX(containerBounds.x + LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseY(containerBounds.y + LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseWidth(containerBounds.width - 2 * LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseHeight(containerBounds.height - 2 * LayoutUtils.scrollBarSize);
createConstrainedRequest(LayoutUtils.getAbsolutePosition(refEP), containerBounds, null, (AlignmentTree)ept);
}
- } else if(ept.getEditPart() == refEP && (!ToolUtilities.isAncestorContainedIn(nodeChild, refEP))) {
- //nothing to do
- }
- } else {//the editpart is not selected! We need to maintain its location
+ }
+
+ } else {//the Edit Part is not selected! We need to maintain its location
PrecisionRectangle containerBounds = ((AlignmentTree)ept).getNewContainerBounds();
- containerBounds.setX(containerBounds.preciseX + LayoutUtils.scrollBarSize);
- containerBounds.setY(containerBounds.preciseY + LayoutUtils.scrollBarSize);
- containerBounds.setWidth(containerBounds.width - 2 * LayoutUtils.scrollBarSize);
- containerBounds.setHeight(containerBounds.height - 2 * LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseX(containerBounds.x + LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseY(containerBounds.y + LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseWidth(containerBounds.width - 2 * LayoutUtils.scrollBarSize);
+ containerBounds.setPreciseHeight(containerBounds.height - 2 * LayoutUtils.scrollBarSize);
createConstrainedRequest(LayoutUtils.getAbsolutePosition(ept.getEditPart()), containerBounds, null, (AlignmentTree)ept);
}
}
}
-
-
-
}
+
/**
- *
* <ul>
* <li>Completes the {@link EditPartTree} with the correct new position for the object</li>
* <li>Adds the created request to the {@link EditPartTree}</li>
@@ -362,22 +267,14 @@ public class CustomAlignAction {
* the tree for which we create the request
*/
-
protected void createConstrainedRequest(PrecisionRectangle ref, PrecisionRectangle containerBounds, PrecisionRectangle dontCross, AlignmentTree tree) {
-
- //variables used to write the request
- double xMinForObject = 0;
- double xMaxForObject = 0;
- double yMinForObject = 0;
- double yMaxForObject = 0;
-
+
PrecisionRectangle editpartBounds = LayoutUtils.getAbsolutePosition(tree.getEditPart());
-
-
- PrecisionRectangle newPosition = new PrecisionRectangle(editpartBounds);
-
- //1-we determine the bounds!
+ PrecisionRectangle newPosition = new PrecisionRectangle(editpartBounds);
+
+ //Nominal Case
if(dontCross == null && containerBounds.equals(LayoutUtils.getAbsolutePosition(tree.getEditPart().getRoot()))) {
+
AlignmentRequest newRequest = new AlignmentRequest(RequestConstants.REQ_ALIGN);
PrecisionRectangle newPrecisionRectangle = new PrecisionRectangle(ref);
newRequest.setAlignment(this.alignment);
@@ -385,257 +282,222 @@ public class CustomAlignAction {
double pos = 0;
switch(this.alignment) {
case PositionConstants.LEFT:
- newPosition.setX(ref.preciseX());
+ newPosition.setPreciseX(ref.x());
break;
case PositionConstants.CENTER:
- pos = ref.getTop().preciseX() - (editpartBounds.preciseWidth() / 2.0);
- newPosition.setX(pos);
+ pos = ref.getTop().x() - (editpartBounds.preciseWidth() / 2.0);
+ newPosition.setPreciseX(pos);
break;
case PositionConstants.RIGHT:
- pos = ref.getRight().preciseX() - editpartBounds.preciseWidth();
- newPosition.setX(pos);
+ pos = ref.getRight().x() - editpartBounds.preciseWidth();
+ newPosition.setPreciseX(pos);
break;
case PositionConstants.TOP:
- pos = ref.getTop().preciseY();
- newPosition.setY(pos);
+ pos = ref.getTop().y();
+ newPosition.setPreciseY(pos);
break;
case PositionConstants.MIDDLE:
- pos = ref.getLeft().preciseY() - (editpartBounds.preciseHeight / 2.0);
- newPosition.setY(pos);
+ pos = ref.getLeft().y() - (editpartBounds.preciseHeight() / 2.0);
+ newPosition.setPreciseY(pos);
break;
case PositionConstants.BOTTOM:
- pos = ref.getBottom().preciseY() - editpartBounds.preciseHeight();
- newPosition.setY(pos);
+ pos = ref.getBottom().y() - editpartBounds.preciseHeight();
+ newPosition.setPreciseY(pos);
break;
default:
break;
}
-
-
tree.setNewPosition(newPosition);
tree.setRequest(newRequest);
return;
- } else if(dontCross == null && (!containerBounds.equals(LayoutUtils.getAbsolutePosition(tree.getEditPart().getRoot())))) {
- xMinForObject = containerBounds.preciseX;
- xMaxForObject = containerBounds.getRight().preciseX() - editpartBounds.preciseWidth();
- yMinForObject = containerBounds.preciseY;
- yMaxForObject = containerBounds.getBottom().preciseY() - editpartBounds.preciseHeight();
-
-
- } else if(dontCross != null) {
- xMinForObject = dontCross.getRight().preciseX() - editpartBounds.preciseWidth;
- xMaxForObject = dontCross.preciseX;
- yMinForObject = dontCross.getBottom().preciseY() - editpartBounds.preciseHeight;
- yMaxForObject = dontCross.preciseY;
-
- if(!containerBounds.equals(LayoutUtils.getAbsolutePosition(tree.getEditPart().getRoot()))) {
- //container's limits
- double xMinContainerLimit = containerBounds.preciseX;
- double xMaxContainerLimit = containerBounds.getRight().preciseX() - editpartBounds.preciseWidth();
- double yMinContainerLimit = containerBounds.preciseY;
- double yMaxContainerLimit = containerBounds.getBottom().preciseY() - editpartBounds.preciseHeight();
-
-
- xMinForObject = (xMinForObject > xMinContainerLimit) ? xMinForObject : xMinContainerLimit;
- xMaxForObject = (xMaxForObject > xMaxContainerLimit) ? xMaxContainerLimit : xMaxForObject;
- yMinForObject = (yMinForObject > yMinContainerLimit) ? yMinForObject : yMinContainerLimit;
- yMaxForObject = (yMaxForObject > yMaxContainerLimit) ? yMaxContainerLimit : yMaxForObject;
+
+ //Not nominal Cases
+ } else {
+
+ //variables used to write the request
+ PrecisionPoint minPoint = new PrecisionPoint();
+ PrecisionPoint maxPoint = new PrecisionPoint();
+
+ // Container bigger than Editor
+ if(dontCross == null && (!containerBounds.equals(LayoutUtils.getAbsolutePosition(tree.getEditPart().getRoot())))) {
+
+ minPoint.setPreciseX(containerBounds.x);
+ maxPoint.setPreciseX(containerBounds.getRight().x() - editpartBounds.preciseWidth());
+ minPoint.setPreciseY(containerBounds.y);
+ maxPoint.setPreciseY(containerBounds.getBottom().y() - editpartBounds.preciseHeight());
+
+ // Bounds limits in case of unselected child
+ } else if(dontCross != null) {
+
+ minPoint.setPreciseX(dontCross.getRight().x() - editpartBounds.preciseWidth());
+ maxPoint.setPreciseX(dontCross.x);
+ minPoint.setPreciseY(dontCross.getBottom().y() - editpartBounds.preciseHeight());
+ maxPoint.setPreciseY(dontCross.y);
+
+ if(!containerBounds.equals(LayoutUtils.getAbsolutePosition(tree.getEditPart().getRoot()))) {
+ //container's limits
+ double xMinContainerLimit = containerBounds.x;
+ double xMaxContainerLimit = containerBounds.getRight().x() - editpartBounds.preciseWidth();
+ double yMinContainerLimit = containerBounds.y;
+ double yMaxContainerLimit = containerBounds.getBottom().y() - editpartBounds.preciseHeight();
+
+
+ minPoint.setPreciseX(Math.max(minPoint.x() , xMinContainerLimit));
+ maxPoint.setPreciseX(Math.min(maxPoint.x() , xMaxContainerLimit));
+ minPoint.setPreciseY(Math.max(minPoint.y() , yMinContainerLimit));
+ maxPoint.setPreciseY(Math.min(maxPoint.y() , yMaxContainerLimit));
+ }
}
- }
- /* rectangle used to do the alignment */
- PrecisionRectangle myAlignRectangle = new PrecisionRectangle(editpartBounds);
+ /* rectangle used to do the alignment */
+ PrecisionRectangle myAlignRectangle = new PrecisionRectangle(editpartBounds);
- /* the editpart's position in its container, after the shift of the container */
- PrecisionRectangle newTmpPosition = tree.getAbsolutePositionInTheNewContainerPosition();
+ /* the distance between the editpart in the new container position and its alignment reference */
+ PrecisionPoint offset = getOffset(minPoint, maxPoint, ref, editpartBounds, tree);
+
- /* the distance between the editpart in the new container position and its alignment reference */
- double distance = 0;
+ myAlignRectangle.setPreciseX(LayoutUtils.getAbsolutePosition(tree.getEditPart()).x + offset.x());
+ myAlignRectangle.setPreciseY(LayoutUtils.getAbsolutePosition(tree.getEditPart()).y + offset.y());
- /* the point use to translate the editpart */
- Point translationPoint = null;
+ /* the point use to translate the editpart */
+ Point translationPoint = new PrecisionPoint(0.0,0.0);
- /* the new request */
- AlignmentRequest newRequest = new AlignmentRequest(RequestConstants.REQ_ALIGN);
- newRequest.setAlignment(this.alignment);
- switch(alignment) {
- case PositionConstants.LEFT:
+ /* the new request */
+ AlignmentRequest newRequest = new AlignmentRequest(RequestConstants.REQ_ALIGN);
+ newRequest.setAlignment(this.alignment);
- if((ref.preciseX >= xMinForObject) && (ref.preciseX <= xMaxForObject)) {
- distance = ref.preciseX - newTmpPosition.preciseX;
- } else if(ref.preciseX < xMinForObject) {
- distance = xMinForObject - newTmpPosition.preciseX;
- } else if(ref.preciseX > xMaxForObject) {
- distance = xMaxForObject - newTmpPosition.preciseX;
- }
- myAlignRectangle.setX(LayoutUtils.getAbsolutePosition(tree.getEditPart()).preciseX + distance);
- translationPoint = new Point(distance, 0);
+
- break;
- case PositionConstants.CENTER:// un alignement central fait de cette façon : tous les packages aligné sur un élément extérieur ne marche pas du tout!
+ newRequest.setAlignmentRectangle(myAlignRectangle);
+ newPosition = (PrecisionRectangle)tree.getAbsolutePositionInTheNewContainerPosition().translate(translationPoint);
+ tree.setNewPosition(newPosition);
+ tree.setRequest(newRequest);
+ return;
+ }
- double minCenter = xMinForObject + (editpartBounds.preciseWidth / 2.0);
- double maxCenter = xMaxForObject + (editpartBounds.preciseWidth / 2.0);
- if((ref.getTop().preciseX() >= minCenter) && (ref.getTop().preciseX() <= maxCenter)) {
- distance = (ref.preciseX + (ref.preciseWidth / 2.0) - (newTmpPosition.preciseX + (newTmpPosition.preciseWidth / 2.0)));
- } else if(ref.getTop().preciseX() < minCenter) {
- distance = minCenter - (newTmpPosition.preciseX + (newTmpPosition.preciseWidth / 2.0));
- } else if(ref.getTop().preciseX() > maxCenter) {
+ }
- distance = maxCenter - (newTmpPosition.preciseX + ((newTmpPosition.preciseWidth) / 2.0));
+ /**
+ * Get the offset distance between the editpart and the alignement position.
+ *
+ * If the alignment Position is out of the calculated Bounds (min and max Points),
+ * the offset is the distance between the EditPart and the nearest allowed bounds.
+ *
+ * @param minPoint Minimum allowed position for the editpart
+ * @param maxPoint Maximum allowed position for the editpart
+ * @param ref Reference rectangle of the alignment request
+ * @param editpartBounds edit Part Bounds rectangle
+ * @param tree current Alignment Tree
+ * @return
+ */
+ private PrecisionPoint getOffset(PrecisionPoint minPoint,
+ PrecisionPoint maxPoint, PrecisionRectangle ref,
+ PrecisionRectangle editpartBounds, AlignmentTree tree) {
+
+ PrecisionPoint distance = new PrecisionPoint (0.0,0.0);
+ /* the editpart's position in its container, after the shift of the container */
+ PrecisionRectangle newTmpPosition = tree.getAbsolutePositionInTheNewContainerPosition();
+
+ switch(alignment) {
+ case PositionConstants.LEFT:
- }
- myAlignRectangle.setX(LayoutUtils.getAbsolutePosition(tree.getEditPart()).preciseX + distance);
- translationPoint = new Point(distance, 0);
+ if((ref.x >= minPoint.x()) && (ref.x <= maxPoint.x())) {
+ distance.setPreciseX(ref.x - newTmpPosition.x);
+ } else if(ref.x < minPoint.x()) {
+ distance.setPreciseX(minPoint.x() - newTmpPosition.x);
+ } else if(ref.x > maxPoint.x()) {
+ distance.setPreciseX(maxPoint.x() - newTmpPosition.x);
+ }
break;
+
+ case PositionConstants.CENTER:// un alignement central fait de cette facon : tous les packages alignes sur un element exterieur ne marche pas du tout!
+
+ double minCenter = minPoint.x() + (editpartBounds.preciseWidth() / 2.0);
+ double maxCenter = maxPoint.x() + (editpartBounds.preciseWidth() / 2.0);
+ if((ref.getTop().x() >= minCenter) && (ref.getTop().x() <= maxCenter)) {
+ distance.setPreciseX(ref.x + (ref.preciseWidth() / 2.0) - (newTmpPosition.x + (newTmpPosition.preciseWidth() / 2.0)));
+ } else if(ref.getTop().x() < minCenter) {
+ distance.setPreciseX(minCenter - (newTmpPosition.x + (newTmpPosition.preciseWidth() / 2.0)));
+ } else if(ref.getTop().x() > maxCenter) {
+
+ distance.setPreciseX(maxCenter - (newTmpPosition.x + ((newTmpPosition.preciseWidth()) / 2.0)));
+ }
+
+ break;
+
case PositionConstants.RIGHT:
- double minRight = xMinForObject + editpartBounds.preciseWidth;
- double maxRight = xMaxForObject + editpartBounds.preciseWidth;
- if((ref.getRight().preciseX() >= minRight) && (ref.getRight().preciseX() <= maxRight)) {
- distance = (ref.preciseX + ref.preciseWidth) - (newTmpPosition.preciseX + newTmpPosition.preciseWidth);
- } else if(ref.getRight().preciseX() < minRight) {
- distance = minRight - (newTmpPosition.preciseX + newTmpPosition.preciseWidth);
- } else if(ref.getRight().preciseX() > maxRight) {
- distance = maxRight - (newTmpPosition.preciseX + newTmpPosition.preciseWidth);
- }
- myAlignRectangle.setX(LayoutUtils.getAbsolutePosition(tree.getEditPart()).preciseX + distance);
- translationPoint = new Point(distance, 0);
+ double minRight = minPoint.x() + editpartBounds.preciseWidth();
+ double maxRight = maxPoint.x() + editpartBounds.preciseWidth();
+ if((ref.getRight().x() >= minRight) && (ref.getRight().x() <= maxRight)) {
+ distance.setPreciseX((ref.x + ref.preciseWidth()) - (newTmpPosition.x + newTmpPosition.preciseWidth()));
+ } else if(ref.getRight().x() < minRight) {
+ distance.setPreciseX( minRight - (newTmpPosition.x + newTmpPosition.preciseWidth()));
+ } else if(ref.getRight().x() > maxRight) {
+ distance.setPreciseX( maxRight - (newTmpPosition.x + newTmpPosition.preciseWidth()));
+ }
break;
+
+
case PositionConstants.BOTTOM:
- double minBottom = yMinForObject + editpartBounds.preciseHeight;
- double maxBottom = yMaxForObject + editpartBounds.preciseHeight;
- if(((ref.getBottom().preciseY()) >= minBottom) && ((ref.getBottom().preciseY()) <= maxBottom)) {
- distance = (ref.preciseY + ref.preciseHeight) - (newTmpPosition.preciseY + newTmpPosition.preciseHeight);
- } else if((ref.getBottom().preciseY()) < minBottom) {
- distance = minBottom - (newTmpPosition.preciseY + newTmpPosition.preciseHeight);
- } else if((ref.getBottom().preciseY()) > maxBottom) {
- distance = maxBottom - (newTmpPosition.preciseY + newTmpPosition.preciseHeight);
- }
- translationPoint = new Point(0, distance);
- myAlignRectangle.setY(LayoutUtils.getAbsolutePosition(tree.getEditPart()).preciseY + distance);
+ double minBottom = minPoint.y() + editpartBounds.preciseHeight();
+ double maxBottom = maxPoint.y() + editpartBounds.preciseHeight();
+ if(((ref.getBottom().y()) >= minBottom) && ((ref.getBottom().y()) <= maxBottom)) {
+ distance.setPreciseY( (ref.y + ref.preciseHeight()) - (newTmpPosition.y + newTmpPosition.preciseHeight()));
+ } else if((ref.getBottom().y()) < minBottom) {
+ distance.setPreciseY( minBottom - (newTmpPosition.y + newTmpPosition.preciseHeight()));
+ } else if((ref.getBottom().y()) > maxBottom) {
+ distance.setPreciseY( maxBottom - (newTmpPosition.y + newTmpPosition.preciseHeight()));
+ }
break;
case PositionConstants.MIDDLE:
- double minMiddle = yMinForObject + (editpartBounds.preciseHeight / 2.0);
- double maxMiddle = yMaxForObject + (editpartBounds.preciseHeight / 2.0);
- if(((ref.preciseY + (ref.preciseHeight / 2.0)) >= minMiddle) && ((ref.preciseY + (ref.preciseHeight / 2.0)) <= maxMiddle)) {
- distance = (ref.preciseY + (ref.preciseHeight / 2.0) - (newTmpPosition.preciseY + (newTmpPosition.preciseHeight / 2.0)));;
- } else if((ref.preciseY + (ref.height / 2.0)) < minMiddle) {
- distance = minMiddle - (newTmpPosition.preciseY + (newTmpPosition.preciseHeight / 2.0));
- } else if((ref.preciseY + (ref.height / 2.0)) > maxMiddle) {
- distance = maxMiddle - (newTmpPosition.preciseY + (newTmpPosition.preciseHeight / 2.0));
- }
- translationPoint = new Point(0, distance);
- myAlignRectangle.setY(LayoutUtils.getAbsolutePosition(tree.getEditPart()).preciseY + distance);
+ double minMiddle = minPoint.y() + (editpartBounds.preciseHeight() / 2.0);
+ double maxMiddle = maxPoint.y() + (editpartBounds.preciseHeight() / 2.0);
+ if(((ref.y + (ref.preciseHeight() / 2.0)) >= minMiddle) && ((ref.y + (ref.preciseHeight() / 2.0)) <= maxMiddle)) {
+ distance .setPreciseY( (ref.y + (ref.preciseHeight() / 2.0) - (newTmpPosition.y + (newTmpPosition.preciseHeight() / 2.0))));
+ } else if((ref.y + (ref.height / 2.0)) < minMiddle) {
+ distance .setPreciseY( minMiddle - (newTmpPosition.y + (newTmpPosition.preciseHeight() / 2.0)));
+ } else if((ref.y + (ref.height / 2.0)) > maxMiddle) {
+ distance .setPreciseY( maxMiddle - (newTmpPosition.y + (newTmpPosition.preciseHeight() / 2.0)));
+ }
break;
+
case PositionConstants.TOP:
- if((ref.preciseY >= yMinForObject) && (ref.preciseY <= yMaxForObject)) {
- distance = ref.preciseY - newTmpPosition.preciseY;
- } else if(ref.preciseY < yMinForObject) {
- distance = yMinForObject - newTmpPosition.preciseY;
- } else if(ref.preciseY > yMaxForObject) {
- distance = yMaxForObject - newTmpPosition.preciseY;
- }
- translationPoint = new Point(0, distance);
- myAlignRectangle.setY(LayoutUtils.getAbsolutePosition(tree.getEditPart()).preciseY + distance);
+ if((ref.y >= minPoint.y()) && (ref.y <= maxPoint.y())) {
+ distance .setPreciseY( ref.y - newTmpPosition.y);
+ } else if(ref.y < minPoint.y()) {
+ distance .setPreciseY( minPoint.y() - newTmpPosition.y);
+ } else if(ref.y > maxPoint.y()) {
+ distance.setPreciseY( maxPoint.y() - newTmpPosition.y);
+ }
break;
default:
break;
}
-
-
- newRequest.setAlignmentRectangle(myAlignRectangle);
- newPosition = (PrecisionRectangle)tree.getAbsolutePositionInTheNewContainerPosition().translate(translationPoint);
- tree.setNewPosition(newPosition);
- tree.setRequest(newRequest);
- return;
+
+ return distance;
}
- /**
- * Returns the height of the label for the current editpart contained in {@code ept}, more the height of the children's label
- *
- * @param ept
- * The {@link EditPartTree} containing the {@link EditPart} used to calculate height
- * @return
- * The height of the label for the current editpart, more the height of the children's label
- *
- */
- protected double getLabelHeightToRemove(EditPartTree ept) {
- double dist = 0;
- List children = ept.getEditPart().getChildren();
- //we search the correct compartment
- for(int iter = 0; iter < children.size(); iter++) {
- if(children.get(iter) instanceof CompartmentEditPart) {
- CompartmentEditPart child = (CompartmentEditPart)children.get(iter);
- EditPolicy policy = child.getEditPolicy(EditPolicy.LAYOUT_ROLE);
- if(policy != null) {
- PrecisionRectangle cptSize = LayoutUtils.getAbsolutePosition(child);
- dist += cptSize.preciseY() - LayoutUtils.getAbsolutePosition(ept.getEditPart()).preciseY();
- break;
- }
- }
- }
- Enumeration eptChildren = ept.children();
- double max = 0;
- while(eptChildren.hasMoreElements()) {
- EditPartTree currentElement = (EditPartTree)eptChildren.nextElement();
- if(currentElement.isSelected() && (!currentElement.isReference())) {
- double tmp = getLabelHeightToRemove(currentElement);
- max = (tmp > max) ? tmp : max;
- }
- }
- dist += max;
- return dist;
+ /** Get current root Tree. */
+ public AlignmentTree getRootTree() {
+ return rootTree;
}
- /**
- * Tests the selection (nodes and links)
- *
- * @param editparts
- *
- * @return
- * <ul>
- * <li> {@code true}</li> if the selection contains links and nodes
- * <li> {@code false}</li> if not
- * </ul>
- *
- */
- protected boolean isMixedSelection(List<?> editparts) {
- boolean node = false;
- boolean link = false;
- for(Object editPart : editparts) {
- if(editPart instanceof AbstractConnectionEditPart) {
- link = true;
- } else {
- node = true;
- }
- }
- return !(((node == true) && (link == true))) ? false : true;
+ /** Get list of Edit Parts. */
+ public List<EditPart> getEditparts() {
+ return editparts;
+ }
+ /** Get the Alignment type. */
+ public int getAlignment() {
+ return alignment;
}
- /**
- * Tests if all the selected elements are instance of {@linkplain AbstractConnectionEditPart}
- *
- * @param editparts
- * the editparts list to test
- * @return
- * <ul>
- * <li> {@code true}</li> if all the editparts represents a link
- * <li>{@code false}</li> if not
- * </ul>
- */
- protected boolean isLinkSelection(List<?> editparts) {
- if(editparts.size() == 0) {
- return false;
- }
- for(Object object : editparts) {
- if(!(object instanceof AbstractConnectionEditPart)) {
- return false;
- }
- }
- return true;
+ /** Get list of selected Elements */
+ public List<IGraphicalEditPart> getSelectedElements() {
+ return selectedElements;
}
+
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
index a33bfa3e5ba..b3f1ffff4d9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.menu/src/org/eclipse/papyrus/uml/diagram/menu/actions/handlers/AlignementHandler.java
@@ -88,4 +88,5 @@ public class AlignementHandler extends ParametricAndListeningHandler {
}
return PositionConstants.NONE;
}
+
}

Back to the top