diff options
author | Vincent Lorenzo | 2014-04-08 11:53:23 +0000 |
---|---|---|
committer | Vincent Lorenzo | 2014-04-08 11:58:01 +0000 |
commit | 97f6bf56bdf0df0f2cec472ace387cfa997e23e9 (patch) | |
tree | ce34520d8b18800fcc734cc90bbd73379796a793 | |
parent | 0e52f57cdc3e8b6d21f2b6ec0626bded221e9061 (diff) | |
download | org.eclipse.papyrus-97f6bf56bdf0df0f2cec472ace387cfa997e23e9.tar.gz org.eclipse.papyrus-97f6bf56bdf0df0f2cec472ace387cfa997e23e9.tar.xz org.eclipse.papyrus-97f6bf56bdf0df0f2cec472ace387cfa997e23e9.zip |
432007: [IBD Diagram] In some cases flowport icons is not found when snap to grid is activated https://bugs.eclipse.org/bugs/show_bug.cgi?id=432007
-rw-r--r-- | plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java index c435098e961..e7c576a2f6e 100644 --- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java +++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java @@ -141,15 +141,12 @@ public class StructuredClassifierCreationEditPolicy extends CreationEditPolicy { PortPositionLocator locator = new PortPositionLocator(getHostFigure(), PositionConstants.NONE); final Rectangle preferredBounds = locator.getPreferredLocation(new Rectangle(requestedLocation, new Dimension(20, 20))); Rectangle retainedBounds = preferredBounds.getCopy(); - Rectangle parentBounds = getHostFigure().getBounds().getCopy(); - getHostFigure().translateToAbsolute(parentBounds); - + //find the current side of the wanted position - while(parentBounds.contains(realWantedLocation)) { - parentBounds.shrink(1, 1); - } - int currentSide = parentBounds.getPosition(realWantedLocation); - + final Rectangle parentBounds = getHostFigure().getBounds().getCopy(); + //break all!!! getHostFigure().translateToAbsolute(parentBounds); + locator.setConstraint(preferredBounds.getCopy().translate(parentBounds.getLocation().getNegated())); + int currentSide = locator.getCurrentSideOfParent(); if(request.isSnapToEnabled() && currentSide != PositionConstants.NORTH_EAST && currentSide != PositionConstants.NORTH_WEST && currentSide != PositionConstants.SOUTH_EAST && currentSide != PositionConstants.SOUTH_WEST) { //request for snap port at the creation //we find the best location with snap Point wantedPoint = preferredBounds.getLocation(); |