Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Redor2017-04-27 08:08:21 +0000
committerLaurent Redor2017-08-04 13:53:57 +0000
commita710d14893080e7cc5ebb2720b3ffac4ca7d0dd4 (patch)
tree8bf6cc1c27e0c92559b264f7ff1c0b53ad3bc6fc
parent529f82df970cfb43343e65647b5144b17d8cc5bc (diff)
downloadorg.eclipse.sirius-a710d14893080e7cc5ebb2720b3ffac4ca7d0dd4.tar.gz
org.eclipse.sirius-a710d14893080e7cc5ebb2720b3ffac4ca7d0dd4.tar.xz
org.eclipse.sirius-a710d14893080e7cc5ebb2720b3ffac4ca7d0dd4.zip
[520409] Fix GMF bug by overriding figure code in EditPart
Before this fix, a small shift can appears because of the computation delta between using getBounds and using getHandleBounds. This is visible with snap to grid (in some cases the result is not snapped). All instantiations of DefaultSizeNodeFigure have been replaced by the new SiriusDefaultSizeNodeFigure. In future, the fix will be done in GMF (bug 519250) and Sirius will use again DefaultSizeNodeFigure. Specific tests have been added in EdgeCreationPositionTest, but this is in EdgeCreationPositionWithSnapToGridTest that the problem is really visible. Some data of EdgeWithBorderNodeCreationPositionWithSnapToGridTest have been adapted. In fact, now the created border node is correctly snapped to the grid, and the previous data is not on the grid. Bug: 520409 Cherry-picked-from: 519305 Change-Id: I4af970d7a9658adccd91f726c03f4ddcde165757 Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java3
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/CustomStyleEditPart.java3
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/NoteEditPart.java3
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AbstractGeoShapePolygonFigure.java5
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirDefaultSizeNodeFigure.java4
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirStyleDefaultSizeNodeFigure.java4
-rw-r--r--plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/ContainerWithTitleBlockFigure.java6
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.html64
-rw-r--r--plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile8
-rw-r--r--plugins/org.eclipse.sirius.ext.gmf.runtime/META-INF/MANIFEST.MF4
-rw-r--r--plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/editparts/GraphicalHelper.java7
-rw-r--r--plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/gef/ui/figures/SiriusDefaultSizeNodeFigure.java85
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java54
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java120
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java8
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeLabelsMoveFromEdgeMoveTest.java4
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java11
17 files changed, 342 insertions, 51 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java
index 862733cdc0..d10fbdf769 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/edit/api/part/AbstractDiagramElementContainerEditPart.java
@@ -88,6 +88,7 @@ import org.eclipse.sirius.diagram.ui.tools.internal.util.EditPartQuery;
import org.eclipse.sirius.diagram.ui.tools.internal.util.NotificationQuery;
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.ext.base.Options;
+import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure;
import org.eclipse.sirius.viewpoint.DStylizable;
import org.eclipse.sirius.viewpoint.description.style.LabelBorderStyleDescription;
@@ -443,7 +444,7 @@ public abstract class AbstractDiagramElementContainerEditPart extends AbstractBo
if (getLabelBorderStyle.some()) {
result = new ContainerWithTitleBlockFigure(getMapMode().DPtoLP(defaultSize.width), getMapMode().DPtoLP(defaultSize.height), dde, getLabelBorderStyle.get());
} else {
- result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(defaultSize.width), getMapMode().DPtoLP(defaultSize.height));
+ result = new SiriusDefaultSizeNodeFigure(getMapMode().DPtoLP(defaultSize.width), getMapMode().DPtoLP(defaultSize.height));
}
return result;
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/CustomStyleEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/CustomStyleEditPart.java
index e5dde99d85..7d0def939d 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/CustomStyleEditPart.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/CustomStyleEditPart.java
@@ -40,6 +40,7 @@ import org.eclipse.sirius.diagram.ui.edit.internal.part.DiagramNodeEditPartOpera
import org.eclipse.sirius.diagram.ui.internal.edit.policies.NonResizableAndNonDuplicableEditPolicy;
import org.eclipse.sirius.diagram.ui.internal.edit.policies.StyleItemSemanticEditPolicy;
import org.eclipse.sirius.diagram.ui.tools.api.figure.BundledImageFigure;
+import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure;
import org.eclipse.sirius.ui.tools.api.color.VisualBindingManager;
import org.eclipse.sirius.viewpoint.description.SystemColors;
@@ -147,7 +148,7 @@ public class CustomStyleEditPart extends AbstractNotSelectableShapeNodeEditPart
* @was-generated
*/
protected NodeFigure createNodePlate() {
- final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ final DefaultSizeNodeFigure result = new SiriusDefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
return result;
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/NoteEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/NoteEditPart.java
index dd584abc6e..36c9629617 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/NoteEditPart.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/edit/parts/NoteEditPart.java
@@ -33,6 +33,7 @@ import org.eclipse.sirius.diagram.ui.edit.internal.part.DiagramElementEditPartOp
import org.eclipse.sirius.diagram.ui.edit.internal.part.DiagramNodeEditPartOperation;
import org.eclipse.sirius.diagram.ui.internal.edit.policies.FixedLayoutEditPolicy;
import org.eclipse.sirius.diagram.ui.tools.api.figure.AirNoteFigure;
+import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure;
import org.eclipse.sirius.ui.tools.api.color.VisualBindingManager;
import org.eclipse.sirius.viewpoint.LabelStyle;
import org.eclipse.sirius.viewpoint.RGBValues;
@@ -115,7 +116,7 @@ public class NoteEditPart extends AbstractNotSelectableShapeNodeEditPart impleme
* @was-generated
*/
protected NodeFigure createNodePlate() {
- DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ DefaultSizeNodeFigure result = new SiriusDefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
return result;
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AbstractGeoShapePolygonFigure.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AbstractGeoShapePolygonFigure.java
index e65eea7573..8799c767a5 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AbstractGeoShapePolygonFigure.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AbstractGeoShapePolygonFigure.java
@@ -17,7 +17,7 @@ import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.draw2d.ui.figures.IPolygonAnchorableFigure;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure;
/**
* Base class for polygons in the Geometric shapes palette.
@@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
*
* @author mchauvin
*/
-public abstract class AbstractGeoShapePolygonFigure extends DefaultSizeNodeFigure implements IPolygonAnchorableFigure {
+public abstract class AbstractGeoShapePolygonFigure extends SiriusDefaultSizeNodeFigure implements IPolygonAnchorableFigure {
/**
* Constructor.
@@ -86,6 +86,7 @@ public abstract class AbstractGeoShapePolygonFigure extends DefaultSizeNodeFigur
*
* @see org.eclipse.gmf.runtime.draw2d.ui.figures.IPolygonAnchorableFigure#getPolygonPoints()
*/
+ @Override
public PointList getPolygonPoints() {
return calculatePoints(new Rectangle(getBounds()));
}
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirDefaultSizeNodeFigure.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirDefaultSizeNodeFigure.java
index 9e1ae09a34..02406bd380 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirDefaultSizeNodeFigure.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirDefaultSizeNodeFigure.java
@@ -17,17 +17,17 @@ import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.gef.editparts.ZoomManager;
import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.sirius.diagram.ui.tools.api.figure.anchor.AnchorProvider;
import org.eclipse.sirius.diagram.ui.tools.api.figure.anchor.ZoomDependantAnchor;
import org.eclipse.sirius.diagram.ui.tools.internal.figure.AlphaBasedSlidableImageAnchor;
+import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure;
/**
* The air default size node figure to add custom anchor.
*
* @author ymortier
*/
-public class AirDefaultSizeNodeFigure extends DefaultSizeNodeFigure {
+public class AirDefaultSizeNodeFigure extends SiriusDefaultSizeNodeFigure {
/** The zoom manager. */
protected ZoomManager zoomManager;
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirStyleDefaultSizeNodeFigure.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirStyleDefaultSizeNodeFigure.java
index 02e2faa93b..5a12cf1407 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirStyleDefaultSizeNodeFigure.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/figure/AirStyleDefaultSizeNodeFigure.java
@@ -14,15 +14,15 @@ import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.PrecisionPoint;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.sirius.diagram.ui.tools.internal.figure.AlphaBasedSlidableImageAnchor;
+import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure;
/**
* The default size node for styles.
*
* @author ymortier
*/
-public class AirStyleDefaultSizeNodeFigure extends DefaultSizeNodeFigure {
+public class AirStyleDefaultSizeNodeFigure extends SiriusDefaultSizeNodeFigure {
/**
* Constructor.
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/ContainerWithTitleBlockFigure.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/ContainerWithTitleBlockFigure.java
index f97023f17e..da3d87191d 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/ContainerWithTitleBlockFigure.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/figure/ContainerWithTitleBlockFigure.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2010, 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
@@ -14,11 +14,11 @@ import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
import org.eclipse.sirius.diagram.BorderedStyle;
import org.eclipse.sirius.diagram.ui.tools.api.figure.SiriusWrapLabel;
import org.eclipse.sirius.diagram.ui.tools.api.figure.ViewNodeContainerFigureDesc;
import org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.IContainerLabelOffsets;
+import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure;
import org.eclipse.sirius.viewpoint.DStylizable;
import org.eclipse.sirius.viewpoint.LabelAlignment;
import org.eclipse.sirius.viewpoint.LabelStyle;
@@ -35,7 +35,7 @@ import com.google.common.collect.Iterables;
*
* @author smonnier
*/
-public class ContainerWithTitleBlockFigure extends DefaultSizeNodeFigure {
+public class ContainerWithTitleBlockFigure extends SiriusDefaultSizeNodeFigure {
private DStylizable viewNode;
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index 1bf2805253..114f709e19 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -13,6 +13,14 @@
<a href="#ReleaseNotesforSirius">Release Notes for Sirius</a>
<ol style="list-style: disc;">
<li>
+ <a href="#sirius4.1.7">Changes in Sirius 4.1.7</a>
+ <ol style="list-style: disc;">
+ <li>
+ <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a>
+ </li>
+ </ol>
+ </li>
+ <li>
<a href="#sirius4.1.6">Changes in Sirius 4.1.6</a>
<ol style="list-style: disc;">
<li>
@@ -22,7 +30,7 @@
<a href="#SpecifierVisibleChanges">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -33,7 +41,7 @@
<a href="#UserVisibleChanges2">User-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges2">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -44,7 +52,7 @@
<a href="#UserVisibleChanges3">User-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges3">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -52,7 +60,7 @@
<a href="#sirius4.1.3">Changes in Sirius 4.1.3</a>
<ol style="list-style: disc;">
<li>
- <a href="#DeveloperVisibleChanges4">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -63,7 +71,7 @@
<a href="#UserVisibleChanges4">User-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges5">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges6">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -74,7 +82,7 @@
<a href="#UserVisibleChanges5">User-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges6">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges7">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -88,7 +96,7 @@
<a href="#SpecifierVisibleChanges2">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges7">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges8">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -102,7 +110,7 @@
<a href="#SpecifierVisibleChanges3">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges8">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges9">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -116,7 +124,7 @@
<a href="#SpecifierVisibleChanges4">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges9">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges10">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -130,7 +138,7 @@
<a href="#SpecifierVisibleChanges5">Specifier-Visible Changes</a>
</li>
<li>
- <a href="#DeveloperVisibleChanges10">Developer-Visible Changes</a>
+ <a href="#DeveloperVisibleChanges11">Developer-Visible Changes</a>
</li>
</ol>
</li>
@@ -140,6 +148,18 @@
<p>This document contains the release notes for recent major releases of Sirius. See also
<a href="Release_Notes_Previous.html">the release notes from previous versions</a> for details about older releases.
</p>
+ <h2 id="sirius4.1.7">Changes in Sirius 4.1.7</h2>
+ <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
+ <h4 id="Migrations">Migrations</h4>
+ <ul>
+ <li><span class="label label-success">Added</span> A new class
+ <code>org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure</code> has been added in plugin
+ <code>org.eclipse.sirius.ext.gmf.runtime</code>. The goal of the class is to workaround a
+ <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=519250">GMF bug</a>. So if you have created class which inherits from
+ <code>org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure</code>, you must now use the new
+ <code>SiriusDefaultSizeNodeFigure</code> instead.
+ </li>
+ </ul>
<h2 id="sirius4.1.6">Changes in Sirius 4.1.6</h2>
<h3 id="UserVisibleChanges">User-Visible Changes</h3>
<ul>
@@ -162,8 +182,8 @@
<em>Force Refresh</em> option of a tool is enabled in your VSM, only the current representation is refreshed when the tool is applied. Before this version, all open representations were refreshed.
</li>
</ul>
- <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3>
- <h4 id="Migrations">Migrations</h4>
+ <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3>
+ <h4 id="Migrations2">Migrations</h4>
<ul>
<li><span class="label label-success">Added</span> A migration has been added to fix diagram with edge labels corrupted (see
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=517437">bugzilla #517437</a> for more details). The corresponding version, stored in attribute version of viewpoint:DAnalysis of the aird file, is
@@ -177,8 +197,8 @@
<a href="./user/general/Modeling%20Project.html#Migration">automatic migration</a> of the aird file.
</li>
</ul>
- <h3 id="DeveloperVisibleChanges2">Developer-Visible Changes</h3>
- <h4 id="Migrations2">Migrations</h4>
+ <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3>
+ <h4 id="Migrations3">Migrations</h4>
<ul>
<li><span class="label label-success">Added</span> A migration is added in this version to fix the alignment of the text in notes (as explained in user visible changes). The corresponding version, stored in attribute version of viewpoint:DAnalysis of the aird file, is
<em>11.1.5.201704181500</em>.
@@ -201,7 +221,7 @@
<i>In case of multi-selection, the overlap check is done in the current context of existing border nodes and not in the context of location of border nodes after each straighten edges.</i>).
</li>
</ul>
- <h3 id="DeveloperVisibleChanges3">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3>
<h4 id="Changesinorg.eclipse.sirius.ui">Changes in
<code>org.eclipse.sirius.ui</code>
</h4>
@@ -211,7 +231,7 @@
</li>
</ul>
<h2 id="sirius4.1.3">Changes in Sirius 4.1.3</h2>
- <h3 id="DeveloperVisibleChanges4">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges5">Developer-Visible Changes</h3>
<h4 id="Changesinorg.eclipse.sirius.tests.junit.support">Changes in
<code>org.eclipse.sirius.tests.junit.support</code>
</h4>
@@ -268,7 +288,7 @@ SWTBotUtils.waitAllUiEvents();
<br/>
<img border="0" src="./images/PreferencePageMaxTabName.png"/>
</p>
- <h3 id="DeveloperVisibleChanges5">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges6">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span>
<code>org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerWithMapping</code> class has been added to handle copy/paste format with mapping information when an element target of a format pasting has many source diagram format corresponding to its key. In this case, we use the mapping information to get the more precise data format. And if no result matched, then we return the first found by using the key.
@@ -303,7 +323,7 @@ SWTBotUtils.waitAllUiEvents();
<ul>
<li><span class="label label-info">Modified</span>The &#8220;straighten to&#8221; actions were previously disabled when an edge is connected to border nodes that have several edges. It is now allowed.</li>
</ul>
- <h3 id="DeveloperVisibleChanges6">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges7">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span>
<code>org.eclipse.sirius.table.business.api.helper.TableHelper.getEStructuralFeature(DLine, DColumn)</code> method has been added to retrieve the EStructuralFeature associated to a table column.
@@ -426,7 +446,7 @@ SWTBotUtils.waitAllUiEvents();
<code>org.eclipse.sirius.diagram.ui.formatDataManager</code>. The deprecated extension point will be removed in the next 5.0 Sirius major release. Several classes associated with this deprecated extension point are also deprecated (see Developer-Visible Changes for details).
</li>
</ul>
- <h3 id="DeveloperVisibleChanges7">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges8">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> As the first step to save the DRepresentation in its own resource,
<code>org.eclipse.sirius.viewpoint.DView.getOwnedRepresentationDescriptors()</code> has been added as a wrapper of the
@@ -914,7 +934,7 @@ SWTBotUtils.waitAllUiEvents();
</li>
<li><span class="label label-info">Modified</span> The variable under VariableFilter, previously named &#8220;Variable&#8221;, is renamed to &#8220;Select Model Element Variable&#8221;. It is functionally equivalent.</li>
</ul>
- <h3 id="DeveloperVisibleChanges8">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges9">Developer-Visible Changes</h3>
<ul>
<li><span class="label label-success">Added</span> It is now possible to provide a full customized tab-bar by implementing the
<code>ITabbarContributor</code> through the
@@ -1396,7 +1416,7 @@ SWTBotUtils.waitAllUiEvents();
<code>IPermissionAuthority</code>) of the potential to delete objects. This is the reverse order of what was done before, and can have performance impacts if the precondition is slow. The specifier will to take care to ensure a good performance for the precondition expression of the delete tool.
</li>
</ul>
- <h3 id="DeveloperVisibleChanges9">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges10">Developer-Visible Changes</h3>
<h4 id="Partialsupportforinternationalization">Partial support for internationalization</h4>
<p>Sirius 3.1 introduces partial support for internationalization: all literal strings from the runtime part of Sirius are now externalized and can be localized by third parties by providing the appropriate &#8220;language packs&#8221; as OSGi fragments. Note that this does not concern the VSM editor&#8217;s UI, the VSMs themselves, or the parts of the UI inherited from Eclipse/EMF/GEF/GMF and other libraries and frameworks used by Sirius.</p>
<p>Some API changes were required to enable this. While technically breaking changes if interpreting strictly the OSGi versioning rules, the major version number of the impacted bundles was not incremented as the changes only concern classes that should not impact the vast majority of users. Most breaking changes concern the plug-in/activator classes from each bundle. They are:</p>
@@ -1953,7 +1973,7 @@ SWTBotUtils.waitAllUiEvents();
<em>EStructuralFeature</em> (inherited or with same name).
</li>
</ul>
- <h3 id="DeveloperVisibleChanges10">Developer-Visible Changes</h3>
+ <h3 id="DeveloperVisibleChanges11">Developer-Visible Changes</h3>
<p>The most important and impacting changes in this release are (details below in plug-in specific sections):</p>
<ul>
<li><span class="label label-success">Added</span> The new extension point
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index 51ce4b6d34..cc80538ed3 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -4,6 +4,14 @@ h1. Release Notes for Sirius
This document contains the release notes for recent major releases of Sirius. See also "the release notes from previous versions":Release_Notes_Previous.html for details about older releases.
+h2(#sirius4.1.7). Changes in Sirius 4.1.7
+
+h3. Developer-Visible Changes
+
+h4. Migrations
+
+* <span class="label label-success">Added</span> A new class @org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.SiriusDefaultSizeNodeFigure@ has been added in plugin @org.eclipse.sirius.ext.gmf.runtime@. The goal of the class is to workaround a "GMF bug":https://bugs.eclipse.org/bugs/show_bug.cgi?id=519250. So if you have created class which inherits from @org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure@, you must now use the new @SiriusDefaultSizeNodeFigure@ instead.
+
h2(#sirius4.1.6). Changes in Sirius 4.1.6
h3. User-Visible Changes
diff --git a/plugins/org.eclipse.sirius.ext.gmf.runtime/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.ext.gmf.runtime/META-INF/MANIFEST.MF
index 882b3d93e6..253a80b13f 100644
--- a/plugins/org.eclipse.sirius.ext.gmf.runtime/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.sirius.ext.gmf.runtime/META-INF/MANIFEST.MF
@@ -22,6 +22,7 @@ Import-Package: com.google.common.base;version="10.0.1",
org.eclipse.gmf.runtime.diagram.ui.util,
org.eclipse.gmf.runtime.draw2d.ui.figures,
org.eclipse.gmf.runtime.draw2d.ui.geometry,
+ org.eclipse.gmf.runtime.gef.ui.figures,
org.eclipse.gmf.runtime.notation,
org.eclipse.jface.viewers,
org.eclipse.sirius.ext.base;version="2.0.0",
@@ -32,4 +33,5 @@ Import-Package: com.google.common.base;version="10.0.1",
Export-Package: org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools;version="2.0.4",
org.eclipse.sirius.ext.gmf.runtime.draw2d.ui.geometry;version="2.0.0",
org.eclipse.sirius.ext.gmf.runtime.editparts;version="3.0.0",
- org.eclipse.sirius.ext.gmf.runtime.editpolicies;version="4.0.0"
+ org.eclipse.sirius.ext.gmf.runtime.editpolicies;version="4.0.0",
+ org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures;version="5.1.0"
diff --git a/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/editparts/GraphicalHelper.java b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/editparts/GraphicalHelper.java
index 0ffafa9ea8..ddbc5a8a9f 100644
--- a/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/editparts/GraphicalHelper.java
+++ b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/editparts/GraphicalHelper.java
@@ -214,7 +214,7 @@ public final class GraphicalHelper {
* @param part
* a part from the diagram.
*/
- public static void screen2logical(Point point, IGraphicalEditPart part) {
+ public static void screen2logical(Point point, GraphicalEditPart part) {
point.translate(GraphicalHelper.getScrollSize(part));
point.performScale(1.0d / GraphicalHelper.getZoom(part));
}
@@ -306,8 +306,8 @@ public final class GraphicalHelper {
}
/**
- * Return the Point (absolute draw2d coordinates) corresponding to this
- * Anchor. If anchor is null, the center of <code>parent</code> is returned.
+ * Return the Point (absolute draw2d coordinates) corresponding to this Anchor. If anchor is null, the center of
+ * <code>parent</code> is returned.
*
* @param parent
* The parent node
@@ -323,6 +323,7 @@ public final class GraphicalHelper {
bounds = new PrecisionRectangle(parent.getFigure().getBounds());
}
parent.getFigure().translateToAbsolute(bounds);
+ screen2logical(bounds, parent);
PrecisionPoint rel;
if (anchor != null) {
diff --git a/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/gef/ui/figures/SiriusDefaultSizeNodeFigure.java b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/gef/ui/figures/SiriusDefaultSizeNodeFigure.java
new file mode 100644
index 0000000000..e5e9210f70
--- /dev/null
+++ b/plugins/org.eclipse.sirius.ext.gmf.runtime/src/org/eclipse/sirius/ext/gmf/runtime/gef/ui/figures/SiriusDefaultSizeNodeFigure.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures;
+
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PrecisionPoint;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+
+/**
+ * This class in only here to workaround a bug in {@link org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure}, bugzilla
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=519250. This is not the class NodeFigure that is overriden, because in
+ * Sirius, only SiriusDefaultSizeNodeFigure is used.<BR>
+ * The NodeFigure figure uses getBounds() of figure to compute anchor from point. But later, when the point is computed
+ * from anchor, the getBox() is used (and so getHandleBounds() instead of getBounds()).
+ *
+ * Compute anchor from point (line 174 of DefaultSizeNodeFigure, getBounds() is used):
+ * <UL>
+ * <LI>BaseSlidableAnchor.getAnchorRelativeLocation(Point, Rectangle) line: 302</LI>
+ * <LI>DefaultSizeNodeFigure(NodeFigure).createConnectionAnchor(Point) line: 174</LI>
+ * <LI>DefaultSizeNodeFigure(NodeFigure).getTargetConnectionAnchorAt(Point) line: 157</LI>
+ * </UL>
+ *
+ * Compute point from anchor (line 67 of SlidableAnchor, getHandleBounds() is used):
+ * <UL>
+ * <LI>SlidableAnchor.getBox() line: 67</LI>
+ * <LI>BaseSlidableAnchor.getAnchorPosition() line: 147</LI>
+ * </UL>
+ *
+ *
+ * @author lredor
+ */
+public class SiriusDefaultSizeNodeFigure extends DefaultSizeNodeFigure {
+
+ /**
+ * Constructor.
+ *
+ * @param defSize
+ * a <code>Dimension</code> that is used to initialize the default size
+ */
+ public SiriusDefaultSizeNodeFigure(Dimension defSize) {
+ super(defSize);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param width
+ * the initial width to initialize the default size with
+ * @param height
+ * the initial height to initialize the default size with
+ */
+ public SiriusDefaultSizeNodeFigure(int width, int height) {
+ super(width, height);
+ }
+
+ @Override
+ protected ConnectionAnchor createConnectionAnchor(Point p) {
+ ConnectionAnchor result;
+ if (p == null) {
+ result = getConnectionAnchor(szAnchor);
+ } else {
+ Point temp = p.getCopy();
+ translateToRelative(temp);
+ // getHandleBounds() is used here instead of getBounds().
+ PrecisionPoint pt = BaseSlidableAnchor.getAnchorRelativeLocation(temp, getHandleBounds());
+ if (isDefaultAnchorArea(pt)) {
+ result = getConnectionAnchor(szAnchor);
+ } else {
+ result = createAnchor(pt);
+ }
+ }
+ return result;
+ }
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java
index 21c3655894..c148497890 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/CenteredEdgesTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 THALES GLOBAL SERVICES and others.
+ * Copyright (c) 2008, 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
@@ -27,6 +27,7 @@ import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.NodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.gef.ui.figures.SlidableAnchor;
import org.eclipse.gmf.runtime.notation.ConnectorStyle;
import org.eclipse.gmf.runtime.notation.Edge;
@@ -423,7 +424,8 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase {
// In this case, the GMF point is not the same as the draw2d point. This
// "bug" does not concern the centered edge as the source is not
// centered.
- assertEdgeHasExpectedSrcAnchor(swtBotGefEditPart, TOP_LEFT_CORNER, false);
+ PrecisionPoint expectedAnchor = getExpectedAnchor(botGefEditPart, TOP_LEFT_CORNER);
+ assertEdgeHasExpectedSrcAnchor(swtBotGefEditPart, expectedAnchor, false);
// The target, other side of the move, must be always centered. But
// there is the same problem about GMF point (TODO compare with node
// case).
@@ -473,7 +475,8 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase {
// In this case, the GMF point is not the same as the draw2d point. This
// "bug" does not concern the centered edge as the target is not
// centered.
- assertEdgeHasExpectedTgtAnchor(swtBotGefEditPart, TOP_LEFT_CORNER, false);
+ PrecisionPoint expectedAnchor = getExpectedAnchor(botGefEditPart, TOP_LEFT_CORNER);
+ assertEdgeHasExpectedTgtAnchor(swtBotGefEditPart, expectedAnchor, false);
// The source, other side of the move, must be always centered. But
// there is the same problem about GMF point (TODO compare with node
// case).
@@ -962,8 +965,21 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase {
PointList pointList = connection.getPoints();
Point lineOrigin = pointList.getPoint(pointList.size() - 2);
Point realTargetConnection = pointList.getPoint(pointList.size() - 1);
+
+ // Get figure bounds
+ PrecisionRectangle figureBounds = null;
+ if (targetSwtBotGefEditPart.part() instanceof DNodeContainerEditPart) {
+ IFigure figure = ((DNodeContainerEditPart) targetSwtBotGefEditPart.part()).getFigure();
+ if (figure instanceof NodeFigure) {
+ Rectangle bounds = ((NodeFigure) figure).getHandleBounds().getCopy();
+ figureBounds = new PrecisionRectangle(bounds);
+ }
+ }
+ if (figureBounds == null) {
+ figureBounds = getAbsoluteBounds((IGraphicalEditPart) targetSwtBotGefEditPart.part());
+ }
- PrecisionPoint expectedLineTerminus = getProportionalPoint(getAbsoluteBounds((IGraphicalEditPart) targetSwtBotGefEditPart.part()), expectedAnchor);
+ PrecisionPoint expectedLineTerminus = getProportionalPoint(figureBounds, expectedAnchor);
connection.translateToRelative(expectedLineTerminus);
Option<Point> option = GraphicalHelper.getIntersection(lineOrigin, expectedLineTerminus, (IGraphicalEditPart) targetSwtBotGefEditPart.part(), false);
@@ -995,7 +1011,17 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase {
Point lineOrigin = pointList.getPoint(1);
Point realSourceConnection = pointList.getPoint(0);
- PrecisionPoint expectedLineTerminus = getProportionalPoint(getAbsoluteBounds((IGraphicalEditPart) sourceEditPart), expectedAnchor);
+ // Get figure bounds
+ PrecisionRectangle figureBounds = null;
+ IFigure figure = sourceEditPart.getFigure();
+ if (figure instanceof NodeFigure) {
+ Rectangle bounds = ((NodeFigure) figure).getHandleBounds().getCopy();
+ figureBounds = new PrecisionRectangle(bounds);
+ } else {
+ figureBounds = getAbsoluteBounds((IGraphicalEditPart) sourceEditPart);
+ }
+
+ PrecisionPoint expectedLineTerminus = getProportionalPoint(figureBounds, expectedAnchor);
Option<Point> option = GraphicalHelper.getIntersection(lineOrigin, expectedLineTerminus, (IGraphicalEditPart) sourceEditPart, false);
if (option.some()) {
@@ -1270,5 +1296,23 @@ public class CenteredEdgesTest extends AbstractSiriusSwtBotGefTestCase {
}
assertEquals("The GMF routing style is not the right", routingStyle.getLiteral(), gmfRoutingStyleName);
}
+
+ private PrecisionPoint getExpectedAnchor(SWTBotGefEditPart botGefEditPart, PrecisionPoint relativeToBounds) {
+ IFigure figure = ((DNodeContainerEditPart) botGefEditPart.part()).getFigure();
+ Rectangle figureBounds = null;
+ PrecisionPoint relativePoint = new PrecisionPoint();
+ Point anchorPoint = new PrecisionPoint();
+ if (figure instanceof NodeFigure) {
+ figureBounds = ((NodeFigure) figure).getHandleBounds().getCopy();
+ // Compute Anchor position
+ anchorPoint = figureBounds.getTopLeft().getCopy();
+ anchorPoint.setX((int) (anchorPoint.x + Math.round(figureBounds.width * relativeToBounds.preciseX())));
+ anchorPoint.setY((int) (anchorPoint.y + Math.round(figureBounds.height * relativeToBounds.preciseY())));
+ // compute anchor relative position
+ relativePoint.setPreciseX((anchorPoint.preciseX() - figureBounds.x) / figureBounds.width);
+ relativePoint.setPreciseY((anchorPoint.preciseY() - figureBounds.y) / figureBounds.height);
+ }
+ return relativePoint;
+ }
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java
index 2dda1213ef..94e2560bf0 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionTest.java
@@ -32,6 +32,7 @@ import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart;
import org.eclipse.sirius.ext.base.Option;
import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper;
import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UIDiagramRepresentation.ZoomLevel;
import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
import org.eclipse.sirius.tests.swtbot.support.api.condition.OperationDoneCondition;
import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor;
@@ -84,6 +85,21 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
protected void openDiagram(String name) {
editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), VIEWPOINT_NAME + " " + name, name, DDiagram.class);
editor.setSnapToGrid(false);
+ editor.zoom(ZoomLevel.ZOOM_100);
+ }
+
+ /**
+ * Open the diagram with the given <code>name</code>
+ *
+ * @param name
+ * The name of the diagram to open.
+ * @param zoomLevel
+ * the zoom to use
+ */
+ protected void openDiagram(String name, ZoomLevel zoomLevel) {
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), VIEWPOINT_NAME + " " + name, name, DDiagram.class);
+ editor.setSnapToGrid(false);
+ editor.zoom(zoomLevel);
}
/** */
@@ -92,16 +108,44 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
}
/** */
+ public void test_Node_Aligned() {
+ createEdgeAndValidateAnchors("Node", "A", AbstractDiagramNodeEditPart.class, new PrecisionPoint(0.98, 0.2737), "B", AbstractDiagramNodeEditPart.class, new PrecisionPoint(0.02, 0.35));
+ }
+
+ /** */
public void test_Container() {
createEdgeAndValidateAnchors("Container", "A", AbstractDiagramContainerEditPart.class, "B", AbstractDiagramContainerEditPart.class);
}
+ /**
+ * Same as test_Container() but with specific location that reveals a bug
+ * for snapToGrid (see bugzilla xxxxxx).
+ */
+ public void test_Container_Aligned() {
+ createEdgeAndValidateAnchors("Container", "A", AbstractDiagramContainerEditPart.class, new PrecisionPoint(0.98, 0.2737), "B", AbstractDiagramContainerEditPart.class,
+ new PrecisionPoint(0.02, 0.2737));
+ }
+
+ /**
+ * Same as test_Container_Aligned() but with a specific zoom.
+ */
+ public void test_Container_Aligned_WithZoom() {
+ createEdgeAndValidateAnchors("Container", "A", AbstractDiagramContainerEditPart.class, new PrecisionPoint(0.98, 0.2737), "B", AbstractDiagramContainerEditPart.class,
+ new PrecisionPoint(0.02, 0.2737), ZoomLevel.ZOOM_175);
+ }
+
/** */
public void test_List() {
createEdgeAndValidateAnchors("List", "A", AbstractDiagramListEditPart.class, "B", AbstractDiagramListEditPart.class);
}
/** */
+ public void test_List_Aligned() {
+ createEdgeAndValidateAnchors("List", "A", AbstractDiagramListEditPart.class, new PrecisionPoint(1.0, 0.638095238095238), "B", AbstractDiagramListEditPart.class,
+ new PrecisionPoint(0.0, 0.4448669201520912));
+ }
+
+ /** */
public void test_Node_in_Container() {
createEdgeAndValidateAnchors("Node in Container", "C", AbstractDiagramNodeEditPart.class, "D", AbstractDiagramNodeEditPart.class);
}
@@ -112,6 +156,12 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
}
/** */
+ public void test_Container_in_Container_Aligned() {
+ createEdgeAndValidateAnchors("Container in Container", "C", AbstractDiagramContainerEditPart.class, new PrecisionPoint(1.0, 0.18672199170124482), "D", AbstractDiagramContainerEditPart.class,
+ new PrecisionPoint(0.0, 0.1262135922330097));
+ }
+
+ /** */
public void test_Bordered_Node_on_Container() {
createEdgeAndValidateAnchors("Bordered Node on Container", "C", AbstractDiagramBorderNodeEditPart.class, "D", AbstractDiagramBorderNodeEditPart.class);
}
@@ -121,6 +171,12 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
createEdgeAndValidateAnchors("Bordered Node on Node", "C", AbstractDiagramBorderNodeEditPart.class, "D", AbstractDiagramBorderNodeEditPart.class);
}
+ /** */
+ public void test_Bordered_Node_on_Node_Aligned() {
+ createEdgeAndValidateAnchors("Bordered Node on Node", "C", AbstractDiagramBorderNodeEditPart.class, new PrecisionPoint(0.98, 0.7038834951456311), "D", AbstractDiagramBorderNodeEditPart.class,
+ new PrecisionPoint(0.02, 0.4975124378109453));
+ }
+
/**
* Open the diagram <code>diagramName</code>, create an edge between
* <code>sourceName</code> and <code>targetName</code> and validate the
@@ -138,12 +194,68 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
* The type of the expected target edit part
*/
private void createEdgeAndValidateAnchors(String diagramName, String sourceName, Class<? extends EditPart> expectedSourceType, String targetName, Class<? extends EditPart> expectedTargetType) {
- openDiagram(diagramName);
+ createEdgeAndValidateAnchors(diagramName, sourceName, expectedSourceType, TOP_LEFT_CORNER, targetName, expectedTargetType, BOTTOM_RIGHT_CORNER);
+ }
+
+ /**
+ * Open the diagram <code>diagramName</code>, create an edge between
+ * <code>sourceName</code> and <code>targetName</code> and validate the
+ * source and target anchors.
+ *
+ * @param diagramName
+ * The name of the diagram to open
+ * @param sourceName
+ * The name of the source
+ * @param expectedSourceType
+ * The type of the expected source edit part
+ * @param sourcePosition
+ * The position for the first point of the edge (source)
+ * @param targetName
+ * The name of the target
+ * @param expectedTargetType
+ * The type of the expected target edit part
+ * @param targetPosition
+ * The position for the last point of the edge (target)
+ */
+ protected void createEdgeAndValidateAnchors(String diagramName, String sourceName, Class<? extends EditPart> expectedSourceType, PrecisionPoint sourcePosition, String targetName,
+ Class<? extends EditPart> expectedTargetType, PrecisionPoint targetPosition) {
+ createEdgeAndValidateAnchors(diagramName, sourceName, expectedSourceType, sourcePosition, targetName, expectedTargetType, targetPosition, ZoomLevel.ZOOM_100);
+ }
+
+ /**
+ * Open the diagram <code>diagramName</code>, create an edge between
+ * <code>sourceName</code> and <code>targetName</code> and validate the
+ * source and target anchors.
+ *
+ * @param diagramName
+ * The name of the diagram to open
+ * @param sourceName
+ * The name of the source
+ * @param expectedSourceType
+ * The type of the expected source edit part
+ * @param sourcePosition
+ * The position for the first point of the edge (source)
+ * @param targetName
+ * The name of the target
+ * @param expectedTargetType
+ * The type of the expected target edit part
+ * @param targetPosition
+ * The position for the last point of the edge (target)
+ * @param zoomLevel
+ * the zoom to use
+ */
+ protected void createEdgeAndValidateAnchors(String diagramName, String sourceName, Class<? extends EditPart> expectedSourceType, PrecisionPoint sourcePosition, String targetName,
+ Class<? extends EditPart> expectedTargetType, PrecisionPoint targetPosition, ZoomLevel zoomLevel) {
+ openDiagram(diagramName, zoomLevel);
IGraphicalEditPart sourcePart = (IGraphicalEditPart) editor.getEditPart(sourceName, expectedSourceType).part();
IGraphicalEditPart targetPart = (IGraphicalEditPart) editor.getEditPart(targetName, expectedTargetType).part();
- createEdge(sourcePart, TOP_LEFT_CORNER, targetPart, BOTTOM_RIGHT_CORNER);
+ createEdge(sourcePart, sourcePosition, targetPart, targetPosition);
DEdgeEditPart edge = getSingleDEdgeFrom((NodeEditPart) sourcePart);
assertAreValidAnchors(sourcePart, targetPart, edge);
+ if (!ZoomLevel.ZOOM_100.equals(zoomLevel)) {
+ // Reset to original zoom to avoid problem in further tests
+ editor.zoom(ZoomLevel.ZOOM_100);
+ }
}
/** */
@@ -246,8 +358,8 @@ public class EdgeCreationPositionTest extends AbstractSiriusSwtBotGefTestCase {
ICondition done = new OperationDoneCondition();
editor.activateTool(getCreateEdgeToolName());
- editor.click(sourcePoint);
- editor.click(targetPoint);
+ editor.click(sourcePoint, true);
+ editor.click(targetPoint, true);
SWTBotUtils.waitAllUiEvents();
bot.waitUntil(done);
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java
index 777703c68b..36e982398b 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeCreationPositionWithSnapToGridTest.java
@@ -17,6 +17,7 @@ import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart;
import org.eclipse.sirius.ext.gmf.runtime.editparts.GraphicalHelper;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UIDiagramRepresentation.ZoomLevel;
/**
* Same tests as {@link EdgeCreationPositionTest} but with snapToGrid enabled.
@@ -34,6 +35,13 @@ public class EdgeCreationPositionWithSnapToGridTest extends EdgeCreationPosition
}
@Override
+ protected void openDiagram(String name, ZoomLevel zoomLevel) {
+ super.openDiagram(name);
+ editor.setSnapToGrid(true, gridStep, 2);
+ editor.zoom(zoomLevel);
+ }
+
+ @Override
protected void assertAreValidAnchors(IGraphicalEditPart source, IGraphicalEditPart target, DEdgeEditPart edge) {
super.assertAreValidAnchors(source, target, edge);
// Check that at least
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeLabelsMoveFromEdgeMoveTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeLabelsMoveFromEdgeMoveTest.java
index e657a835a0..3647b78d42 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeLabelsMoveFromEdgeMoveTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeLabelsMoveFromEdgeMoveTest.java
@@ -479,7 +479,7 @@ public class EdgeLabelsMoveFromEdgeMoveTest extends AbstractSiriusSwtBotGefTestC
// that is removed but merged with another one --> The label is moved
// with the same delta (to keep the same vector).
edgeLabelExpectedPosition.clear();
- edgeLabelExpectedPosition.put("refToBBegin", new Dimension(0, -31));
+ edgeLabelExpectedPosition.put("refToBBegin", new Dimension(0, -30));
edgeLabelExpectedPosition.put("refToBCenter", new Dimension(0, 0));
edgeLabelExpectedPosition.put("refToBEnd", new Dimension(0, 0));
doTestMovePointOnEdge(diagramName, Lists.newArrayList(new Point(-5, -30)), edgeLabelExpectedPosition, ZoomLevel.ZOOM_100, "A", "B", 0);
@@ -487,7 +487,7 @@ public class EdgeLabelsMoveFromEdgeMoveTest extends AbstractSiriusSwtBotGefTestC
edgeLabelExpectedPosition.clear();
edgeLabelExpectedPosition.put("refToBBegin", new Dimension(0, 0));
edgeLabelExpectedPosition.put("refToBCenter", new Dimension(0, 0));
- edgeLabelExpectedPosition.put("refToBEnd", new Dimension(0, 29));
+ edgeLabelExpectedPosition.put("refToBEnd", new Dimension(0, 30));
doTestMovePointOnEdge(diagramName, Lists.newArrayList(new Point(5, 30)), edgeLabelExpectedPosition, ZoomLevel.ZOOM_100, "A", "B", 3);
edgeLabelExpectedPosition.clear();
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java
index 339ea9ad91..1839d9c4e6 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/EdgeWithBorderNodeCreationPositionWithSnapToGridTest.java
@@ -53,6 +53,13 @@ public class EdgeWithBorderNodeCreationPositionWithSnapToGridTest extends EdgeCr
}
@Override
+ protected void openDiagram(String name, ZoomLevel zoomLevel) {
+ super.openDiagram(name);
+ editor.setSnapToGrid(true, gridStep, 2);
+ editor.zoom(zoomLevel);
+ }
+
+ @Override
protected String getCreateEdgeToolName() {
return "SuperWithBorderNode";
}
@@ -162,8 +169,8 @@ public class EdgeWithBorderNodeCreationPositionWithSnapToGridTest extends EdgeCr
* Case of edge created between 2 containers in container with scroll.
*/
public void testBorderNodesOnContainerInContainerAreAlignedWithScrollOnDiagramAndContainer() {
- testBorderNodesAreAligned("TC2185 Container in Container", "Container in Container With Scroll", "C", AbstractDiagramContainerEditPart.class, 100, "D", AbstractDiagramContainerEditPart.class,
- 109, false, ZoomLevel.ZOOM_100, Options.newSome("OtherClass"));
+ testBorderNodesAreAligned("TC2185 Container in Container", "Container in Container With Scroll", "C", AbstractDiagramContainerEditPart.class, 99, "D", AbstractDiagramContainerEditPart.class,
+ 108, false, ZoomLevel.ZOOM_100, Options.newSome("OtherClass"));
}
/**

Back to the top