diff options
author | Camille Letavernier | 2013-08-26 07:15:23 +0000 |
---|---|---|
committer | Camille Letavernier | 2013-08-26 07:15:23 +0000 |
commit | f17ef957d58095b1293fa4b94b3b7bfb30401fb2 (patch) | |
tree | ae80a75d10e2c24ab6dfd2d96fd32966379bf245 /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common | |
parent | ed760c6f9e8e89da5e2fa57722ce8367ec4fb349 (diff) | |
parent | 238e80554099e85e1e034ce2cdbd214343781152 (diff) | |
download | org.eclipse.papyrus-f17ef957d58095b1293fa4b94b3b7bfb30401fb2.tar.gz org.eclipse.papyrus-f17ef957d58095b1293fa4b94b3b7bfb30401fb2.tar.xz org.eclipse.papyrus-f17ef957d58095b1293fa4b94b3b7bfb30401fb2.zip |
Merge branch 'master' of ssh://cletavernie@git.eclipse.org/gitroot/papyrus/org.eclipse.papyrus.git
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml | 4 | ||||
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/FullInsidePortPositionLocator.java (renamed from plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ConstraintParameterPositionLocator.java) | 53 |
2 files changed, 47 insertions, 10 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml index ce3c59b5759..8e0a4c7141f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml @@ -373,7 +373,7 @@ </iterate> <test forcePluginActivation="true" - property="org.eclipse.papyrus.infra.services.resourceloading.tester.isAllNotLoaded" + property="org.eclipse.papyrus.infra.core.resourceloading.tester.isAllNotLoaded" value="true" /> </and> </with> @@ -405,7 +405,7 @@ </iterate> <test forcePluginActivation="true" - property="org.eclipse.papyrus.infra.services.resourceloading.tester.isAllLoaded" + property="org.eclipse.papyrus.infra.core.resourceloading.tester.isAllLoaded" value="true" /> </and> </with> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ConstraintParameterPositionLocator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/FullInsidePortPositionLocator.java index 3470da2f32f..c1532310638 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/ConstraintParameterPositionLocator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/locator/FullInsidePortPositionLocator.java @@ -22,7 +22,7 @@ import org.eclipse.draw2d.geometry.Rectangle; * This class is used to constrain the position of ConstraintParameter when they are added on a ConstraintProperty * * <pre> - * +-------------------+ + * /------------------ \ * | [Constraint] | * +-------------------+ * | | @@ -30,7 +30,7 @@ import org.eclipse.draw2d.geometry.Rectangle; * | +-+ - Expected position of ConstraintParameter * | +-+ * | | - * +-------------------+ + * \-------------------/ * * </pre> * @@ -38,18 +38,31 @@ import org.eclipse.draw2d.geometry.Rectangle; * TODO : The ConstraintParameter is not re-sizable * </pre> */ -public class ConstraintParameterPositionLocator extends PortPositionLocator { +public class FullInsidePortPositionLocator extends PortPositionLocator { /** the width of the area surrounding the parent figure where border item can be put */ - private int constraintParameterSize = 20; + private int insidePortSize = 20; + private int corner = 0; /** Constructor **/ - public ConstraintParameterPositionLocator(IFigure parentFigure, int preferredSide) { + public FullInsidePortPositionLocator(IFigure parentFigure, int preferredSide) { super(parentFigure, preferredSide); borderItemOffset = 0; } + /** Constructor **/ + public FullInsidePortPositionLocator(IFigure parentFigure, int preferredSide, int corner) { + this(parentFigure, preferredSide); + this.corner = corner; + } + + /** Constructor **/ + public FullInsidePortPositionLocator(IFigure parentFigure, int preferredSide, int corner, int portSize) { + this(parentFigure, preferredSide, corner); + this.insidePortSize = portSize; + } + /** * * @param proposedLocation @@ -67,9 +80,9 @@ public class ConstraintParameterPositionLocator extends PortPositionLocator { // Calculate Max position around the graphical parent (1/2 size or the port around // the graphical parent bounds. int xMin = parentRec.x; - int xMax = parentRec.x + parentRec.width - constraintParameterSize; + int xMax = parentRec.x + parentRec.width - insidePortSize; int yMin = parentRec.y; - int yMax = parentRec.y + parentRec.height - constraintParameterSize; + int yMax = parentRec.y + parentRec.height - insidePortSize; // Modify Port location if MAX X or Y are exceeded if(realLocation.x < xMin) { @@ -92,7 +105,6 @@ public class ConstraintParameterPositionLocator extends PortPositionLocator { // Modify position if needed. if((realLocation.y != yMin) && (realLocation.y != yMax)) { if((realLocation.x != xMin) && (realLocation.x != xMax)) { - if(realLocation.x <= (xMin + (parentRec.width / 2))) { realLocation.x = xMin; } else { @@ -101,6 +113,31 @@ public class ConstraintParameterPositionLocator extends PortPositionLocator { } } + // Follow the curved corner of the ConstraintProperty + if (realLocation.x > (xMax - corner / 2)) { + if (realLocation.y < (yMin + corner / 2)) { + int h = (yMin + corner / 2) - realLocation.y; + int offSetX = new Double(Math.sqrt(Math.pow(corner / 2, 2) - Math.pow(h, 2))).intValue(); + realLocation.x = (xMax - corner / 2) + offSetX; + } + if (realLocation.y > (yMax - corner / 2)) { + int h = realLocation.y - (yMax - corner / 2); + int offSetX = new Double(Math.sqrt(Math.pow(corner / 2, 2) - Math.pow(h, 2))).intValue(); + realLocation.x = (xMax - corner / 2) + offSetX; + } + } + if (realLocation.x < (xMin + corner / 2) && (realLocation.y < (yMin + corner / 2) || realLocation.y > (yMax - corner / 2))) { + if (realLocation.y < (yMin + corner / 2)) { + int h = (yMin + corner / 2) - realLocation.y; + int offSetX = new Double(Math.sqrt(Math.pow(corner / 2, 2) - Math.pow(h, 2))).intValue(); + realLocation.x = (xMin + corner / 2) - offSetX; + } + if (realLocation.y > (yMax - corner / 2)) { + int h = realLocation.y - (yMax - corner / 2); + int offSetX = new Double(Math.sqrt(Math.pow(corner / 2, 2) - Math.pow(h, 2))).intValue(); + realLocation.x = (xMin + corner / 2) - offSetX; + } + } // Return constrained location return realLocation; } |