[518440] Complete migration participant

In some cases, the diagrams containing "corrupted edge labels" have also
a corrupted layout, with some nodes with very huge {x, y} coordinates.
The migration participant now detects them and reset their location to a
more conventional location. These diagrams must be manually layouted
after, the documentation explains that.

Bug: 518440
Cherry-picked-from: 517437
Change-Id: Ic809c6f9357328174a9ac21bee4e818c0f19ab8b
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
index 5e97337..7f7bc7d 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
+++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties
@@ -1136,8 +1136,9 @@
 SiriusValidationDecoratorProvider_refreshFailureMsg = Decorator refresh failure
 SiriusValidationProvider_validationFailed = Validation action failed
 SiriusVisualIDRegistry_parseError = Unable to parse view type as a visualID number: {0}
-SnapBackDistantLabelsMigrationParticipant_oneLabelSnapBacked = \n\t* One label of edge has been reset to its default location in diagram "{0}"
-SnapBackDistantLabelsMigrationParticipant_severalLabelsSnapBacked = \n\t* {0} labels of edge have been reset to their default location in diagram "{1}"
+SnapBackDistantLabelsMigrationParticipant_oneLabelSnapBacked = \n\t* One label of edge has been reset to its default location in diagram "{0}".
+SnapBackDistantLabelsMigrationParticipant_nodesMoved = \u0020Some nodes have also been moved as the layout of this diagram is corrupted. A Reset Origin and/or manual layout is probably needed for this diagram.
+SnapBackDistantLabelsMigrationParticipant_severalLabelsSnapBacked = \n\t* {0} labels of edge have been reset to their default location in diagram "{1}".
 SnapBackDistantLabelsMigrationParticipant_title = Migration done for "Corrupted edge labels" (the result of this migration will be saved on the next session save):
 SpecificationMenuContribution_openDefinitionMenuLabel = Open Definition
 StatusDecorator_validationMarkersFailureMsg = Validation markers refresh failure
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java
index 143b5ea..5b1d0f4 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/SnapBackDistantLabelsMigrationParticipant.java
@@ -13,7 +13,10 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 
 import org.eclipse.draw2d.geometry.Point;
 import org.eclipse.draw2d.geometry.PointList;
@@ -59,35 +62,66 @@
  * 
  * @author lredor
  */
