Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael ADAM2015-11-23 17:12:28 +0000
committerGerrit Code Review @ Eclipse.org2016-01-25 13:12:40 +0000
commit4d70da8c0df33a7fd6a20933bda10261d378a304 (patch)
tree54762701bfc530e99f53d1012fea88359e62a78c /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org
parente24b5fc0bdaebce8fa1568d6f8164e8393b0cf56 (diff)
downloadorg.eclipse.papyrus-4d70da8c0df33a7fd6a20933bda10261d378a304.tar.gz
org.eclipse.papyrus-4d70da8c0df33a7fd6a20933bda10261d378a304.tar.xz
org.eclipse.papyrus-4d70da8c0df33a7fd6a20933bda10261d378a304.zip
Bug 482586 - [LinkLF] Anchor doen't work for Oval
https://bugs.eclipse.org/bugs/show_bug.cgi?id=482586 Change-Id: I53dfe4dbc843b013f66b749eefed21a372464afa Signed-off-by: Mickael ADAM <mickael.adam@ALL4TEC.net>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/LinkLFSVGNodePlateFigure.java29
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SVGNodePlateFigure.java4
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SlidableRoundedRectangleAnchor.java10
3 files changed, 32 insertions, 11 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/LinkLFSVGNodePlateFigure.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/LinkLFSVGNodePlateFigure.java
index c1340584b98..e4ecba2a853 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/LinkLFSVGNodePlateFigure.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/LinkLFSVGNodePlateFigure.java
@@ -8,6 +8,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 482586
*
*****************************************************************************/
@@ -29,16 +30,25 @@ public class LinkLFSVGNodePlateFigure extends SVGNodePlateFigure {
private boolean myLinkLFIsEnabled = false;
+ /**
+ * {@inheritDoc}
+ */
public LinkLFSVGNodePlateFigure(GraphicalEditPart hostEP, int width, int height) {
super(width, height);
myHost = hostEP;
}
+ /**
+ * {@inheritDoc}
+ */
public LinkLFSVGNodePlateFigure withLinkLFEnabled() {
myLinkLFIsEnabled = Boolean.getBoolean(ENABLE_LINKLF);
return this;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
protected ConnectionAnchor createAnchor(PrecisionPoint p) {
if (!myLinkLFIsEnabled) {
@@ -49,16 +59,30 @@ public class LinkLFSVGNodePlateFigure extends SVGNodePlateFigure {
// PrecisionPoint will passed in - this is handled here
return createDefaultAnchor();
}
- PapyrusSlidableSnapToGridAnchor result = new PapyrusSlidableSnapToGridAnchor(this, p);
+
+ PapyrusSlidableSnapToGridAnchor result;
+ if (followSVGPapyrusPath) {
+ result = new PapyrusSlidableSnapToGridAnchor(this, p);
+ } else {
+ result = new SlidableRoundedRectangleAnchor(this, p);
+ }
result.setEditPart(myHost);
+
return result;
}
+ /**
+ * {@inheritDoc}
+ */
@Override
protected double getSlidableAnchorArea() {
return myLinkLFIsEnabled ? AVOID_DEFAULT_ANCHOR_AREA : super.getSlidableAnchorArea();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
protected ConnectionAnchor createConnectionAnchor(Point p) {
if (!myLinkLFIsEnabled) {
return super.createConnectionAnchor(p);
@@ -78,7 +102,4 @@ public class LinkLFSVGNodePlateFigure extends SVGNodePlateFigure {
return createAnchor(pt);
}
}
-
-
-
}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SVGNodePlateFigure.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SVGNodePlateFigure.java
index 281d34bd872..34bafc11d09 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SVGNodePlateFigure.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SVGNodePlateFigure.java
@@ -124,7 +124,7 @@ public class SVGNodePlateFigure extends DefaultSizeNodeFigure {
protected DefaultSizeNodeFigure defaultNodePlate;
/** The follow svg papyrus path. */
- private boolean followSVGPapyrusPath = false;
+ protected boolean followSVGPapyrusPath = false;
/**
* Sets if has to follow svg papyrus path.
@@ -441,7 +441,7 @@ public class SVGNodePlateFigure extends DefaultSizeNodeFigure {
}
if (defaultNodePlate instanceof IRoundedRectangleFigure) {
defaultNodePlate.setBounds(this.getBounds());
- return new SlidableRoundedRectangleAnchor(this);
+ return new SlidableRoundedRectangleAnchor(this, new PrecisionPoint(0, 0));
}
}
return super.createDefaultAnchor();
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SlidableRoundedRectangleAnchor.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SlidableRoundedRectangleAnchor.java
index c086273f457..2f1cde42fa8 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SlidableRoundedRectangleAnchor.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/figure/node/SlidableRoundedRectangleAnchor.java
@@ -22,7 +22,7 @@ import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.PrecisionRectangle;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.draw2d.ui.geometry.LineSeg;
-import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
/**
* A slideable anchor for rounded rectangle figures.
@@ -30,7 +30,7 @@ import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor;
* @author mri
* @author Mickael ADAM - ALL4TEC - mickael.adam@all4tec.net - Integration and adaptation for Papyrus API
*/
-public class SlidableRoundedRectangleAnchor extends SlidableAnchor {
+public class SlidableRoundedRectangleAnchor extends PapyrusSlidableSnapToGridAnchor {
/** the offset applied to the size of the rectangle */
private Dimension offset = new Dimension();
@@ -41,8 +41,8 @@ public class SlidableRoundedRectangleAnchor extends SlidableAnchor {
* @param figure
* the anchorable figure
*/
- public SlidableRoundedRectangleAnchor(final IFigure figure) {
- super(figure);
+ public SlidableRoundedRectangleAnchor(final NodeFigure figure) {
+ super(figure, new PrecisionPoint(0, 0));
}
/**
@@ -54,7 +54,7 @@ public class SlidableRoundedRectangleAnchor extends SlidableAnchor {
* @param p
* the anchor precision point
*/
- public SlidableRoundedRectangleAnchor(final IFigure figure, final PrecisionPoint p) {
+ public SlidableRoundedRectangleAnchor(final NodeFigure figure, final PrecisionPoint p) {
super(figure, p);
}

Back to the top