diff options
| author | pguilet | 2017-08-03 13:49:12 +0000 |
|---|---|---|
| committer | Pierre Guilet | 2017-08-16 08:06:57 +0000 |
| commit | 7affc3e2877e785690d7b3020e2e792d0d90f74f (patch) | |
| tree | 85b326957d91dd86104f2be13eb588b855048417 | |
| parent | 082555ec5a2f04d23f392cf367a55d8684f00445 (diff) | |
| download | org.eclipse.sirius-7affc3e2877e785690d7b3020e2e792d0d90f74f.tar.gz org.eclipse.sirius-7affc3e2877e785690d7b3020e2e792d0d90f74f.tar.xz org.eclipse.sirius-7affc3e2877e785690d7b3020e2e792d0d90f74f.zip | |
[520521] Add possibility to straighten edge from multi selection
The straighten to actions are now available when a multi selection
contains at least one edge.
Bug: 520521
Change-Id: I7ba49561b2a06a0fa40005340f85625e37663e85
Signed-off-by: pguilet <pierre.guilet@obeo.fr>
6 files changed, 375 insertions, 217 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml index 1709b3b8d8..0130759439 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml @@ -165,7 +165,8 @@ </partContribution> <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider"> - <popupStructuredContributionCriteria objectClass="org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart"> + <popupStructuredContributionCriteria + policyClass="org.eclipse.sirius.diagram.ui.tools.internal.menu.MultiSelectionEdgePolicy"> </popupStructuredContributionCriteria> <popupMenu path="/filterFormatGroup" id="formatMenu"> </popupMenu> @@ -178,7 +179,7 @@ class="org.eclipse.sirius.diagram.ui.tools.internal.menu.DiagramEditorContextMenuProvider" id="StraightenToContribution"> <popupStructuredContributionCriteria - objectClass="org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart"> + policyClass="org.eclipse.sirius.diagram.ui.tools.internal.menu.MultiSelectionEdgePolicy"> </popupStructuredContributionCriteria> <popupMenuGroup path="/formatMenu/arrangeMenu/" id="straightenToGroup" /> @@ -421,19 +422,40 @@ remove="true"> </popupPredefinedItem> </popupContribution> + </contributionItemProvider> + + <contributionItemProvider + class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider" + checkPluginLoaded="false"> + <Priority name="Low"/> <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider"> <popupStructuredContributionCriteria objectClass="org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramNameEditPart"> - </popupStructuredContributionCriteria> - <popupMenuGroup id="filterFormatGroup"> - </popupMenuGroup> - <popupMenu path="/filterFormatGroup" id="formatMenu"> - </popupMenu> + </popupStructuredContributionCriteria> <popupMenuGroup path="/formatMenu/" id="fontFillLineGroup"> </popupMenuGroup> <popupAction path="/formatMenu/fontFillLineGroup" id="fontDialogAction"> - </popupAction> - </popupContribution> - </contributionItemProvider> + </popupAction> + </popupContribution> + </contributionItemProvider> + + <contributionItemProvider + class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider" + checkPluginLoaded="false"> + <Priority name="Lowest"/> + <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider"> + <popupStructuredContributionCriteria policyClass="org.eclipse.sirius.diagram.ui.tools.internal.menu.MultiSelectionEdgePolicy"> + </popupStructuredContributionCriteria> + <popupMenu path="/filterFormatGroup" id="formatMenu"> + </popupMenu> + <popupMenuGroup path="/formatMenu/" id="miscellaneousGroup"> + </popupMenuGroup> + <popupMenu path="/formatMenu/miscellaneousGroup" id="arrangeMenu"> + </popupMenu> + <popupMenuGroup path="/formatMenu/arrangeMenu/" id="arrangeGroup"> + </popupMenuGroup> + </popupContribution> + </contributionItemProvider> + <contributionItemProvider class="org.eclipse.sirius.diagram.ui.internal.providers.SiriusContributionItemProvider" diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DEdgeNameSelectionFeedbackEditPolicy.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DEdgeNameSelectionFeedbackEditPolicy.java index 3908598a3c..4e7151948f 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DEdgeNameSelectionFeedbackEditPolicy.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/graphical/edit/policies/DEdgeNameSelectionFeedbackEditPolicy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 2017 THALES GLOBAL SERVICES. * 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 @@ -10,9 +10,13 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.ui.graphical.edit.policies; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; import java.util.ArrayList; import java.util.List; +import org.eclipse.draw2d.Connection; +import org.eclipse.gef.EditPart; import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart; import org.eclipse.sirius.diagram.ui.internal.edit.parts.AbstractDEdgeNameEditPart; @@ -22,7 +26,7 @@ import org.eclipse.sirius.diagram.ui.internal.edit.parts.AbstractDEdgeNameEditPa * * @author mPorhel */ -public class DEdgeNameSelectionFeedbackEditPolicy extends AbstractEdgeSelectionFeedbackEditPolicy { +public class DEdgeNameSelectionFeedbackEditPolicy extends AbstractEdgeSelectionFeedbackEditPolicy implements PropertyChangeListener { /** * {@inheritDoc} @@ -56,4 +60,35 @@ public class DEdgeNameSelectionFeedbackEditPolicy extends AbstractEdgeSelectionF return names; } + @Override + protected void showSelection() { + if (getEdgeEditPart() != null && getEdgeEditPart().getFigure() != null) { + // we register this policy as a property listener to clear rebuild its handles when target edge's bend + // points change. This is needed when an edge is straighten whereas the edge part and its name part are both + // selected. + ((Connection) getEdgeEditPart().getFigure()).addPropertyChangeListener(this); + } + super.showSelection(); + } + + @Override + protected void hideSelection() { + if (getEdgeEditPart() != null && getEdgeEditPart().getFigure() != null) { + ((Connection) getEdgeEditPart().getFigure()).removePropertyChangeListener(this); + } + super.hideSelection(); + } + + /** + * Adds selection handles to the Connection, if it is selected, when the points property changes. Since we only + * listen for changes in the points property, this method is only called when the points of the Connection have + * changed. + */ + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (getHost().getSelected() != EditPart.SELECTED_NONE) { + addSelectionHandles(); + } + } + } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/commands/StraightenToCommand.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/commands/StraightenToCommand.java index 7e2bc7ef9d..3ff4ea60f4 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/commands/StraightenToCommand.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/commands/StraightenToCommand.java @@ -65,8 +65,7 @@ import com.google.common.collect.Maps; */ public class StraightenToCommand extends AbstractTransactionalCommand { /** - * All data associated to an edgeEditPart computed during the canExecute() - * method. + * All data associated to an edgeEditPart computed during the canExecute() method. * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> */ @@ -90,32 +89,26 @@ public class StraightenToCommand extends AbstractTransactionalCommand { private boolean isTargetABorderNode; /** - * Boolean to indicate if this command moves the source or the target of - * the edge.<br> - * Value computed during {@link #canExecute()} method, more precisely in - * {@link #isSourceWillBeMoved()} . + * Boolean to indicate if this command moves the source or the target of the edge.<br> + * Value computed during {@link #canExecute()} method, more precisely in {@link #isSourceWillBeMoved()} . */ private boolean moveSource; /** - * Boolean to indicate that we are in the specific case where both - * source and target point will be moved. This case is when the source - * and the target of the edge are border nodes and edge is centered on - * each side. + * Boolean to indicate that we are in the specific case where both source and target point will be moved. This + * case is when the source and the target of the edge are border nodes and edge is centered on each side. */ private boolean isSpecificCase; /** * The x delta by which the source (or target) will be moved.<br> - * Value computed during {@link #canExecute()} method, more precisely in - * {@link #isNewLocationInParentBounds()}. + * Value computed during {@link #canExecute()} method, more precisely in {@link #isNewLocationInParentBounds()}. */ private int deltaX = 0; /** * The y delta by which the source (or target) will be moved.<br> - * Value computed during {@link #canExecute()} method, more precisely in - * {@link #isNewLocationInParentBounds()}. + * Value computed during {@link #canExecute()} method, more precisely in {@link #isNewLocationInParentBounds()}. */ private int deltaY = 0; } @@ -123,6 +116,8 @@ public class StraightenToCommand extends AbstractTransactionalCommand { /** Edge edit parts to straighten with associated data. */ Map<AbstractDiagramEdgeEditPart, StraightenToCommandData> edgeEditParts = Maps.newHashMap(); + Map<AbstractDiagramEdgeEditPart, StraightenToCommandData> edgeEditPartsToStraighten = Maps.newHashMap(); + /** * The straighten type must by one of: * <UL> @@ -166,67 +161,72 @@ public class StraightenToCommand extends AbstractTransactionalCommand { boolean canExecute = true; // First iteration with quick checks for (Map.Entry<AbstractDiagramEdgeEditPart, StraightenToCommandData> edgeEditPartWithData : edgeEditParts.entrySet()) { - if (canExecute) { - AbstractDiagramEdgeEditPart edgeEditPart = edgeEditPartWithData.getKey(); - StraightenToCommandData data = edgeEditPartWithData.getValue(); - Object model = edgeEditPart.getModel(); - if (model instanceof Edge && data.sourceEditPart != null && data.targetEditPart != null) { - Edge edge = (Edge) model; - EdgeQuery edgeQuery = new EdgeQuery(edge); - // Check if this edge has a rectilinear routing style or an - // oblique routing style (not a tree routing style). - canExecute = !edgeQuery.isEdgeWithTreeRoutingStyle(); - // Check if the source or the target of this edge is another - // edge - if (canExecute) { - canExecute = !(data.sourceEditPart instanceof ConnectionEditPart || data.targetEditPart instanceof ConnectionEditPart); - } - if (canExecute) { - data.isSourceABorderNode = data.sourceEditPart instanceof AbstractDiagramBorderNodeEditPart; - data.isTargetABorderNode = data.targetEditPart instanceof AbstractDiagramBorderNodeEditPart; - // Check if the source and the target are not on the - // same axis (west and east sides or north and south - // sides) - int axis = getSourceAndTargetSameAxis(edgeEditPart, data); - canExecute = axis != PositionConstants.NONE; - if (canExecute) { - if ((axis == PositionConstants.HORIZONTAL && (straightenType == StraightenToAction.TO_TOP || straightenType == StraightenToAction.TO_BOTTOM)) - || (axis == PositionConstants.VERTICAL && (straightenType == StraightenToAction.TO_LEFT || straightenType == StraightenToAction.TO_RIGHT))) { - data.moveSource = isSourceWillBeMoved(edgeEditPart, data); - } else { - canExecute = false; - } + boolean canExecuteThisEdge = true; + AbstractDiagramEdgeEditPart edgeEditPart = edgeEditPartWithData.getKey(); + StraightenToCommandData data = edgeEditPartWithData.getValue(); + Object model = edgeEditPart.getModel(); + if (model instanceof Edge && data.sourceEditPart != null && data.targetEditPart != null) { + Edge edge = (Edge) model; + EdgeQuery edgeQuery = new EdgeQuery(edge); + // Check if this edge has a rectilinear routing style or an + // oblique routing style (not a tree routing style). + canExecuteThisEdge = !edgeQuery.isEdgeWithTreeRoutingStyle(); + // Check if the source or the target of this edge is another + // edge + if (canExecuteThisEdge) { + canExecuteThisEdge = !(data.sourceEditPart instanceof ConnectionEditPart || data.targetEditPart instanceof ConnectionEditPart); + } + if (canExecuteThisEdge) { + data.isSourceABorderNode = data.sourceEditPart instanceof AbstractDiagramBorderNodeEditPart; + data.isTargetABorderNode = data.targetEditPart instanceof AbstractDiagramBorderNodeEditPart; + // Check if the source and the target are not on the + // same axis (west and east sides or north and south + // sides) + int axis = getSourceAndTargetSameAxis(edgeEditPart, data); + canExecuteThisEdge = axis != PositionConstants.NONE; + if (canExecuteThisEdge) { + if ((axis == PositionConstants.HORIZONTAL && (straightenType == StraightenToAction.TO_TOP || straightenType == StraightenToAction.TO_BOTTOM)) + || (axis == PositionConstants.VERTICAL && (straightenType == StraightenToAction.TO_LEFT || straightenType == StraightenToAction.TO_RIGHT))) { + data.moveSource = isSourceWillBeMoved(edgeEditPart, data); + } else { + canExecuteThisEdge = false; } } - if (canExecute) { - // A straighten action can be disabled if the edge - // centering is activated on an edge. - canExecute = !isCentered(edgeEditPart, data); - } } + if (canExecuteThisEdge) { + // A straighten action can be disabled if the edge + // centering is activated on an edge. + canExecuteThisEdge = !isCentered(edgeEditPart, data); + } + } + if (canExecuteThisEdge) { + edgeEditPartsToStraighten.put(edgeEditPart, data); } + canExecute = canExecute || canExecuteThisEdge; } if (canExecute) { // Second with longer checks (bounds and overlap) for (Map.Entry<AbstractDiagramEdgeEditPart, StraightenToCommandData> edgeEditPartWithData : edgeEditParts.entrySet()) { - if (canExecute) { - AbstractDiagramEdgeEditPart edgeEditPart = edgeEditPartWithData.getKey(); - StraightenToCommandData data = edgeEditPartWithData.getValue(); - if (canExecute) { - // Compute if new location is in bounds of its - // container. - canExecute = isNewLocationInParentBounds(edgeEditPart, data); - } - if (canExecute) { - // Check if the border node (source or target) will - // overlapped another border node - movedBorderNodes = getMovedBorderNodes(); - canExecute = !isOverlapped(edgeEditPart, data); - } + boolean canExecuteThisEdge = true; + AbstractDiagramEdgeEditPart edgeEditPart = edgeEditPartWithData.getKey(); + StraightenToCommandData data = edgeEditPartWithData.getValue(); + if (canExecuteThisEdge) { + // Compute if new location is in bounds of its + // container. + canExecuteThisEdge = isNewLocationInParentBounds(edgeEditPart, data); + } + if (canExecuteThisEdge) { + // Check if the border node (source or target) will + // overlapped another border node + movedBorderNodes = getMovedBorderNodes(); + canExecuteThisEdge = !isOverlapped(edgeEditPart, data); + } + if (!canExecuteThisEdge) { + edgeEditPartsToStraighten.remove(edgeEditPart); } } } - return canExecute; + return edgeEditPartsToStraighten.size() > 0; } /** @@ -271,7 +271,7 @@ public class StraightenToCommand extends AbstractTransactionalCommand { @Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { CommandResult commandResult = CommandResult.newOKCommandResult(); - for (Map.Entry<AbstractDiagramEdgeEditPart, StraightenToCommandData> edgeEditPartWithData : edgeEditParts.entrySet()) { + for (Map.Entry<AbstractDiagramEdgeEditPart, StraightenToCommandData> edgeEditPartWithData : edgeEditPartsToStraighten.entrySet()) { AbstractDiagramEdgeEditPart edgeEditPart = edgeEditPartWithData.getKey(); StraightenToCommandData data = edgeEditPartWithData.getValue(); if (edgeEditPart.getFigure() instanceof Connection && edgeEditPart.getModel() instanceof Edge) { @@ -339,11 +339,9 @@ public class StraightenToCommand extends AbstractTransactionalCommand { * @param command * The command to complete * @param editPartOnMovedSide - * The {@link IGraphicalEditPart} on the side of the edge that - * will be moved. + * The {@link IGraphicalEditPart} on the side of the edge that will be moved. * @param isABorderNode - * true if the <code>editPartOnMovedSide</code> is a border node, - * false otherwise + * true if the <code>editPartOnMovedSide</code> is a border node, false otherwise * @param sourceBounds * The bounds of the source edit part * @param targetBounds @@ -395,9 +393,8 @@ public class StraightenToCommand extends AbstractTransactionalCommand { } /** - * Get the axis ({@link PositionConstants#HORIZONTAL} or - * {@link PositionConstants#VERTICAL}) if the source and the target are on - * the same axis, {@link PositionConstants#NONE} otherwise. + * Get the axis ({@link PositionConstants#HORIZONTAL} or {@link PositionConstants#VERTICAL}) if the source and the + * target are on the same axis, {@link PositionConstants#NONE} otherwise. * * @return the axis of the edge */ @@ -472,15 +469,14 @@ public class StraightenToCommand extends AbstractTransactionalCommand { * <LI>Oblique edges: Move forbidden if at least one side is centered.</LI> * <LI>Rectilinear edges: Move forbidden if the moved side is centered.LI> * </UL> - * There is an exception when the source and the target of the edge are - * border nodes and edge is centered on each side. + * There is an exception when the source and the target of the edge are border nodes and edge is centered on each + * side. * * @param edgeEditPart * The edge edit part to check * @param data * The corresponding data - * @return true if the centering constraint forbids the move, false - * otherwise. + * @return true if the centering constraint forbids the move, false otherwise. */ private boolean isCentered(AbstractDiagramEdgeEditPart edgeEditPart, StraightenToCommandData data) { boolean isCentered = false; @@ -503,15 +499,15 @@ public class StraightenToCommand extends AbstractTransactionalCommand { } /** - * Check if the new location is in the parent bounds. This method also sets - * deltaX and deltaY used later during command execution. + * Check if the new location is in the parent bounds. This method also sets deltaX and deltaY used later during + * command execution. * * @param edgeEditPart * The edge edit part to check * @param data * The corresponding data - * @return true if the source or target of the edge is in the bounds of its - * parent after the straighten, false otherwise. + * @return true if the source or target of the edge is in the bounds of its parent after the straighten, false + * otherwise. */ private boolean isNewLocationInParentBounds(AbstractDiagramEdgeEditPart edgeEditPart, StraightenToCommandData data) { boolean isNewLocationInParentBounds = false; @@ -593,17 +589,15 @@ public class StraightenToCommand extends AbstractTransactionalCommand { } /** - * {@link #isNewLocationInParentBounds()} must be called before this method - * as it determines the {@link #deltaX} and {@link #deltaY} needed to check - * overlap. + * {@link #isNewLocationInParentBounds()} must be called before this method as it determines the {@link #deltaX} and + * {@link #deltaY} needed to check overlap. * * @param edgeEditPart * The edge edit part to check * @param data * The corresponding data - * @return true if the border node overlapped another border node after the - * move, false otherwise (or if the moved node is not a border - * node). + * @return true if the border node overlapped another border node after the move, false otherwise (or if the moved + * node is not a border node). */ private boolean isOverlapped(AbstractDiagramEdgeEditPart edgeEditPart, StraightenToCommandData data) { boolean isOverlapped = false; @@ -622,8 +616,8 @@ public class StraightenToCommand extends AbstractTransactionalCommand { } /** - * Check if the <code>node</node> is overlapped another border node after - * applying the move (with {@link #deltaX} and {@link #deltaY}). + * Check if the <code>node</node> is overlapped another border node after applying the move (with {@link #deltaX} + * and {@link #deltaY}). * * @param node * The {@link Node} to check @@ -682,9 +676,8 @@ public class StraightenToCommand extends AbstractTransactionalCommand { /** * <P> - * Returns an integer which represents the position of the given point with - * respect to this rectangle. Possible return values are bitwise ORs of the - * constants WEST, EAST, NORTH, and SOUTH as found in + * Returns an integer which represents the position of the given point with respect to this rectangle. Possible + * return values are bitwise ORs of the constants WEST, EAST, NORTH, and SOUTH as found in * {@link org.eclipse.draw2d.PositionConstants}. * * <P> @@ -693,8 +686,7 @@ public class StraightenToCommand extends AbstractTransactionalCommand { * @param point * The Point whose position has to be determined * @param rect - * the {@link Rectangle} on which <code>location</code> is - * supposed to be + * the {@link Rectangle} on which <code>location</code> is supposed to be * @return An <code>int</code> which is a {@link PositionConstant} */ private int getLocation(Point point, Rectangle rect) { diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/straighten/StraightenToAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/straighten/StraightenToAction.java index cecaf2f9d0..5fc0049a94 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/straighten/StraightenToAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/straighten/StraightenToAction.java @@ -27,7 +27,6 @@ import org.eclipse.sirius.diagram.ui.tools.api.requests.StraightenToRequest; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; import org.eclipse.ui.IWorkbenchPage; -import com.google.common.base.Predicates; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -86,8 +85,7 @@ public class StraightenToAction extends DiagramAction { } /** - * Get the label of the action according to <code>distributionType</code> - * and <code>isToolbarItem</code>. + * Get the label of the action according to <code>distributionType</code> and <code>isToolbarItem</code>. * * @param straightenType * the kind of straighten. @@ -143,8 +141,7 @@ public class StraightenToAction extends DiagramAction { } /** - * Creates the Straighten to top action to align the edge horizontally to - * the highest source or target. + * Creates the Straighten to top action to align the edge horizontally to the highest source or target. * * @param workbenchPage * the workbench part used to obtain context @@ -160,8 +157,7 @@ public class StraightenToAction extends DiagramAction { } /** - * Creates the Straighten to bottom action to align the edge horizontally to - * the lowest source or target. + * Creates the Straighten to bottom action to align the edge horizontally to the lowest source or target. * * @param workbenchPage * the workbench part used to obtain context @@ -177,8 +173,7 @@ public class StraightenToAction extends DiagramAction { } /** - * Creates the Straighten to left action to align the edge vertically to the - * left most source or target. + * Creates the Straighten to left action to align the edge vertically to the left most source or target. * * @param workbenchPage * the workbench part used to obtain context @@ -194,8 +189,7 @@ public class StraightenToAction extends DiagramAction { } /** - * Creates the Straighten to right action to align the edge vertically to - * the right most source or target. + * Creates the Straighten to right action to align the edge vertically to the right most source or target. * * @param workbenchPage * the workbench part used to obtain context @@ -228,25 +222,26 @@ public class StraightenToAction extends DiagramAction { protected Command getCommand() { List<?> operationSet = getOperationSet(); if (!operationSet.isEmpty()) { - Object firstSelectedObject = operationSet.get(0); - if (firstSelectedObject instanceof AbstractDiagramEdgeEditPart) { - return ((AbstractDiagramEdgeEditPart) firstSelectedObject).getCommand(getTargetRequest()); + for (Object object : operationSet) { + if (object instanceof AbstractDiagramEdgeEditPart) { + return ((AbstractDiagramEdgeEditPart) object).getCommand(getTargetRequest()); + } } } return UnexecutableCommand.INSTANCE; } /** - * Return only a list of selected AbstractDiagramEdgeEditPart that - * understands the request. If there is at least one other kind of edit - * part, an empty list is returned. + * Return only a list of selected AbstractDiagramEdgeEditPart that understands the request. If there is at least one + * other kind of edit part, an empty list is returned. * * @return A list of {@link AbstractDiagramEdgeEditPart} selected. */ @Override protected List<?> createOperationSet() { List<?> selection = getSelectedObjects(); - if (!Iterables.all(selection, Predicates.instanceOf(AbstractDiagramEdgeEditPart.class))) { + + if (!selection.stream().anyMatch(AbstractDiagramEdgeEditPart.class::isInstance)) { selection = Collections.EMPTY_LIST; } return selection; diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/menu/MultiSelectionEdgePolicy.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/menu/MultiSelectionEdgePolicy.java new file mode 100644 index 0000000000..818720b50a --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/menu/MultiSelectionEdgePolicy.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2017 THALES GLOBAL SERVICES 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: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.ui.tools.internal.menu; + +import java.util.Iterator; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.IPopupMenuContributionPolicy; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart; +import org.eclipse.sirius.diagram.ui.tools.internal.actions.straighten.StraightenToAction; + +/** + * This policy allows to use straighten to actions ({@link StraightenToAction}) when at least one edge is selected in + * case of a multi selection. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +public class MultiSelectionEdgePolicy implements IPopupMenuContributionPolicy { + @Override + public boolean appliesTo(ISelection selection, IConfigurationElement configuration) { + if (selection instanceof StructuredSelection) { + StructuredSelection structuredSelection = (StructuredSelection) selection; + Iterator<Object> selectionIte = structuredSelection.iterator(); + while (selectionIte.hasNext()) { + Object object = selectionIte.next(); + if (object instanceof AbstractDiagramEdgeEditPart) { + return true; + } + } + } + return false; + } +} diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/StraightenToTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/StraightenToTest.java index e47315a125..ae8afe5e96 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/StraightenToTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/StraightenToTest.java @@ -11,6 +11,7 @@ package org.eclipse.sirius.tests.swtbot.layout; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -26,6 +27,7 @@ import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramBorderNodeEdit import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramContainerEditPart; import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart; import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart.ViewEdgeFigure; +import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramNameEditPart; import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart; import org.eclipse.sirius.diagram.ui.provider.Messages; import org.eclipse.sirius.diagram.ui.tools.api.figure.SiriusWrapLabel; @@ -45,8 +47,7 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; /** - * Class test for the new feature that straighten edges. See bug #499991 for - * details. + * Class test for the new feature that straighten edges. See bug #499991 for details. * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> */ @@ -100,10 +101,8 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { * <UL> * <LI>Straighten oblique edge12 to Left: Expected OK</LI> * <LI>Straighten oblique edge12 to Right: Expected OK</LI> - * <LI>Straighten oblique edge12 to Top: Expected: menu disabled (invalid - * axis)</LI> - * <LI>Straighten oblique edge12 to Bottom: Expected: menu disabled (invalid - * axis)</LI> + * <LI>Straighten oblique edge12 to Top: Expected: menu disabled (invalid axis)</LI> + * <LI>Straighten oblique edge12 to Bottom: Expected: menu disabled (invalid axis)</LI> * </UL> */ public void testObliqueEdgeLeftAndRight() { @@ -116,10 +115,8 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { * <UL> * <LI>Straighten oblique edge24 to Left: Expected OK</LI> * <LI>Straighten oblique edge24 to Right: Expected OK</LI> - * <LI>Straighten oblique edge24 to Top: Expected: menu disabled (invalid - * axis)</LI> - * <LI>Straighten oblique edge24 to Bottom: Expected: menu disabled (invalid - * axis)</LI> + * <LI>Straighten oblique edge24 to Top: Expected: menu disabled (invalid axis)</LI> + * <LI>Straighten oblique edge24 to Bottom: Expected: menu disabled (invalid axis)</LI> * </UL> */ public void testObliqueEdgeLeftAndRightWithWrongYGMFCoordinate() { @@ -130,10 +127,8 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <ul> - * <LI>Straighten oblique edge8 to Right: Expected: menu disabled (centered - * edge on source side)</LI> - * <LI>Straighten oblique edge8 to Left: Expected: menu disabled (centered - * edge on source side)</LI> + * <LI>Straighten oblique edge8 to Right: Expected: menu disabled (centered edge on source side)</LI> + * <LI>Straighten oblique edge8 to Left: Expected: menu disabled (centered edge on source side)</LI> * </ul> */ public void testObliqueEdgeLeftAndRightForbiddenBecauseofCentering() { @@ -193,8 +188,7 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <UL> * <LI>Straighten rectilinear edge14 to Top: Expected OK</LI> - * <LI>Straighten rectilinear edge14 to Bottom: Expected: menu disabled (out - * of bounds)</LI> + * <LI>Straighten rectilinear edge14 to Bottom: Expected: menu disabled (out of bounds)</LI> * </UL> */ public void testRectilinearTopAndBottomOutOfBounds() { @@ -206,33 +200,30 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <ul> * <LI>Straighten oblique edge4 to Top: Expected OK</LI> - * <LI>Straighten oblique edge4 to Bottom: Expected OK (even if it concerns - * a border node with several edge)</LI> + * <LI>Straighten oblique edge4 to Bottom: Expected OK (even if it concerns a border node with several edge)</LI> * </ul> */ public void testObliqueEdgeLinkedToBorderNodeWithSeveralEdges() { // {top,bottom,left,right} boolean[] availableDirections = { true, true, false, false }; - checkEdgeActions(availableDirections, true, "edge4"); + checkEdgeActions(availableDirections, true, null, "edge4"); } /** * <ul> - * <LI>Straighten oblique edge17 to Left: Expected OK (even if it concerns a - * border node with several edge)</LI> + * <LI>Straighten oblique edge17 to Left: Expected OK (even if it concerns a border node with several edge)</LI> * <LI>Straighten oblique edge17 to Right: Expected OK</LI> * </ul> */ public void testRectilinearEdgeLinkedToBorderNodeWithSeveralEdges() { // {top,bottom,left,right} boolean[] availableDirections = { false, false, true, true }; - checkEdgeActions(availableDirections, true, "edge17"); + checkEdgeActions(availableDirections, true, null, "edge17"); } /** * <ul> - * <LI>Straighten oblique edge17 to Left: Expected OK (even if it concerns a - * border node with several edge)</LI> + * <LI>Straighten oblique edge17 to Left: Expected OK (even if it concerns a border node with several edge)</LI> * <LI>Straighten oblique edge17 to Right: Expected OK</LI> * </ul> */ @@ -248,8 +239,7 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <ul> * <LI>Straighten oblique edge6 to Top: Expected OK</LI> - * <LI>Straighten oblique edge6 to Bottom: Expected: menu disabled (overlap) - * </LI> + * <LI>Straighten oblique edge6 to Bottom: Expected: menu disabled (overlap)</LI> * </ul> */ public void testObliqueEdgeTopAndBottomForbiddenForOverlap() { @@ -259,8 +249,7 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { } /** - * Straighten rectilinear edge2 to *: Expected: menu disabled (not same - * axis) + * Straighten rectilinear edge2 to *: Expected: menu disabled (not same axis) */ public void testRectilinearAllForbiddenForDifferentAxes() { // {top,bottom,left,right} @@ -271,8 +260,7 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <ul> * <LI>Straighten rectilinear edge5 to Right: Expected: OK</LI> - * <LI>Straighten rectilinear edge5 to Left: Expected: menu disabled - * (centered edge on target side)</LI> + * <LI>Straighten rectilinear edge5 to Left: Expected: menu disabled (centered edge on target side)</LI> * </ul> */ public void testRectilinearToRightWithLeftForbiddenBecauseofCentering() { @@ -283,10 +271,9 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <ul> - * <LI>Straighten rectilinear edge5 to Right with zoom 200% : Expected: OK - * </LI> - * <LI>Straighten rectilinear edge5 to Left with zoom 200% : Expected: menu - * disabled (centered edge on target side)</LI> + * <LI>Straighten rectilinear edge5 to Right with zoom 200% : Expected: OK</LI> + * <LI>Straighten rectilinear edge5 to Left with zoom 200% : Expected: menu disabled (centered edge on target + * side)</LI> * </ul> */ public void testRectilinearToRightWithLeftForbiddenBecauseofCenteringWithZoom200() { @@ -310,21 +297,33 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { } /** - * Straighten edge5 AND edge15 to *: Expected: menu disabled (not same axis - * for both edges) + * Edges subject to a straighten action. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ + private enum EdgeImpact { + FIRST_EDGE, SECOND_EDGE, BOTH_EDGE; + } + + /** + * Tests that launching "straighten to" action available for one edge among two selected applies the straightening + * to this edge without error. */ - public void testTwoEdgesAllForbidden() { + public void testTwoEdgesAllIncompatibleStraigthenAction() { // {top,bottom,left,right} - boolean[] availableDirections = { false, false, false, false }; - checkEdgeActions(availableDirections, "edge5", "edge15"); + boolean[] availableDirections = { true, true, false, true }; + Map<Integer, EdgeImpact> directionsIndexToConcernedEdge = new HashMap<>(); + directionsIndexToConcernedEdge.put(0, EdgeImpact.SECOND_EDGE); + directionsIndexToConcernedEdge.put(1, EdgeImpact.SECOND_EDGE); + directionsIndexToConcernedEdge.put(3, EdgeImpact.FIRST_EDGE); + checkEdgeActions(availableDirections, directionsIndexToConcernedEdge, "edge5", "edge15"); } /** * <ul> - * <LI>Straighten oblique edge7 to Bottom: Expected: OK (with scrollbar) - * </LI> - * <LI>Straighten oblique edge7 to Top: Expected: menu disabled (out of - * bounds)</LI> + * <LI>Straighten oblique edge7 to Bottom: Expected: OK (with scrollbar)</LI> + * <LI>Straighten oblique edge7 to Top: Expected: menu disabled (out of bounds)</LI> * </ul> */ public void testObliqueToBottomWithScrollbar() { @@ -338,10 +337,8 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <UL> - * <LI>Straighten rectilinear edge14 to Top: Expected OK (with scrollbar) - * </LI> - * <LI>Straighten rectilinear edge14 to Bottom: Expected: menu disabled (out - * of bounds with scrollbar)</LI> + * <LI>Straighten rectilinear edge14 to Top: Expected OK (with scrollbar)</LI> + * <LI>Straighten rectilinear edge14 to Bottom: Expected: menu disabled (out of bounds with scrollbar)</LI> * </UL> */ public void testRectilinearTopAndBottomOutOfBoundsWithScrollbar() { @@ -354,25 +351,36 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { } /** - * Straighten edge12 AND container3 to *: Expected: menu not visible - * (container in selection) + * Straighten edge12 AND container3 to *: Expected: menu visible (container in selection) */ public void testMenuVisibilityWithEdgeAndContainer() { SWTBotGefEditPart editPart1 = editor.getEditPart("edge12", AbstractDiagramEdgeEditPart.class); SWTBotGefEditPart editPart2 = editor.getEditPart("container3", AbstractDiagramContainerEditPart.class); editor.select(editPart1, editPart2); - try { - editor.clickContextMenu(Messages.StraightenToMenuAction_text); - fail("The " + Messages.StraightenToMenuAction_text + " menu should not be displayed"); - } catch (WidgetNotFoundException e) { - // do nothing, normal case. - } + editor.reveal(editPart1.part()); + // {top,bottom,left,right} + boolean[] availableDirections = { false, true, false, false }; + checkEdgeActions(availableDirections, "edge11"); + } + + /** + * Straighten edge12 AND its name part are selected: + * + * Expected: menu visible + */ + public void testMenuVisibilityWithEdgeAndPartName() { + SWTBotGefEditPart editPart1 = editor.getEditPart("edge12", AbstractDiagramEdgeEditPart.class); + SWTBotGefEditPart editPart2 = editor.getEditPart("edge12", AbstractDiagramNameEditPart.class); + editor.select(editPart1, editPart2); + editor.reveal(editPart1.part()); + // {top,bottom,left,right} + boolean[] availableDirections = { false, true, false, false }; + checkEdgeActions(availableDirections, "edge11"); } /** * <ul> - * <LI>Straighten oblique edge11 to Top: Expected: menu disabled (out of - * bounds)</LI> + * <LI>Straighten oblique edge11 to Top: Expected: menu disabled (out of bounds)</LI> * <LI>Straighten oblique edge11 to Bottom: Expected OK</LI> * </ul> */ @@ -387,8 +395,7 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { /** * <ul> * <LI>Straighten oblique edge10 to Top: Expected OK</LI> - * <LI>Straighten oblique edge10 to Bottom: Expected: menu disabled (out of - * bounds)</LI> + * <LI>Straighten oblique edge10 to Bottom: Expected: menu disabled (out of bounds)</LI> * </ul> */ public void testObliqueEdgeTopAndBottomBetweenElementNotAtSameLevel() { @@ -436,7 +443,7 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { * list of names corresponding to the edges to select. */ private void checkEdgeActions(boolean[] availableDirections, String... edgeNames) { - checkEdgeActions(availableDirections, false, edgeNames); + checkEdgeActions(availableDirections, false, null, edgeNames); } /** @@ -451,12 +458,28 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { * the actions that should be available: {top,bottom,left,right} * @param edgeNames * list of names corresponding to the edges to select. + */ + private void checkEdgeActions(boolean[] availableDirections, Map<Integer, EdgeImpact> directionsIndexToConcernedEdge, String... edgeNames) { + checkEdgeActions(availableDirections, false, directionsIndexToConcernedEdge, edgeNames); + } + + /** + * Checks the edge "to straight" actions. Makes sure that: + * <ul> + * <li>All actions (To Top, To Bottom etc.) exist in the menu</li> + * <li>Actions are enable according to the availableDirections argument</li> + * <li>All enabled actions result is correct</li> + * </ul> + * + * @param availableDirections + * the actions that should be available: {top,bottom,left,right} * @param checkOtherEdges - * true if the bendpoints stability of edges linked to moved - * border node must also be checked (only segment linked to - * border node must be moved), false otherwise + * true if the bendpoints stability of edges linked to moved border node must also be checked (only + * segment linked to border node must be moved), false otherwise + * @param directionsIndexToConcernedEdge + * * @param edgeNames list of names corresponding to the edges to select. */ - private void checkEdgeActions(boolean[] availableDirections, boolean checkOtherEdges, String... edgeNames) { + private void checkEdgeActions(boolean[] availableDirections, boolean checkOtherEdges, Map<Integer, EdgeImpact> directionsIndexToConcernedEdge, String... edgeNames) { for (int i = 0; i < 4; i++) { Map<SWTBotGefEditPart, List<Point>> gefEditParts2ExpectedPointList = Maps.newHashMap(); // Map only used if checkOtherEdges is true @@ -474,21 +497,77 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { fail("the \"" + labels[i] + "\" menu should be " + status + " for the edge selection: " + Arrays.toString(edgeNames)); } if (enable) { + int j = 0; // if the action is enabled we check the result. for (SWTBotGefEditPart edgeEditPart : gefEditParts2ExpectedPointList.keySet()) { - List<Point> pointList = gefEditParts2ExpectedPointList.get(edgeEditPart); - computeExpectedPoints(edgeEditPart, pointList, i); - if (checkOtherEdges) { - computeOtherEdgesExpectedPoints(edgeEditPart, otherEdgeEditParts2ExpectedPointList, i); + boolean computePoints = false; + if (directionsIndexToConcernedEdge != null) { + switch (directionsIndexToConcernedEdge.get(i)) { + case BOTH_EDGE: + if (j == 0 || j == 1) { + computePoints = true; + } + break; + case FIRST_EDGE: + if (j == 0) { + computePoints = true; + } + break; + case SECOND_EDGE: + if (j == 1) { + computePoints = true; + } + break; + default: + computePoints = true; + break; + } + + } + if (computePoints) { + List<Point> pointList = gefEditParts2ExpectedPointList.get(edgeEditPart); + computeExpectedPoints(edgeEditPart, pointList, i); + if (checkOtherEdges) { + computeOtherEdgesExpectedPoints(edgeEditPart, otherEdgeEditParts2ExpectedPointList, i); + } } + j++; } editor.clickContextMenu(labels[i]); + j = 0; for (SWTBotGefEditPart edgeEditPart : gefEditParts2ExpectedPointList.keySet()) { - List<Point> pointList = gefEditParts2ExpectedPointList.get(edgeEditPart); - checkResult(edgeEditPart, pointList, i); - if (checkOtherEdges) { - checkResultOfOtherEdges(edgeEditPart, otherEdgeEditParts2ExpectedPointList); + boolean checkResult = false; + if (directionsIndexToConcernedEdge != null) { + switch (directionsIndexToConcernedEdge.get(i)) { + case BOTH_EDGE: + if (j == 0 || j == 1) { + checkResult = true; + } + break; + case FIRST_EDGE: + if (j == 0) { + checkResult = true; + } + break; + case SECOND_EDGE: + if (j == 1) { + checkResult = true; + } + break; + default: + checkResult = true; + break; + } + + } + if (checkResult) { + List<Point> pointList = gefEditParts2ExpectedPointList.get(edgeEditPart); + checkResult(edgeEditPart, pointList, i); + if (checkOtherEdges) { + checkResultOfOtherEdges(edgeEditPart, otherEdgeEditParts2ExpectedPointList); + } } + j++; } undo(); } @@ -504,11 +583,9 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { * @param edgeEditPart * the current edge swtbot edit part. * @param pointList - * the expected point list. The Start at 0 index and End at 1 - * index. + * the expected point list. The Start at 0 index and End at 1 index. * @param i - * the current action tested in labels order - * {top,bottom,left,right} + * the current action tested in labels order {top,bottom,left,right} */ private void checkResult(SWTBotGefEditPart edgeEditPart, List<Point> pointList, int i) { AbstractDiagramEdgeEditPart part = (AbstractDiagramEdgeEditPart) edgeEditPart.part(); @@ -524,14 +601,12 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { } /** - * Check that edges linked to the moved border node are at the expected - * location. + * Check that edges linked to the moved border node are at the expected location. * * @param edgeEditPart * The current straighten edge * @param otherEdgeEditParts2ExpectedPointList - * the list where register the expected points, a point set to - * {-1, -1} is to ignore in the comparison + * the list where register the expected points, a point set to {-1, -1} is to ignore in the comparison */ private void checkResultOfOtherEdges(SWTBotGefEditPart edgeEditPart, Map<AbstractDiagramEdgeEditPart, PointList> otherEdgeEditParts2ExpectedPointList) { for (Entry<AbstractDiagramEdgeEditPart, PointList> entry : otherEdgeEditParts2ExpectedPointList.entrySet()) { @@ -562,11 +637,9 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { * @param edgeEditPart * the swtbot gef editpart to check points. * @param pointList - * the list where register the expected points, (Start at 0 and - * End at 1) + * the list where register the expected points, (Start at 0 and End at 1) * @param i - * the current action index in labels order - * {top,bottom,left,right} order + * the current action index in labels order {top,bottom,left,right} order */ private void computeExpectedPoints(SWTBotGefEditPart edgeEditPart, List<Point> pointList, int i) { AbstractDiagramEdgeEditPart part = (AbstractDiagramEdgeEditPart) edgeEditPart.part(); @@ -648,17 +721,15 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { } /** - * Compute the expected points for edges linked to the moved border node. - * The current straighten edge is not in the returned list + * Compute the expected points for edges linked to the moved border node. The current straighten edge is not in the + * returned list * * @param edgeEditPart * The current straighten edge * @param otherEdgeEditParts2ExpectedPointList - * the list where register the expected points, a point set to - * {-1, -1} is to ignore in the comparison + * the list where register the expected points, a point set to {-1, -1} is to ignore in the comparison * @param i - * the current action index in labels order - * {top,bottom,left,right} order + * the current action index in labels order {top,bottom,left,right} order */ private void computeOtherEdgesExpectedPoints(SWTBotGefEditPart edgeEditPart, Map<AbstractDiagramEdgeEditPart, PointList> otherEdgeEditParts2ExpectedPointList, int i) { AbstractDiagramEdgeEditPart part = (AbstractDiagramEdgeEditPart) edgeEditPart.part(); @@ -718,16 +789,15 @@ public class StraightenToTest extends AbstractSiriusSwtBotGefTestCase { } /** - * Compute the expected points for edges linked to the moved border node. - * The current straighten edge is not in the returned list + * Compute the expected points for edges linked to the moved border node. The current straighten edge is not in the + * returned list * * @param borderNodeEditPart * The moved border node edit part * @param edgeEditPart * The current straighten edge * @param otherEdgeEditParts2ExpectedPointList - * the list where register the expected points, a point set to - * {-1, -1} is to ignore in the comparison + * the list where register the expected points, a point set to {-1, -1} is to ignore in the comparison */ private void computeOtherEdgesExpectedPoints(AbstractDiagramBorderNodeEditPart borderNodeEditPart, AbstractDiagramEdgeEditPart selectedEdgeEditPart, Map<AbstractDiagramEdgeEditPart, PointList> otherEdgeEditParts2ExpectedPointList) { |