+@SuppressWarnings("restriction")
 public class SnapBackDistantLabelsMigrationParticipant extends AbstractRepresentationsFileMigrationParticipant {
 
     /**
      * The Sirius version for which this migration is added.
      */
-    public static final Version MIGRATION_VERSION = new Version("10.1.9.201706191500"); //$NON-NLS-1$
+    public static final Version MIGRATION_VERSION = new Version("10.1.9.201706271200"); //$NON-NLS-1$
+
 
     /**
-     * The absolute maximum x coordinate from which label is considered distant.
-     */
-    private static final int X_UPPER_LIMIT = 1000;
-
-    /**
-     * The absolute maximum y coordinate from which label is considered distant.
-     */
-    private static final int Y_UPPER_LIMIT = 1000;
-
-    /**
-     * The absolute minimal x coordinate from which label is not considered
+     * The absolute maximum x or y coordinate from which label is considered
      * distant.
      */
-    private static final int X_LOWER_LIMIT = 250;
+    private static final int LABEL_UPPER_LIMIT = 1000;
 
     /**
-     * The absolute minimal y coordinate from which label is not considered
+     * The absolute minimal x or y coordinate from which label is not considered
      * distant.
      */
-    private static final int Y_LOWER_LIMIT = 250;
+    private static final int LABEL_LOWER_LIMIT = 250;
 
+    /**
+     * The absolute maximum x or y coordinates from which node is considered
+     * with "very huge coordinates".
+     */
+    private static final int NODES_LIMIT = 1000000;
+
+    /**
+     * Nodes with "very huge coordinates" are relocated to location near from
+     * it. This value is arbitrary. It allows to "easily" see elements with a
+     * zoom of 10%.
+     */
+    private static final int NODES_LIMIT_MOVE = 5000;
+
+    private static final String NEGATIVE_X_KEY = "-x"; //$NON-NLS-1$
+
+    private static final String POSITIVE_X_KEY = "+x"; //$NON-NLS-1$
+
+    private static final String NEGATIVE_Y_KEY = "-y"; //$NON-NLS-1$
+
+    private static final String POSITIVE_Y_KEY = "+y"; //$NON-NLS-1$
+
+    /**
+     * Determines a setter based on an input value and a new value.
+     * 
+     * @author lredor
+     *
+     */
+    public interface Setter<F, T> {
+        /**
+         * Set a value of type <code>F</code> with the new value <code>T</code>.
+         * 
+         * @param input
+         *            The object to modify
+         * @param newValue
+         *            The new value to set one property of <code>input</code>
+         */
+        void set(F input, T newValue);
+    }
+    
     @Override
     public Version getMigrationVersion() {
         return MIGRATION_VERSION;
@@ -104,19 +138,43 @@
 
             for (DView dView : dAnalysis.getOwnedViews()) {
                 for (DDiagram dDiagram : Iterables.filter(dView.getOwnedRepresentations(), DDiagram.class)) {
+                    // Search distant edge labels
                     List<Node> currentDistantEdgeLabels = getDistantEdgeLabels(dDiagram);
                     distantEdgeLabels.addAll(currentDistantEdgeLabels);
+
                     if (currentDistantEdgeLabels.size() > 0) {
                         isModified = true;
+                        // Add information to be logged
                         if (currentDistantEdgeLabels.size() > 1) {
                             sb.append(MessageFormat.format(Messages.SnapBackDistantLabelsMigrationParticipant_severalLabelsSnapBacked, currentDistantEdgeLabels.size(), dDiagram.getName()));
                         } else {
                             sb.append(MessageFormat.format(Messages.SnapBackDistantLabelsMigrationParticipant_oneLabelSnapBacked, dDiagram.getName()));
                         }
+
+                        // Search and fix nodes with huge coordinates.
+                        boolean nodesMoved = false;
+                        Map<String, Map<Node, Integer>> currentnodesWithExtremeLocation = getNodesWithExtremeLocation(dDiagram);
+                        for (String key : currentnodesWithExtremeLocation.keySet()) {
+                            if (NEGATIVE_X_KEY.equals(key)) {
+                                nodesMoved = moveNodesX(currentnodesWithExtremeLocation.get(key), false);
+                            } else if (POSITIVE_X_KEY.equals(key)) {
+                                nodesMoved = moveNodesX(currentnodesWithExtremeLocation.get(key), true);
+                            } else if (NEGATIVE_Y_KEY.equals(key)) {
+                                nodesMoved = moveNodesY(currentnodesWithExtremeLocation.get(key), false);
+                            } else {
+                                nodesMoved = moveNodesY(currentnodesWithExtremeLocation.get(key), true);
+                            }
+                        }
+
+                        if (nodesMoved) {
+                            // Add information to be logged
+                            sb.append(Messages.SnapBackDistantLabelsMigrationParticipant_nodesMoved);
+                        }
                     }
                 }
             }
 
+            // Fix distant edge labels
             for (Node distantEdgeLabel : distantEdgeLabels) {
                 Point offset = LabelEditPart.getSnapBackPosition(distantEdgeLabel.getType());
                 if (offset != null) {
@@ -124,6 +182,7 @@
                     ViewUtil.setStructuralFeatureValue(distantEdgeLabel, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(offset.y));
                 }
             }
+
             if (isModified) {
                 DiagramPlugin.getDefault().logInfo(sb.toString());
             }
@@ -131,6 +190,101 @@
     }
 
     /**
+     * Move all nodes to a more readable location.
+     * 
+     * @param nodesWithExtremeLocation
+     *            List of couple, node with extreme location and corresponding
+     *            huge coordinate.
+     * @param isPositive
+     *            true if the above list of nodes concerns nodes with positive
+     *            X, false if it concerns negative X
+     * @return true if at least one node has been moved, false otherwise
+     */
+    protected boolean moveNodesX(Map<Node, Integer> nodesWithExtremeLocation, boolean isPositive) {
+        return moveNodes(nodesWithExtremeLocation, isPositive, new Setter<Location, Integer>() {
+            @Override
+            public void set(Location input, Integer newValue) {
+                input.setX(newValue);
+            }
+        });
+    }
+
+    /**
+     * Move all nodes to a more readable location.
+     * 
+     * @param nodesWithExtremeLocation
+     *            List of couple, node with extreme location and corresponding
+     *            huge coordinate.
+     * @param isPositive
+     *            true if the above list of nodes concerns nodes with positive
+     *            X, false if it concerns negative X
+     * @return true if at least one node has been moved, false otherwise
+     */
+    protected boolean moveNodesY(Map<Node, Integer> nodesWithExtremeLocation, boolean isPositive) {
+        return moveNodes(nodesWithExtremeLocation, isPositive, new Setter<Location, Integer>() {
+            @Override
+            public void set(Location input, Integer newValue) {
+                input.setY(newValue);
+            }
+        });
+    }
+
+    /**
+     * Move all nodes to a more readable location.
+     * 
+     * @param nodesWithExtremeLocation
+     *            List of couple, node with extreme location and corresponding
+     *            location.
+     * @param isPositive
+     *            true if the above list of nodes concerns nodes with positive X
+     *            or Y, false if it concerns negative X or Y
+     * @param setter
+     *            A setter to set new X or Y coordinate
+     * @return true if at least one node has been moved, false otherwise
+     */
+    protected boolean moveNodes(Map<Node, Integer> nodesWithExtremeLocation, boolean isPositive, Setter<Location, Integer> setter) {
+        boolean nodesMoved = false;
+        int min = -NODES_LIMIT;
+        int max = Integer.MIN_VALUE;
+        if (isPositive) {
+            min = Integer.MAX_VALUE;
+            max = NODES_LIMIT;
+        }
+        // Get min and max values
+        for (Integer coordinate : nodesWithExtremeLocation.values()) {
+            nodesMoved = true;
+            if (coordinate < min) {
+                min = coordinate;
+            }
+            if (coordinate > max) {
+                max = coordinate;
+            }
+        }
+        // Get delta between min and max
+        int delta = max - min;
+        if (delta < NODES_LIMIT) {
+            // Moves all nodes with the same delta
+            for (Entry<Node, Integer> entry : nodesWithExtremeLocation.entrySet()) {
+                if (isPositive) {
+                    setter.set((Location) entry.getKey().getLayoutConstraint(), entry.getValue() - max - NODES_LIMIT_MOVE);
+                } else {
+                    setter.set((Location) entry.getKey().getLayoutConstraint(), entry.getValue() - min + NODES_LIMIT_MOVE);
+                }
+            }
+        } else {
+            // Move all nodes to the same location (-NODES_LIMIT)
+            for (Entry<Node, Integer> entry : nodesWithExtremeLocation.entrySet()) {
+                if (isPositive) {
+                    setter.set((Location) entry.getKey().getLayoutConstraint(), -NODES_LIMIT_MOVE);
+                } else {
+                    setter.set((Location) entry.getKey().getLayoutConstraint(), NODES_LIMIT_MOVE);
+                }
+            }
+        }
+        return nodesMoved;
+    }
+
+    /**
      * Create dummy edge name edit part to initialize the
      * registerSnapBackPosition() method of each kind of edit part. Without this
      * initialization, when using
@@ -158,6 +312,50 @@
     }
 
     /**
+     * Get all nodes with huge coordinates for this <code>dDiagram</code>. The
+     * nodes are grouped by nodes with negative X, positive X, negative Y and
+     * positive Y (using key {@link #NEGATIVE_X_KEY}, {@link #POSITIVE_X_KEY},
+     * {@link #NEGATIVE_Y_KEY}, {@link #POSITIVE_Y_KEY}).
+     * 
+     * @param dDiagram
+     *            The diagram in which to search.
+     * @return a list of nodes with the "huge coordinate" group by type.
+     */
+    private Map<String, Map<Node, Integer>> getNodesWithExtremeLocation(DDiagram dDiagram) {
+        Map<Node, Integer> nodesWithExtremeNegativeXLocation = new HashMap<Node, Integer>();
+        Map<Node, Integer> nodesWithExtremePositiveXLocation = new HashMap<Node, Integer>();
+        Map<Node, Integer> nodesWithExtremeNegativeYLocation = new HashMap<Node, Integer>();
+        Map<Node, Integer> nodesWithExtremePositiveYLocation = new HashMap<Node, Integer>();
+        for (Node node : getNodes(dDiagram)) {
+            if (node.getLayoutConstraint() instanceof Location) {
+                Location location = (Location) node.getLayoutConstraint();
+                Point point = new Point(location.getX(), location.getY());
+                // Do not deal with label between -lowerLimit and lowerLimit.
+                if (Math.abs(location.getX()) > NODES_LIMIT) {
+                    if (location.getX() > 0) {
+                        nodesWithExtremePositiveXLocation.put(node, point.x());
+                    } else {
+                        nodesWithExtremeNegativeXLocation.put(node, point.x());
+                    }
+                }
+                if (Math.abs(location.getY()) > NODES_LIMIT) {
+                    if (location.getY() > 0) {
+                        nodesWithExtremePositiveYLocation.put(node, point.y());
+                    } else {
+                        nodesWithExtremeNegativeYLocation.put(node, point.y());
+                    }
+                }
+            }
+        }
+        Map<String, Map<Node, Integer>> result = new HashMap<String, Map<Node, Integer>>();
+        result.put(NEGATIVE_X_KEY, nodesWithExtremeNegativeXLocation);
+        result.put(POSITIVE_X_KEY, nodesWithExtremePositiveXLocation);
+        result.put(NEGATIVE_Y_KEY, nodesWithExtremeNegativeYLocation);
+        result.put(POSITIVE_Y_KEY, nodesWithExtremePositiveYLocation);
+        return result;
+    }
+
+    /**
      * Check is the label is considered as distant from its edge:
      * <UL>
      * <LI>If the label is less than 250 pixels away from the reference point on
@@ -179,8 +377,8 @@
         if (edgeLabel.getLayoutConstraint() instanceof Location) {
             Location location = (Location) edgeLabel.getLayoutConstraint();
             // Do not deal with label between -lowerLimit and lowerLimit.
-            if (!(Math.abs(location.getX()) <= X_LOWER_LIMIT && Math.abs(location.getY()) <= Y_LOWER_LIMIT)) {
-                isLabelDistant = Math.abs(location.getX()) > X_UPPER_LIMIT || Math.abs(location.getY()) > Y_UPPER_LIMIT;
+            if (!(Math.abs(location.getX()) <= LABEL_LOWER_LIMIT && Math.abs(location.getY()) <= LABEL_LOWER_LIMIT)) {
+                isLabelDistant = Math.abs(location.getX()) > LABEL_UPPER_LIMIT || Math.abs(location.getY()) > LABEL_UPPER_LIMIT;
                 if (!isLabelDistant) {
                     try {
                         // Try to be more precise that just using location of
@@ -255,4 +453,22 @@
         }
         return new ArrayList<Edge>();
     }
+    
+    /**
+     * Get the {@link Edge}s with labels contained in the given {@link DDiagram}
+     * .
+     * 
+     * @param dDiagram
+     *            the given {@link DDiagram}.
+     * @return the {@link Edge}s with labels contained in the given
+     *         {@link DDiagram}.
+     */
+    private Collection<Node> getNodes(DDiagram dDiagram) {
+        DDiagramGraphicalQuery query = new DDiagramGraphicalQuery(dDiagram);
+        Option<Diagram> gmfDiagram = query.getAssociatedGMFDiagram();
+        if (gmfDiagram.some()) {
+            return Lists.newArrayList(Iterables.filter(gmfDiagram.get().getChildren(), Node.class));
+        }
+        return new ArrayList<Node>();
+    }
 }
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
index 0be0065..f59c059 100644
--- a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
+++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java
@@ -1197,6 +1197,9 @@
     public static String SnapBackDistantLabelsMigrationParticipant_oneLabelSnapBacked;
 
     @TranslatableMessage
+    public static String SnapBackDistantLabelsMigrationParticipant_nodesMoved;
+
+    @TranslatableMessage
     public static String SnapBackDistantLabelsMigrationParticipant_severalLabelsSnapBacked;
 
     @TranslatableMessage
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
index e5ded6a..ba934b8 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html
@@ -137,7 +137,8 @@
 			<li><span class="label label-success">Added</span> An 
 				<a href="./user/general/Modeling%20Project.html#Migration">automatic migration</a> has been added in this version to fix diagram with edge labels corrupted (see 
 				<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=518440">bugzilla #518440</a> for more details). Contrary to all previous migrations, this one logs an information in the 
-				<em>Error Log</em> view to inform how many labels have been fixed in concerned diagrams. If detected as &#171;corrupted label&#187;, the label is reset to its default location (as if you launch the &#171;Snap Back&#187; action on it). The rules applied to detect a corrupted label are the following:
+				<em>Error Log</em> view to inform how many labels have been fixed in concerned diagrams. If detected as &#171;corrupted label&#187;, the label is reset to its default location (as if you launch the &#171;Snap Back&#187; action of it). If at least one label is detected as &#171;corrupted label&#187;, the layout is also potentially corrupted (nodes, children of the diagram, with x or y coordinate very big). In this case, the concerned nodes are moved near 5000 (or -5000) as new coordinate. A message is added in this case: 
+				<em>Some nodes have also been moved as the layout of this diagram is corrupted. A Reset Origin and/or manual layout is probably needed for this diagram.</em> The rules applied to detect a corrupted label are the following:
 				<ul>
 					<li>If the label is less than 250 pixels away from the reference point on its corresponding edge, the label is not considered as distant.</li>
 					<li>If the label is more than 1000 pixels away from the reference point on its corresponding edge, the label is considered as distant.</li>
@@ -150,7 +151,7 @@
 		<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=518440">bugzilla #518440</a> for more details). The corresponding version, stored in attribute version of viewpoint:DAnalysis of the aird file, is 
-				<em>10.1.9.201706191500</em>.
+				<em>10.1.9.201706271200</em>.
 			</li>
 		</ul>
 		<h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support">Changes in 
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
index adda9da..1678f37 100644
--- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
+++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile
@@ -8,7 +8,7 @@
 
 h3. User-Visible Changes
 
-* <span class="label label-success">Added</span> An "automatic migration":./user/general/Modeling%20Project.html#Migration has been added in this version to fix diagram with edge labels corrupted (see "bugzilla #518440":https://bugs.eclipse.org/bugs/show_bug.cgi?id=518440 for more details). Contrary to all previous migrations, this one logs an information in the _Error Log_ view to inform how many labels have been fixed in concerned diagrams. If detected as "corrupted label", the label is reset to its default location (as if you launch the "Snap Back" action on it). The rules applied to detect a corrupted label are the following:
+* <span class="label label-success">Added</span> An "automatic migration":./user/general/Modeling%20Project.html#Migration has been added in this version to fix diagram with edge labels corrupted (see "bugzilla #518440":https://bugs.eclipse.org/bugs/show_bug.cgi?id=518440 for more details). Contrary to all previous migrations, this one logs an information in the _Error Log_ view to inform how many labels have been fixed in concerned diagrams. If detected as "corrupted label", the label is reset to its default location (as if you launch the "Snap Back" action of it). If at least one label is detected as "corrupted label", the layout is also potentially corrupted (nodes, children of the diagram, with x or y coordinate very big). In this case, the concerned nodes are moved near 5000 (or -5000) as new coordinate. A message is added in this case: _Some nodes have also been moved as the layout of this diagram is corrupted. A Reset Origin and/or manual layout is probably needed for this diagram._ The rules applied to detect a corrupted label are the following:
 ** If the label is less than 250 pixels away from the reference point on its corresponding edge, the label is not considered as distant.
 ** If the label is more than 1000 pixels away from the reference point on its corresponding edge, the label is considered as distant.
 ** Between these 2 limits, the label is considered as distant if the distance between the center of the label and the edge is higher than "four times the size of the nearest segment".
@@ -17,7 +17,7 @@
 
 h4. Migrations
 
-* <span class="label label-success">Added</span> A migration has been added to fix diagram with edge labels corrupted (see "bugzilla #518440":https://bugs.eclipse.org/bugs/show_bug.cgi?id=518440 for more details). The corresponding version, stored in attribute version of viewpoint:DAnalysis of the aird file, is _10.1.9.201706191500_.
+* <span class="label label-success">Added</span> A migration has been added to fix diagram with edge labels corrupted (see "bugzilla #518440":https://bugs.eclipse.org/bugs/show_bug.cgi?id=518440 for more details). The corresponding version, stored in attribute version of viewpoint:DAnalysis of the aird file, is _10.1.9.201706271200_.
 
 h4. Changes in @org.eclipse.sirius.tests.swtbot.support@
 
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.aird b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.aird
index 818786b..001a470 100644
--- a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.aird
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.aird
@@ -5788,6 +5788,212 @@
       <activatedLayers xmi:type="description_1:AdditionalLayer" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@additionalLayers[name='Package']"/>
       <target xmi:type="ecore:EPackage" href="edgeLabelsMoveTest.ecore#//P3"/>
     </ownedRepresentations>
+    <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_VTHNkVsJEeeiSNpWuNBK3A" name="DiagramWithHugeCoordinates">
+      <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_VTHNklsJEeeiSNpWuNBK3A" source="DANNOTATION_CUSTOMIZATION_KEY">
+        <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_VTHNk1sJEeeiSNpWuNBK3A"/>
+      </ownedAnnotationEntries>
+      <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_VTVQAFsJEeeiSNpWuNBK3A" source="GMF_DIAGRAMS">
+        <data xmi:type="notation:Diagram" xmi:id="_VTVQAVsJEeeiSNpWuNBK3A" type="Sirius" element="_VTHNkVsJEeeiSNpWuNBK3A" measurementUnit="Pixel">
+          <children xmi:type="notation:Node" xmi:id="_VToyAFsJEeeiSNpWuNBK3A" type="2003" element="_VTHNlFsJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_VTzKEFsJEeeiSNpWuNBK3A" type="5007"/>
+            <children xmi:type="notation:Node" xmi:id="_VT20cFsJEeeiSNpWuNBK3A" type="7004">
+              <styles xmi:type="notation:SortingStyle" xmi:id="_VT20cVsJEeeiSNpWuNBK3A"/>
+              <styles xmi:type="notation:FilteringStyle" xmi:id="_VT20clsJEeeiSNpWuNBK3A"/>
+            </children>
+            <styles xmi:type="notation:ShapeStyle" xmi:id="_VToyAVsJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VToyAlsJEeeiSNpWuNBK3A" x="320" y="97"/>
+          </children>
+          <children xmi:type="notation:Node" xmi:id="_VT20c1sJEeeiSNpWuNBK3A" type="2003" element="_VTHNllsJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_VT3bgFsJEeeiSNpWuNBK3A" type="5007"/>
+            <children xmi:type="notation:Node" xmi:id="_VT3bgVsJEeeiSNpWuNBK3A" type="7004">
+              <styles xmi:type="notation:SortingStyle" xmi:id="_VT3bglsJEeeiSNpWuNBK3A"/>
+              <styles xmi:type="notation:FilteringStyle" xmi:id="_VT3bg1sJEeeiSNpWuNBK3A"/>
+            </children>
+            <styles xmi:type="notation:ShapeStyle" xmi:id="_VT20dFsJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VT20dVsJEeeiSNpWuNBK3A" x="117" y="97"/>
+          </children>
+          <children xmi:type="notation:Node" xmi:id="_VT3bhFsJEeeiSNpWuNBK3A" type="2003" element="_VTHNmFsJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_VT4CkFsJEeeiSNpWuNBK3A" type="5007"/>
+            <children xmi:type="notation:Node" xmi:id="_VT4CkVsJEeeiSNpWuNBK3A" type="7004">
+              <styles xmi:type="notation:SortingStyle" xmi:id="_VT4CklsJEeeiSNpWuNBK3A"/>
+              <styles xmi:type="notation:FilteringStyle" xmi:id="_VT4Ck1sJEeeiSNpWuNBK3A"/>
+            </children>
+            <styles xmi:type="notation:ShapeStyle" xmi:id="_VT3bhVsJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VT3bhlsJEeeiSNpWuNBK3A" x="-5000" y="-5000"/>
+          </children>
+          <styles xmi:type="notation:DiagramStyle" xmi:id="_VTVQAlsJEeeiSNpWuNBK3A"/>
+          <edges xmi:type="notation:Edge" xmi:id="_VT_-YFsJEeeiSNpWuNBK3A" type="4001" element="_VTHNmlsJEeeiSNpWuNBK3A" source="_VToyAFsJEeeiSNpWuNBK3A" target="_VT20c1sJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_VUDowFsJEeeiSNpWuNBK3A" type="6001">
+              <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VUDowVsJEeeiSNpWuNBK3A" y="-10"/>
+            </children>
+            <children xmi:type="notation:Node" xmi:id="_VUGsEFsJEeeiSNpWuNBK3A" type="6002">
+              <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VUGsEVsJEeeiSNpWuNBK3A" y="-10"/>
+            </children>
+            <children xmi:type="notation:Node" xmi:id="_VUKWcFsJEeeiSNpWuNBK3A" type="6003">
+              <layoutConstraint xmi:type="notation:Bounds" xmi:id="_VUKWcVsJEeeiSNpWuNBK3A" y="-10"/>
+            </children>
+            <styles xmi:type="notation:ConnectorStyle" xmi:id="_VT_-YVsJEeeiSNpWuNBK3A" routing="Rectilinear"/>
+            <styles xmi:type="notation:FontStyle" xmi:id="_VT_-YlsJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_VT_-Y1sJEeeiSNpWuNBK3A" points="[-59, 0, 144, 0]$[-144, 0, 59, 0]"/>
+            <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VUV8oFsJEeeiSNpWuNBK3A" id="(0.5,0.5)"/>
+            <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_VUV8oVsJEeeiSNpWuNBK3A" id="(0.5,0.5)"/>
+          </edges>
+        </data>
+      </ownedAnnotationEntries>
+      <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_VTHNlFsJEeeiSNpWuNBK3A" name="C1A" tooltipText="C1A" outgoingEdges="_VTHNmlsJEeeiSNpWuNBK3A" width="12" height="10">
+        <target xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1A"/>
+        <semanticElements xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1A"/>
+        <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+        <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+        <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+        <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_VTHNlVsJEeeiSNpWuNBK3A" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
+          <description xmi:type="style:FlatContainerStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/>
+      </ownedDiagramElements>
+      <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_VTHNllsJEeeiSNpWuNBK3A" name="C1B" tooltipText="C1B" incomingEdges="_VTHNmlsJEeeiSNpWuNBK3A" width="12" height="10">
+        <target xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1B"/>
+        <semanticElements xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1B"/>
+        <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+        <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+        <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+        <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_VTHNl1sJEeeiSNpWuNBK3A" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
+          <description xmi:type="style:FlatContainerStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/>
+      </ownedDiagramElements>
+      <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_VTHNmFsJEeeiSNpWuNBK3A" name="C1C" tooltipText="C1C" width="12" height="10">
+        <target xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1C"/>
+        <semanticElements xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1C"/>
+        <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+        <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+        <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+        <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_VTHNmVsJEeeiSNpWuNBK3A" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
+          <description xmi:type="style:FlatContainerStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/>
+      </ownedDiagramElements>
+      <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_VTHNmlsJEeeiSNpWuNBK3A" name="refToC1BCenter" sourceNode="_VTHNlFsJEeeiSNpWuNBK3A" targetNode="_VTHNllsJEeeiSNpWuNBK3A" beginLabel="refToC1BBegin" endLabel="refToC1BEnd">
+        <target xmi:type="ecore:EReference" href="edgeLabelsMoveTest.ecore#//P1/C1A/refToC1B"/>
+        <semanticElements xmi:type="ecore:EReference" href="edgeLabelsMoveTest.ecore#//P1/C1A/refToC1B"/>
+        <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_VTHNm1sJEeeiSNpWuNBK3A" sourceArrow="Diamond" routingStyle="manhattan" centered="Both" strokeColor="0,0,0">
+          <customFeatures>centered</customFeatures>
+          <description xmi:type="style:EdgeStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/>
+          <beginLabelStyle xmi:type="diagram:BeginLabelStyle" xmi:id="_VTHNnFsJEeeiSNpWuNBK3A"/>
+          <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_VTHNnVsJEeeiSNpWuNBK3A" showIcon="false"/>
+          <endLabelStyle xmi:type="diagram:EndLabelStyle" xmi:id="_VTHNnlsJEeeiSNpWuNBK3A" showIcon="false"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:EdgeMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']"/>
+      </ownedDiagramElements>
+      <description xmi:type="description_1:DiagramDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']"/>
+      <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_VTHNn1sJEeeiSNpWuNBK3A"/>
+      <activatedLayers xmi:type="description_1:Layer" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer"/>
+      <activatedLayers xmi:type="description_1:AdditionalLayer" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@additionalLayers[name='Package']"/>
+      <target xmi:type="ecore:EPackage" href="edgeLabelsMoveTest.ecore#//P1"/>
+    </ownedRepresentations>
+    <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_jyaIsFsJEeeiSNpWuNBK3A" name="DiagramWithHugeCoordinates_corrupted">
+      <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_jyaIsVsJEeeiSNpWuNBK3A" source="DANNOTATION_CUSTOMIZATION_KEY">
+        <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_jyaIslsJEeeiSNpWuNBK3A"/>
+      </ownedAnnotationEntries>
+      <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_jyaIs1sJEeeiSNpWuNBK3A" source="GMF_DIAGRAMS">
+        <data xmi:type="notation:Diagram" xmi:id="_jyaItFsJEeeiSNpWuNBK3A" type="Sirius" element="_jyaIsFsJEeeiSNpWuNBK3A" measurementUnit="Pixel">
+          <children xmi:type="notation:Node" xmi:id="_jyaItVsJEeeiSNpWuNBK3A" type="2003" element="_jyaI11sJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_jyaItlsJEeeiSNpWuNBK3A" type="5007"/>
+            <children xmi:type="notation:Node" xmi:id="_jyaIt1sJEeeiSNpWuNBK3A" type="7004">
+              <styles xmi:type="notation:SortingStyle" xmi:id="_jyaIuFsJEeeiSNpWuNBK3A"/>
+              <styles xmi:type="notation:FilteringStyle" xmi:id="_jyaIuVsJEeeiSNpWuNBK3A"/>
+            </children>
+            <styles xmi:type="notation:ShapeStyle" xmi:id="_jyaIulsJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jyaIu1sJEeeiSNpWuNBK3A" x="320" y="97"/>
+          </children>
+          <children xmi:type="notation:Node" xmi:id="_jyaIvFsJEeeiSNpWuNBK3A" type="2003" element="_jyaI2VsJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_jyaIvVsJEeeiSNpWuNBK3A" type="5007"/>
+            <children xmi:type="notation:Node" xmi:id="_jyaIvlsJEeeiSNpWuNBK3A" type="7004">
+              <styles xmi:type="notation:SortingStyle" xmi:id="_jyaIv1sJEeeiSNpWuNBK3A"/>
+              <styles xmi:type="notation:FilteringStyle" xmi:id="_jyaIwFsJEeeiSNpWuNBK3A"/>
+            </children>
+            <styles xmi:type="notation:ShapeStyle" xmi:id="_jyaIwVsJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jyaIwlsJEeeiSNpWuNBK3A" x="117" y="97"/>
+          </children>
+          <children xmi:type="notation:Node" xmi:id="_jyaIw1sJEeeiSNpWuNBK3A" type="2003" element="_jyaI21sJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_jyaIxFsJEeeiSNpWuNBK3A" type="5007"/>
+            <children xmi:type="notation:Node" xmi:id="_jyaIxVsJEeeiSNpWuNBK3A" type="7004">
+              <styles xmi:type="notation:SortingStyle" xmi:id="_jyaIxlsJEeeiSNpWuNBK3A"/>
+              <styles xmi:type="notation:FilteringStyle" xmi:id="_jyaIx1sJEeeiSNpWuNBK3A"/>
+            </children>
+            <styles xmi:type="notation:ShapeStyle" xmi:id="_jyaIyFsJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jyaIyVsJEeeiSNpWuNBK3A" x="1250000" y="1250000"/>
+          </children>
+          <styles xmi:type="notation:DiagramStyle" xmi:id="_jyaIylsJEeeiSNpWuNBK3A"/>
+          <edges xmi:type="notation:Edge" xmi:id="_jyaIy1sJEeeiSNpWuNBK3A" type="4001" element="_jyaI3VsJEeeiSNpWuNBK3A" source="_jyaItVsJEeeiSNpWuNBK3A" target="_jyaIvFsJEeeiSNpWuNBK3A">
+            <children xmi:type="notation:Node" xmi:id="_jyaIzFsJEeeiSNpWuNBK3A" type="6001">
+              <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jyaIzVsJEeeiSNpWuNBK3A" x="-962" y="55"/>
+            </children>
+            <children xmi:type="notation:Node" xmi:id="_jyaIzlsJEeeiSNpWuNBK3A" type="6002">
+              <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jyaIz1sJEeeiSNpWuNBK3A" y="-10"/>
+            </children>
+            <children xmi:type="notation:Node" xmi:id="_jyaI0FsJEeeiSNpWuNBK3A" type="6003">
+              <layoutConstraint xmi:type="notation:Bounds" xmi:id="_jyaI0VsJEeeiSNpWuNBK3A" y="-10"/>
+            </children>
+            <styles xmi:type="notation:ConnectorStyle" xmi:id="_jyaI0lsJEeeiSNpWuNBK3A" routing="Rectilinear"/>
+            <styles xmi:type="notation:FontStyle" xmi:id="_jyaI01sJEeeiSNpWuNBK3A" fontName="Segoe UI" fontHeight="8"/>
+            <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_jyaI1FsJEeeiSNpWuNBK3A" points="[-59, 0, 144, 0]$[-144, 0, 59, 0]"/>
+            <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_jyaI1VsJEeeiSNpWuNBK3A" id="(0.5,0.5)"/>
+            <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_jyaI1lsJEeeiSNpWuNBK3A" id="(0.5,0.5)"/>
+          </edges>
+        </data>
+      </ownedAnnotationEntries>
+      <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_jyaI11sJEeeiSNpWuNBK3A" name="C1A" tooltipText="C1A" outgoingEdges="_jyaI3VsJEeeiSNpWuNBK3A" width="12" height="10">
+        <target xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1A"/>
+        <semanticElements xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1A"/>
+        <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+        <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+        <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+        <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_jyaI2FsJEeeiSNpWuNBK3A" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
+          <description xmi:type="style:FlatContainerStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/>
+      </ownedDiagramElements>
+      <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_jyaI2VsJEeeiSNpWuNBK3A" name="C1B" tooltipText="C1B" incomingEdges="_jyaI3VsJEeeiSNpWuNBK3A" width="12" height="10">
+        <target xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1B"/>
+        <semanticElements xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1B"/>
+        <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+        <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+        <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+        <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_jyaI2lsJEeeiSNpWuNBK3A" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
+          <description xmi:type="style:FlatContainerStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/>
+      </ownedDiagramElements>
+      <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_jyaI21sJEeeiSNpWuNBK3A" name="C1C" tooltipText="C1C" width="12" height="10">
+        <target xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1C"/>
+        <semanticElements xmi:type="ecore:EClass" href="edgeLabelsMoveTest.ecore#//P1/C1C"/>
+        <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+        <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+        <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+        <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_jyaI3FsJEeeiSNpWuNBK3A" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216">
+          <description xmi:type="style:FlatContainerStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/>
+      </ownedDiagramElements>
+      <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_jyaI3VsJEeeiSNpWuNBK3A" name="refToC1BCenter" sourceNode="_jyaI11sJEeeiSNpWuNBK3A" targetNode="_jyaI2VsJEeeiSNpWuNBK3A" beginLabel="refToC1BBegin" endLabel="refToC1BEnd">
+        <target xmi:type="ecore:EReference" href="edgeLabelsMoveTest.ecore#//P1/C1A/refToC1B"/>
+        <semanticElements xmi:type="ecore:EReference" href="edgeLabelsMoveTest.ecore#//P1/C1A/refToC1B"/>
+        <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_jyaI3lsJEeeiSNpWuNBK3A" sourceArrow="Diamond" routingStyle="manhattan" centered="Both" strokeColor="0,0,0">
+          <customFeatures>centered</customFeatures>
+          <description xmi:type="style:EdgeStyleDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/>
+          <beginLabelStyle xmi:type="diagram:BeginLabelStyle" xmi:id="_jyaI31sJEeeiSNpWuNBK3A"/>
+          <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_jyaI4FsJEeeiSNpWuNBK3A" showIcon="false"/>
+          <endLabelStyle xmi:type="diagram:EndLabelStyle" xmi:id="_jyaI4VsJEeeiSNpWuNBK3A" showIcon="false"/>
+        </ownedStyle>
+        <actualMapping xmi:type="description_1:EdgeMapping" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']"/>
+      </ownedDiagramElements>
+      <description xmi:type="description_1:DiagramDescription" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']"/>
+      <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_jyaI4lsJEeeiSNpWuNBK3A"/>
+      <activatedLayers xmi:type="description_1:Layer" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@defaultLayer"/>
+      <activatedLayers xmi:type="description_1:AdditionalLayer" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']/@ownedRepresentations[name='Diagram']/@additionalLayers[name='Package']"/>
+      <target xmi:type="ecore:EPackage" href="edgeLabelsMoveTest.ecore#//P1"/>
+    </ownedRepresentations>
     <viewpoint xmi:type="description:Viewpoint" href="VSMForEdgeLabelsMoveTest.odesign#//@ownedViewpoints[name='VSMForEdgeLabelsMoveTest']"/>
   </ownedViews>
 </viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.ecore b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.ecore
index edc89b9..ec4b44e 100644
--- a/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.ecore
+++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/migration/do_not_migrate/edgeLabelMove/edgeLabelsMoveTest.ecore
@@ -18,6 +18,7 @@
       <eStructuralFeatures xsi:type="ecore:EReference" name="refToC1B" eType="#//P1/C1B"/>
     </eClassifiers>
     <eClassifiers xsi:type="ecore:EClass" name="C1B"/>
+    <eClassifiers xsi:type="ecore:EClass" name="C1C"/>
   </eSubpackages>
   <eSubpackages name="P2">
     <eClassifiers xsi:type="ecore:EClass" name="G" abstract="true"/>
diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/SnapBackDistantLabelsMigrationTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/SnapBackDistantLabelsMigrationTest.java
index 74d59f4..0e592dd 100644
--- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/SnapBackDistantLabelsMigrationTest.java
+++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/migration/SnapBackDistantLabelsMigrationTest.java
@@ -38,6 +38,8 @@
  */
 public class SnapBackDistantLabelsMigrationTest extends SiriusTestCase {
 
+    private static final String UNEXPECTED_DATA_MESSAGE = "An expected diagram has not been found in data.";
+
     private static final String PATH = "data/unit/migration/do_not_migrate/edgeLabelMove/";
 
     private static final String SESSION_RESOURCE_NAME = "edgeLabelsMoveTest.aird";
@@ -89,6 +91,8 @@
         Diagram corruptedDiagram2 = null;
         Diagram diagram3 = null;
         Diagram corruptedDiagram3 = null;
+        Diagram diagram4 = null;
+        Diagram corruptedDiagram4 = null;
 
         while (diagrams.hasNext()) {
             Diagram diagram = diagrams.next();
@@ -105,28 +109,42 @@
                 } else {
                     diagram2 = diagram;
                 }
-            } else {
+            } else if (diagramName.startsWith("MyDiagram")) {
                 if (diagramName.endsWith(suffix)) {
                     corruptedDiagram3 = diagram;
                 } else {
                     diagram3 = diagram;
                 }
+            } else {
+                if (diagramName.endsWith(suffix)) {
+                    corruptedDiagram4 = diagram;
+                } else {
+                    diagram4 = diagram;
+                }
             }
         }
 
-        assertNotNull("An expected diagram has not been found in data", diagram1);
-        assertNotNull("An expected diagram has not been found in data", corruptedDiagram1);
-        assertNotNull("An expected diagram has not been found in data", diagram2);
-        assertNotNull("An expected diagram has not been found in data", corruptedDiagram2);
-        assertNotNull("An expected diagram has not been found in data", diagram3);
-        assertNotNull("An expected diagram has not been found in data", corruptedDiagram3);
+        compareDiagram(corruptedDiagram1, diagram1);
+        compareDiagram(corruptedDiagram2, diagram2);
+        compareDiagram(corruptedDiagram3, diagram3);
+        // This diag is a specific case with a node with huge coordinates.
+        compareDiagram(corruptedDiagram4, diagram4);
+    }
 
-        assertEquals("Corrupted diagram " + ((DDiagram) corruptedDiagram1.getElement()).getName() + " should have the same bounding box as other diagram after migration.",
-                calculateLocationBoundingBox(diagram1), calculateLocationBoundingBox(corruptedDiagram1));
-        assertEquals("Corrupted diagram " + ((DDiagram) corruptedDiagram2.getElement()).getName() + " should have the same bounding box as other diagram after migration.",
-                calculateLocationBoundingBox(diagram2), calculateLocationBoundingBox(corruptedDiagram2));
-        assertEquals("Corrupted diagram " + ((DDiagram) corruptedDiagram3.getElement()).getName() + " should have the same bounding box as other diagram after migration.",
-                calculateLocationBoundingBox(diagram3), calculateLocationBoundingBox(corruptedDiagram3));
+    /**
+     * Compare a diagram that must be fixed during the migration, with another
+     * one.
+     * 
+     * @param corruptedDiagram
+     *            Diagram that must be OK after migration
+     * @param diagram
+     *            Diagram to compare with
+     */
+    private void compareDiagram(Diagram corruptedDiagram, Diagram diagram) {
+        assertNotNull(UNEXPECTED_DATA_MESSAGE, diagram);
+        assertNotNull(UNEXPECTED_DATA_MESSAGE, corruptedDiagram);
+        assertEquals("Corrupted diagram " + ((DDiagram) corruptedDiagram.getElement()).getName() + " should have the same bounding box as other diagram after migration.",
+                calculateLocationBoundingBox(diagram), calculateLocationBoundingBox(corruptedDiagram));
     }
 
     /**