diff options
| author | pguilet | 2016-03-17 09:11:17 +0000 |
|---|---|---|
| committer | Laurent Redor | 2016-08-05 08:57:05 +0000 |
| commit | 537883625c0e15b92b4e540f2df708ee72bb71ca (patch) | |
| tree | 97658a85a0888c3d9b00b273e751b491e7d7082d | |
| parent | 17f90cf7d90d3ba2861a7428e1e9640d7f842ec4 (diff) | |
| download | org.eclipse.sirius-537883625c0e15b92b4e540f2df708ee72bb71ca.tar.gz org.eclipse.sirius-537883625c0e15b92b4e540f2df708ee72bb71ca.tar.xz org.eclipse.sirius-537883625c0e15b92b4e540f2df708ee72bb71ca.zip | |
[498494] Zoom, with mouse scroll, zooms the point behind mouse
-Add a custom sirius zoom manager that zooms on given point instead of
the center point
-Add a mouse wheel zoom handler that applies a CTRL+mouse wheel zoom
to the mouse location point by calling the sirius zoom manager.
-Add a method mouseScrollWithKey in SWTBotSiriusDiagramEditor to be
able to test mouse scroll combined to keyboard key pressed.
Bug: 498494
Change-Id: I59909e471f8b033d401a82a77e1490a30918a17a
Signed-off-by: pguilet <pierre.guilet@obeo.fr>
18 files changed, 1587 insertions, 13 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java index d87facc15b..d27b4fbb80 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java @@ -52,7 +52,6 @@ import org.eclipse.gef.KeyHandler; import org.eclipse.gef.KeyStroke; import org.eclipse.gef.LayerConstants; import org.eclipse.gef.MouseWheelHandler; -import org.eclipse.gef.MouseWheelZoomHandler; import org.eclipse.gef.Request; import org.eclipse.gef.RootEditPart; import org.eclipse.gef.commands.CommandStack; @@ -154,6 +153,7 @@ import org.eclipse.sirius.diagram.ui.tools.internal.editor.header.DiagramHeaderC import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.Tabbar; import org.eclipse.sirius.diagram.ui.tools.internal.editor.tabbar.TabbarRefresher; import org.eclipse.sirius.diagram.ui.tools.internal.graphical.edit.part.DDiagramRootEditPart; +import org.eclipse.sirius.diagram.ui.tools.internal.handler.SiriusMouseWheelZoomHandler; import org.eclipse.sirius.diagram.ui.tools.internal.menu.DiagramEditorContextMenuProvider; import org.eclipse.sirius.diagram.ui.tools.internal.menu.DiagramMenuUpdater; import org.eclipse.sirius.diagram.ui.tools.internal.outline.QuickOutlineControl; @@ -816,8 +816,6 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer()); getOperationHistory().addOperationHistoryListener(operationHistoryListener); - // add the wheel mouse to zoom - this.getGraphicalViewer().setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), MouseWheelZoomHandler.SINGLETON); } else { workspaceViewerPreferenceStore = new PreferenceStore(); if (getDiagramGraphicalViewer() instanceof DiagramGraphicalViewer) { @@ -1400,6 +1398,21 @@ public class DDiagramEditorImpl extends SiriusDiagramEditor implements DDiagramE super.setGraphicalViewer(viewer); } + /* + * We override this method because the super type DiagramEditor initialize + * the default zoom handler in this method. So we replace it by our own + * handler just after. (non-Javadoc) + * @see org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor# + * initializeGraphicalViewerContents() + */ + @Override + protected void initializeGraphicalViewerContents() { + super.initializeGraphicalViewerContents(); + // add the wheel mouse to zoom + this.getGraphicalViewer().setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.CTRL), SiriusMouseWheelZoomHandler.SINGLETON); + + } + @Override protected void initializeGraphicalViewer() { if (getDiagram() != null) { diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/graphical/edit/part/DDiagramRootEditPart.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/graphical/edit/part/DDiagramRootEditPart.java index bbefdf6edb..8dbc2bb193 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/graphical/edit/part/DDiagramRootEditPart.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/graphical/edit/part/DDiagramRootEditPart.java @@ -14,14 +14,20 @@ import org.eclipse.draw2d.FreeformLayer; import org.eclipse.draw2d.FreeformLayeredPane; import org.eclipse.draw2d.Layer; import org.eclipse.draw2d.LayeredPane; +import org.eclipse.draw2d.ScalableFigure; import org.eclipse.draw2d.ScalableFreeformLayeredPane; +import org.eclipse.draw2d.Viewport; import org.eclipse.gef.AutoexposeHelper; import org.eclipse.gef.LayerConstants; +import org.eclipse.gef.editparts.ZoomManager; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemsAwareFreeFormLayer; +import org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants; import org.eclipse.gmf.runtime.diagram.ui.render.editparts.RenderedDiagramRootEditPart; import org.eclipse.gmf.runtime.notation.MeasurementUnit; +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.sirius.diagram.ui.tools.internal.figure.DConnectionLayerEx; +import org.eclipse.sirius.diagram.ui.tools.internal.handler.SiriusAnimatableZoomManager; /** * Installs the tree designer forest router and a scalable feedback layer. @@ -30,6 +36,14 @@ import org.eclipse.sirius.diagram.ui.tools.internal.figure.DConnectionLayerEx; */ public class DDiagramRootEditPart extends RenderedDiagramRootEditPart { + private SiriusAnimatableZoomManager siriusZoomManager; + + /** + * Copy of org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart. + * zoomLevels + */ + private double[] siriusZoomLevels = { .05, .1, .25, .5, .75, 1, 1.25, 1.5, 1.75, 2, 4 }; + /** * Constructor. * @@ -78,4 +92,23 @@ public class DDiagramRootEditPart extends RenderedDiagramRootEditPart { return super.getAdapter(key); } + @Override + public ZoomManager getZoomManager() { + if (siriusZoomManager == null) { + siriusZoomManager = new SiriusAnimatableZoomManager((ScalableFigure) getScaledLayers(), (Viewport) getFigure()); + siriusZoomManager.setZoomLevels(siriusZoomLevels); + refreshEnableZoomAnimation(siriusZoomManager); + } + + return siriusZoomManager; + } + + /** + * Duplicated method from super DiagramRootEditPart. + */ + private void refreshEnableZoomAnimation(ZoomManager zoomMangr) { + IPreferenceStore preferenceStore = (IPreferenceStore) getPreferencesHint().getPreferenceStore(); + boolean animatedZoom = preferenceStore.getBoolean(IPreferenceConstants.PREF_ENABLE_ANIMATED_ZOOM); + zoomMangr.setZoomAnimationStyle(animatedZoom ? ZoomManager.ANIMATE_ZOOM_IN_OUT : ZoomManager.ANIMATE_NEVER); + } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/handler/SiriusAnimatableZoomManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/handler/SiriusAnimatableZoomManager.java new file mode 100644 index 0000000000..30aea8ab5f --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/handler/SiriusAnimatableZoomManager.java @@ -0,0 +1,241 @@ +/****************************************************************************** + * Copyright (c) 2004, 2016 IBM Corporation 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ****************************************************************************/ +package org.eclipse.sirius.diagram.ui.tools.internal.handler; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.draw2d.ScalableFigure; +import org.eclipse.draw2d.Viewport; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gef.editparts.ZoomListener; +import org.eclipse.gef.editparts.ZoomManager; +import org.eclipse.gmf.runtime.draw2d.ui.geometry.LineSeg; +import org.eclipse.gmf.runtime.draw2d.ui.internal.figures.AnimationModel; +import org.eclipse.gmf.runtime.gef.ui.internal.editparts.AnimatedZoomListener; + +/** + * Sirius zoom manager zooming on given point and not on view center. The code + * is the same than + * {@link org.eclipse.gmf.runtime.gef.ui.internal.editparts.AnimatableZoomManager} + * except the method primAnimateSetZoom() that has been updated to zoom on point + * and not center of view. + * + * We don't extend AnimatableZoomManager because the updated method contains a + * call to super that would make super super code duplication. Moreover due to + * private method using the updated method a lot of override must be done if we + * were extending this class. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +@SuppressWarnings("restriction") +public class SiriusAnimatableZoomManager extends ZoomManager { + private static final int DURATION_INCREMENT = 400; + + private int zoomAnimationStyle = ANIMATE_NEVER; + + private List<Object> animationListeners = new ArrayList<Object>(); + + /** + * Constructor. + * + * @param pane + * the scalable graphic element. + * @param viewport + * the current viewport. + */ + public SiriusAnimatableZoomManager(ScalableFigure pane, Viewport viewport) { + super(pane, viewport); + } + + /** + * Returns the zoom animation style. + * + * @return Returns the zoomAnimationStyle. + */ + public int getZoomAnimationStyle() { + return zoomAnimationStyle; + } + + /** + * Sets which zoom methods get animated. + * + * @param style + * the style bits determining the zoom methods to be animated. + */ + @Override + public void setZoomAnimationStyle(int style) { + zoomAnimationStyle = style; + } + + /** + * Adds the given ZoomListener to this ZoomManager's list of listeners. + * + * @param listener + * the ZoomListener to be added + */ + @Override + public void addZoomListener(ZoomListener listener) { + super.addZoomListener(listener); + if (listener instanceof AnimatedZoomListener) { + animationListeners.add(listener); + } + } + + /** + * Notifies listeners that the animated zoom has started. + */ + protected void fireAnimatedZoomStarted() { + Iterator<Object> iter = animationListeners.iterator(); + while (iter.hasNext()) + ((AnimatedZoomListener) iter.next()).animatedZoomStarted(); + } + + /** + * Notifies listeners that the animated zoom has ended. + */ + protected void fireAnimatedZoomEnded() { + Iterator<Object> iter = animationListeners.iterator(); + while (iter.hasNext()) + ((AnimatedZoomListener) iter.next()).animatedZoomEnded(); + } + + /** + * Allows implementators to zoom to a certain level centered around a given + * point. + * + * @param zoom + * <code>double</code> value where 1.0 represents 100%. + * @param zoomedPoint + * <code>Point</code> around which the zoom will be centered in + * absolute coordinates + */ + public void zoomTo(double zoom, Point zoomedPoint) { + Point zoomedPointCopy = zoomedPoint.getCopy(); + getScalableFigure().translateToRelative(zoomedPointCopy); + primSetZoom(zoom, zoomedPointCopy); + } + + /** + * Allows implementors to zoom into or out to a rectangular area. + * + * @param rect + * <code>Rectangle</code> that the edit part will zoom into our + * out to in absolute coordinates. + */ + @Override + public void zoomTo(Rectangle rect) { + Dimension available = getViewport().getClientArea().getSize(); + Dimension desired = rect.getSize(); + + double scaleX = available.width * getZoom() / desired.width; + double scaleY = available.height * getZoom() / desired.height; + + double zoom = Math.min(getMaxZoom(), Math.max(getMinZoom(), Math.min(scaleX, scaleY))); + zoomTo(zoom, rect.getCenter()); + } + + /** + * Sets the zoom level to the given value. Min-max range check is not done. + * + * @param zoom + * the new zoom level + */ + @Override + protected void primSetZoom(double zoom) { + Point center = getViewport().getClientArea().getCenter(); + primSetZoom(zoom, center); + } + + /** + * Calculate the animation duration based on the number of zoom increments + * being traversed. + * + * @param zoom + * @return <code>AnimationModel</code> that is appropriate for the zoom + * difference between requested and the current zoom level. + */ + private AnimationModel calculateAnimationModel(double zoom) { + double dmod = Math.pow(zoom / getZoom(), (double) 1 / 8); + int steps = (int) Math.round(dmod > 1 ? dmod : 1 / dmod); + + int duration = Math.max(DURATION_INCREMENT, steps * DURATION_INCREMENT); + AnimationModel animationModel = new AnimationModel(duration, true); + animationModel.animationStarted(); + return animationModel; + } + + /** + * Sets the zoom level to the given value. Min-max range check is not done. + * + * @param zoom + * the new zoom level + */ + private void primSetZoom(double zoom, Point finalCenterAbs) { + primAnimateSetZoom(zoom, finalCenterAbs, getZoomAnimationStyle() == ANIMATE_ZOOM_IN_OUT ? calculateAnimationModel(zoom) : null); + } + + /** + * Performs the zoom with animation on the given point. I.e the given point + * stay at the same position in the viewport after zoom. + * + * @param zoomLevel + * the zoom level. + * @param pointToZoom + * The point to zoom. + * @param animationModel + * the animation model to use when doing the zoom. + */ + private void primAnimateSetZoom(double zoomLevel, Point pointToZoom, AnimationModel animationModel) { + + double initialZoom = getZoom(); + double finalZoom = zoomLevel; + + Point scaledMousePoint = pointToZoom.getCopy(); + Point originalViewLocation = getViewport().getViewLocation(); + Dimension zoomDifference = originalViewLocation.getDifference(pointToZoom); + Point finalViewLocation = scaledMousePoint.scale(finalZoom / initialZoom).getTranslated(zoomDifference); + LineSeg scrollVector = new LineSeg(originalViewLocation, finalViewLocation); + + float progress = 1.0f; + if (animationModel != null) { + animationModel.animationStarted(); + progress = animationModel.getProgress(); + } + boolean finished = false; + + fireAnimatedZoomStarted(); + + while (!finished) { + + if (animationModel == null || animationModel.isFinished()) + finished = true; + + double currentZoom = initialZoom + ((finalZoom - initialZoom) * progress); + + super.primSetZoom(currentZoom); + + Point currentViewLocation = scrollVector.locatePoint(progress, 0, LineSeg.Sign.POSITIVE); + setViewLocation(currentViewLocation); + + getViewport().getUpdateManager().performUpdate(); + + if (animationModel != null) + progress = animationModel.getProgress(); + } + + fireAnimatedZoomEnded(); + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/handler/SiriusMouseWheelZoomHandler.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/handler/SiriusMouseWheelZoomHandler.java new file mode 100644 index 0000000000..cd1fcdade4 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/handler/SiriusMouseWheelZoomHandler.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2016 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.diagram.ui.tools.internal.handler; + +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.gef.EditPartViewer; +import org.eclipse.gef.MouseWheelHandler; +import org.eclipse.gef.editparts.ZoomManager; +import org.eclipse.swt.widgets.Event; + +/** + * A Sirius mouse wheel handler to zoom around the mouse location. This class is + * a copy of {@link org.eclipse.gef.MouseWheelZoomHandler} to correctly handle + * SiriusAnimatableZoomManager. + * + * @author fbarbin + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +public class SiriusMouseWheelZoomHandler implements MouseWheelHandler { + /** + * The Singleton instance. + */ + public static final SiriusMouseWheelZoomHandler SINGLETON = new SiriusMouseWheelZoomHandler(); + + /** + * Zooms the given viewer. + * + * @see MouseWheelHandler#handleMouseWheel(Event, EditPartViewer) + */ + @Override + public void handleMouseWheel(Event event, EditPartViewer viewer) { + + ZoomManager zoomMgr = (ZoomManager) viewer.getProperty(ZoomManager.class.toString()); + if (zoomMgr != null) { + if (event.count > 0) { + zoomIn(zoomMgr, event); + } else { + zoomOut(zoomMgr, event); + } + event.doit = false; + } + } + + private void zoomOut(ZoomManager zoomMgr, Event event) { + if (zoomMgr instanceof SiriusAnimatableZoomManager) { + ((SiriusAnimatableZoomManager) zoomMgr).zoomTo(zoomMgr.getPreviousZoomLevel(), new Point(event.x, event.y)); + } else { + zoomMgr.zoomOut(); + } + + } + + private void zoomIn(ZoomManager zoomMgr, Event event) { + if (zoomMgr instanceof SiriusAnimatableZoomManager) { + ((SiriusAnimatableZoomManager) zoomMgr).zoomTo(zoomMgr.getNextZoomLevel(), new Point(event.x, event.y)); + } else { + zoomMgr.zoomIn(); + } + + } + +} diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index b6b2bb8d1d..97302e3edb 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -105,6 +105,9 @@ <li><span class="label label-info">Modified</span> The <a href="./user/diagrams/Diagrams.html#move_edge_group">move edge group</a> feature now also work for a selection of edge group. </li> + <li><span class="label label-info">Modified</span> In a diagram editor, the zoom with mouse wheel is now zooming on mouse location instead of center of the editor. See + <a href="./user/diagrams/Diagrams.html#zooming_diagram_id">user documentation</a> . + </li> </ul> <h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3> <ul> @@ -289,6 +292,17 @@ <code>DView.ownedRepresentationDescriptors</code> addition. </li> </ul> + <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support">Changes in + <code>org.eclipse.sirius.tests.swtbot.support</code> + </h4> + <ul> + <li><span class="label label-success">Added</span> The utility method + <code>mouseScrollWithKey(int, int, int, int)</code>, has been added in classes + <code>org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor</code>, + <code>org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusGefViewer</code> and + <code>org.eclipse.sirius.tests.swtbot.support.api.widget.SWTBotSiriusFigureCanvas</code> to allow testing events occurring after a mouse scroll combined to a keyboard key pressed at a given absolute position. + </li> + </ul> <h2 id="sirius4.0.0">Changes in Sirius 4.0.0</h2> <h3 id="UserVisibleChanges2">User-Visible Changes</h3> <ul> @@ -736,7 +750,7 @@ <code>genericSetUp</code> behavior. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support2">Changes in <code>org.eclipse.sirius.tests.swtbot.support</code> </h4> <ul> @@ -1246,7 +1260,7 @@ </ul> </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support2">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support3">Changes in <code>org.eclipse.sirius.tests.swtbot.support</code> </h4> <ul> @@ -2199,7 +2213,7 @@ <code>org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper.setReadOnlyStatus(boolean, IResource...)</code> can be used instead. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support3">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support4">Changes in <code>org.eclipse.sirius.tests.swtbot.support</code> </h4> <ul> @@ -2643,7 +2657,7 @@ </ul> </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support4">Changes in + <h4 id="Changesinorg.eclipse.sirius.tests.swtbot.support5">Changes in <code>org.eclipse.sirius.tests.swtbot.support</code> </h4> <ul> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index bea06afb34..854efe1afb 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -12,6 +12,7 @@ h3. User-Visible Changes * <span class="label label-info">Modified</span> When trying to open a session which holds a representation resource or a VSP which was saved using a more recent version of Sirius than the one you are using, the session will be automatically closed displaying an error message. You can overload this behavior by providing you own implementation of @UICallBack@ in which you can have an UI feedback letting you choose if you want to open the session anyway. Warning: if you choose to proceed, there is no guarantee that the resulting session will be usable. It may even lead to data loss or corruption; use at your own risk. If a viewpoint has been defined with a more recent version of Sirius than the one you are using, the @ViewpointRegistry@ will not register it and a warning is logged in the error log view to inform the user. * <span class="label label-info">Modified</span> The "move edge group":./user/diagrams/Diagrams.html#move_edge_group feature now also work for a selection of edge group. +* <span class="label label-info">Modified</span> In a diagram editor, the zoom with mouse wheel is now zooming on mouse location instead of center of the editor. See "user documentation":./user/diagrams/Diagrams.html#zooming_diagram_id . h3. Specifier-Visible Changes @@ -69,6 +70,10 @@ h4. Changes in @org.eclipse.sirius.tests.junit.support@ * <span class="label label-success">Added</span> The utility methods @getRepresentationDescriptors(final String)@, @getRepresentationDescriptors(final String , final Session )@ and @getRepresentationDescriptorFromRepresentation(DRepresentation)@ have been added in class @org.eclipse.sirius.tests.support.api.SiriusTestCase@ to adapt tests considering the @DView.ownedRepresentationDescriptors@ addition. +h4. Changes in @org.eclipse.sirius.tests.swtbot.support@ + +* <span class="label label-success">Added</span> The utility method @mouseScrollWithKey(int, int, int, int)@, has been added in classes @org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor@, @org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusGefViewer@ and @org.eclipse.sirius.tests.swtbot.support.api.widget.SWTBotSiriusFigureCanvas@ to allow testing events occurring after a mouse scroll combined to a keyboard key pressed at a given absolute position. + h2(#sirius4.0.0). Changes in Sirius 4.0.0 h3. User-Visible Changes diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html index 6be96f6740..7da94c4a84 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.html @@ -29,6 +29,9 @@ <a href="#Movingthediagram">Moving the diagram</a> </li> <li> + <a href="#zooming_diagram_id">Zooming the diagram</a> + </li> + <li> <a href="#Resizingelements">Resizing elements</a> </li> <li> @@ -228,6 +231,12 @@ <h3 id="Movingthediagram">Moving the diagram</h3> <p>When the diagram is larger than the editor area, you can move it in all directions by pressing the middle-button and dragging the mouse (keeping the button pressed).</p> <p><video height="240" src="videos/moveInAllDirections.mp4" target="_self" autoplay="autoplay" loop="loop"></video></p> + <h3 id="zooming_diagram_id">Zooming the diagram</h3> + <p>The zoom on a diagram can be done by using the tools in the palette like explained in + <a href="#standardToolId">Chapter Standard Tools</a>. + <br/>Or by using the combination of the keyboard key + <em>CTRL</em> and the mouse wheel. Since Sirius 4.1.0, in this case, the zoom is done on the mouse location instead of the center of the editor. + </p> <h3 id="Resizingelements">Resizing elements</h3> <p>If the specifier has authorized it, it is possible to resize a shape by dragging them until they are the size that you want.</p> <p>There are specific shortcuts to change the resize behavior:</p> @@ -931,7 +940,7 @@ <p> <img border="0" src="images/palette_moving.png"/> </p> - <h4 id="StandardTools">Standard Tools</h4> + <h4 id="standardToolId">Standard Tools</h4> <p>A few general tools are available in standard on all Sirius diagrams. They appear in the top row of the palette, just below the header.</p> <p> <img border="0" src="images/palette_tools.png"/> diff --git a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile index 71ba95ef1e..a25d68e22c 100644 --- a/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile +++ b/plugins/org.eclipse.sirius.doc/doc/user/diagrams/Diagrams.textile @@ -75,6 +75,11 @@ When the diagram is larger than the editor area, you can move it in all directio <video height="240" src="videos/moveInAllDirections.mp4" target="_self" autoplay="autoplay" loop="loop"></video> +h3(#zooming_diagram_id). Zooming the diagram + +The zoom on a diagram can be done by using the tools in the palette like explained in "Chapter Standard Tools":#standardToolId. +Or by using the combination of the keyboard key _CTRL_ and the mouse wheel. Since Sirius 4.1.0, in this case, the zoom is done on the mouse location instead of the center of the editor. + h3. Resizing elements If the specifier has authorized it, it is possible to resize a shape by dragging them until they are the size that you want. @@ -636,7 +641,7 @@ __Moving__. If you prefer, you can move the palette to the left side of the diag !images/palette_moving.png! -h4. Standard Tools +h4(#standardToolId). Standard Tools A few general tools are available in standard on all Sirius diagrams. They appear in the top row of the palette, just below the header. diff --git a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/business/UIDiagramRepresentation.java b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/business/UIDiagramRepresentation.java index a1992a4c5c..e386b9c28c 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/business/UIDiagramRepresentation.java +++ b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/business/UIDiagramRepresentation.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2009, 2014 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2016 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 @@ -42,6 +42,10 @@ public class UIDiagramRepresentation extends AbstractUIRepresentation<SWTBotSiri */ public static enum ZoomLevel { /** + * Zoom 25%. + */ + ZOOM_25("25%", 0.25), + /** * Zoom 50%. */ ZOOM_50("50%", 0.5), @@ -62,6 +66,16 @@ public class UIDiagramRepresentation extends AbstractUIRepresentation<SWTBotSiri ZOOM_125("125%", 1.25), /** + * Zoom 150%. + */ + ZOOM_150("150%", 1.50), + + /** + * Zoom 175%. + */ + ZOOM_175("175%", 1.75), + + /** * Zoom 200%. */ ZOOM_200("200%", 2.0), diff --git a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java index 9ae759f8b8..3caf7c7709 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java +++ b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusDiagramEditor.java @@ -941,6 +941,32 @@ public class SWTBotSiriusDiagramEditor extends SWTBotGefEditor { } /** + * This method applies a zoom by mouse wheel scroll with the given key + * pressed at the given coordinates. + * + * This method is asynchronous so make sure you wait the finishing of all UI + * events before testing the effect of this method. + * + * @param xPosition + * x absolute position of the mouse from which we do the zoom by + * mouse wheel scroll. + * @param yPosition + * y absolute position of the mouse from which we do the zoom by + * mouse wheel scroll. + * @param keyCode + * the keyboard key that should be pressed when doing the zoom. + * @param zoomIncrement + * the zoom power from original zoom. A positive value for + * zoom-in. A negative value for zoom out. + * @throws UnsupportedOperationException + * if the canvas associated to this viewer is not an + * SWTBotSiriusFigureCanvas. + */ + public void mouseScrollWithKey(final int xPosition, final int yPosition, final int keyCode, final int zoomIncrement) { + ((SWTBotSiriusGefViewer) getSWTBotGefViewer()).mouseScrollWithKey(xPosition, yPosition, keyCode, zoomIncrement); + } + + /** * Drag and drop the specified edit part to the specified location. * * @param editPartBot diff --git a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusGefViewer.java b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusGefViewer.java index 746b330b23..87041ed212 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusGefViewer.java +++ b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/editor/SWTBotSiriusGefViewer.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES + * Copyright (c) 2010, 2016 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 @@ -326,6 +326,36 @@ public class SWTBotSiriusGefViewer extends SWTBotGefViewer { } /** + * This method applies a zoom by mouse wheel scroll with the given key + * pressed at the given coordinates. + * + * This method is asynchronous so make sure you wait the finishing of all UI + * events before testing the effect of this method. + * + * @param xPosition + * x absolute position of the mouse from which we do the zoom by + * mouse wheel scroll. + * @param yPosition + * y absolute position of the mouse from which we do the zoom by + * mouse wheel scroll. + * @param keyCode + * the keyboard key that should be pressed when doing the zoom. + * @param zoomIncrement + * the zoom power from original zoom. A positive value for + * zoom-in. A negative value for zoom out. + * @throws UnsupportedOperationException + * if the canvas associated to this viewer is not an + * SWTBotSiriusFigureCanvas. + */ + public void mouseScrollWithKey(final int xPosition, final int yPosition, final int keyCode, final int zoomIncrement) { + if (canvas instanceof SWTBotSiriusFigureCanvas) { + ((SWTBotSiriusFigureCanvas) canvas).mouseScrollWithKey(xPosition, yPosition, keyCode, zoomIncrement); + } else { + throw new UnsupportedOperationException("This method is supported only by SWTBotSiriusFigureCanvas canvas and not by " + canvas.getClass().getSimpleName()); + } + } + + /** * Click on the editor at the specified location. * * @param xPosition diff --git a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/widget/SWTBotSiriusFigureCanvas.java b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/widget/SWTBotSiriusFigureCanvas.java index a7975328c3..a543fb7441 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/widget/SWTBotSiriusFigureCanvas.java +++ b/plugins/org.eclipse.sirius.tests.swtbot.support/src/org/eclipse/sirius/tests/swtbot/support/api/widget/SWTBotSiriusFigureCanvas.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2012, 2015 THALES GLOBAL SERVICES + * Copyright (c) 2012, 2016 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 @@ -241,4 +241,54 @@ public class SWTBotSiriusFigureCanvas extends SWTBotGefFigureCanvas { } }); } + + /** + * This method applies a zoom by mouse wheel scroll with the given key + * pressed at the given coordinates. + * + * This method is asynchronous so make sure you wait the finishing of all UI + * events before testing the effect of this method. + * + * @param xPosition + * x absolute position of the mouse from which we do the zoom by + * mouse wheel scroll. + * @param yPosition + * y absolute position of the mouse from which we do the zoom by + * mouse wheel scroll. + * @param keyCode + * the keyboard key that should be pressed when doing the zoom. + * @param zoomIncrement + * the zoom power from original zoom. A positive value for + * zoom-in. A negative value for zoom out. + */ + public void mouseScrollWithKey(final int xPosition, final int yPosition, final int keyCode, final int zoomIncrement) { + UIThreadRunnable.asyncExec(new VoidResult() { + @Override + public void run() { + + KeyEvent keyEvent = null; + if (keyCode != SWT.None) { + keyEvent = new KeyEvent(createEvent()); + keyEvent.keyCode = keyCode; + keyEvent.doit = true; + eventDispatcher.dispatchKeyPressed(keyEvent); + } + + final Event event = new Event(); + event.type = SWT.MouseWheel; + event.keyCode = SWT.MouseHorizontalWheel; + event.detail = SWT.SCROLL_LINE; + event.stateMask = SWT.CTRL; + event.x = xPosition; + event.y = yPosition; + event.count = zoomIncrement; + + eventDispatcher.dispatchMouseWheelScrolled(event); + + if (keyCode != SWT.None) { + eventDispatcher.dispatchKeyReleased(keyEvent); + } + } + }); + } } diff --git a/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF index f04dcb8162..ac9cfe0601 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF @@ -52,7 +52,8 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.sdk, org.eclipse.platform, org.eclipse.sirius.tests.sample.migration, - org.eclipse.emf.edit.ui + org.eclipse.emf.edit.ui, + org.eclipse.gmf.runtime.diagram.ui.render Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Eclipse-RegisterBuddy: org.apache.log4j diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/VSMForMouseZoomTest.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/VSMForMouseZoomTest.odesign new file mode 100644 index 0000000000..e543d5c38f --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/VSMForMouseZoomTest.odesign @@ -0,0 +1,402 @@ +<?xml version="1.0" encoding="UTF-8"?> +<description:Group xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" name="VSMForMouseZoomTest" version="11.0.0.201601261200"> + <ownedViewpoints name="VSMForMouseZoomTest" modelFileExtension="ecore"> + <ownedRepresentations xsi:type="description_1:DiagramDescription" dropDescriptions="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.1/@ownedTools[name='Drop%20EClass']" name="Diagram" domainClass="ecore.EPackage"> + <metamodel href="http://www.eclipse.org/emf/2002/Ecore#/"/> + <defaultLayer name="Default"> + <edgeMappings name="EReference" preconditionExpression="[not name.equalsIgnoreCase('inOut')/]" labelDirectEdit="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.3/@ownedTools[name='Edit%20Name']" semanticElements="var:self" synchronizationLock="true" sourceMapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" targetMapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" targetFinderExpression="feature:eType" sourceFinderExpression="feature:eContainer" domainClass="ecore.EReference" useDomainElement="true" reconnections="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.2/@ownedTools[name='ReconnectEReference']"> + <style sourceArrow="Diamond" routingStyle="manhattan"> + <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <beginLabelStyleDescription labelExpression="aql:self.name+'Begin'"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </beginLabelStyleDescription> + <centerLabelStyleDescription showIcon="false" labelExpression="aql:self.name+'Center'"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </centerLabelStyleDescription> + <endLabelStyleDescription showIcon="false" labelExpression="aql:self.name+'End'"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </endLabelStyleDescription> + </style> + </edgeMappings> + <edgeMappings name="ESupertypes" semanticCandidatesExpression="" synchronizationLock="true" sourceMapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" targetMapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" targetFinderExpression="feature:eSuperTypes"> + <style targetArrow="InputClosedArrow" routingStyle="tree"> + <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> + <centerLabelStyleDescription showIcon="false"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </centerLabelStyleDescription> + </style> + </edgeMappings> + <containerMappings name="EClass" deletionDescription="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.1/@ownedTools[name='Delete%20Class']" labelDirectEdit="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.3/@ownedTools[name='Edit%20Name']" semanticCandidatesExpression="[eClassifiers/]" doubleClickDescription="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.3/@ownedTools[name='Double%20Click']" synchronizationLock="true" domainClass="ecore.EClass" dropDescriptions="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.4/@ownedTools[name='DnDPortOut']" childrenPresentation="List"> + <borderedNodeMappings name="PortIn" preconditionExpression="[name.equalsIgnoreCase('in')/]" semanticCandidatesExpression="feature:eAttributes" createElements="false" domainClass="ecore.EAttribute"> + <style xsi:type="style:SquareDescription" showIcon="false" labelExpression="" hideLabelByDefault="true" sizeComputationExpression="1" resizeKind="NSEW"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='blue']"/> + </style> + </borderedNodeMappings> + <borderedNodeMappings name="PortOut" preconditionExpression="[name.equalsIgnoreCase('out')/]" semanticCandidatesExpression="feature:eAttributes" createElements="false" domainClass="ecore.EAttribute"> + <style xsi:type="style:SquareDescription" showIcon="false" labelExpression="" hideLabelByDefault="true" sizeComputationExpression="1" resizeKind="NSEW"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='green']"/> + </style> + </borderedNodeMappings> + <subNodeMappings name="Operation" labelDirectEdit="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@toolSections.3/@ownedTools[name='Edit%20Name']" semanticCandidatesExpression="feature:eOperations" domainClass="ecore.EOperation"> + <style xsi:type="style:BundledImageDescription" labelExpression="[name + '()'/]" labelAlignment="LEFT" tooltipExpression="feature:name" sizeComputationExpression="2"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </style> + </subNodeMappings> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="8" arcHeight="8" borderSizeComputationExpression="1" tooltipExpression="feature:name" roundedCorner="true" widthComputationExpression="12" heightComputationExpression="10" backgroundStyle="Liquid" foregroundColor="//@userColorsPalettes[name='Ecore%20Palette']/@entries[name='EClass']"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + </style> + <conditionnalStyles predicateExpression="feature:interface"> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="8" arcHeight="8" borderColor="//@userColorsPalettes[name='Ecore%20Palette']/@entries[name='Dark%20EClass']" iconPath="/org.eclipse.emf.ecoretools.design/icons/full/obj16/EClass_interface.gif" tooltipExpression="feature:name" roundedCorner="true" widthComputationExpression="12" heightComputationExpression="10" backgroundStyle="Liquid" foregroundColor="//@userColorsPalettes[name='Ecore%20Palette']/@entries[name='Abstract%20EClass']"> + <labelFormat>italic</labelFormat> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + </style> + </conditionnalStyles> + <conditionnalStyles predicateExpression="feature:abstract"> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="8" arcHeight="8" borderColor="//@userColorsPalettes[name='Ecore%20Palette']/@entries[name='Dark%20EClass']" iconPath="/org.eclipse.emf.ecoretools.design/icons/full/obj16/EClass_abstract.gif" tooltipExpression="service:renderTooltip" roundedCorner="true" widthComputationExpression="12" heightComputationExpression="10" backgroundStyle="Liquid" foregroundColor="//@userColorsPalettes[name='Ecore%20Palette']/@entries[name='Abstract%20EClass']"> + <labelFormat>italic</labelFormat> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + </style> + </conditionnalStyles> + </containerMappings> + <containerMappings name="Dropped Package" semanticCandidatesExpression="feature:eSubpackages" domainClass="ecore.EPackage" reusedContainerMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"> + <style xsi:type="style:FlatContainerStyleDescription" borderSizeComputationExpression="1" backgroundStyle="Liquid"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_orange']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/> + </style> + </containerMappings> + <toolSections name="DesignPatterns" label="Design Patterns"> + <ownedTools xsi:type="tool:ToolDescription" documentation="In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects is to be treated in the same way as a single instance of an object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly [1].

[1] http://en.wikipedia.org/wiki/Composite_pattern" name="Composite pattern With forceRefresh" forceRefresh="true"> + <element name="element"/> + <elementView name="elementView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="var:self"> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="component"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Component"/> + <subModelOperations xsi:type="tool:SetValue" featureName="interface" valueExpression="true"/> + <subModelOperations xsi:type="tool:SetValue" featureName="abstract" valueExpression="true"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="operation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + </subModelOperations> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="leaf"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Leaf"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="leafOperation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + </subModelOperations> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:component"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="composite"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Composite"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentOperation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentAdd"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="add"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentRemove"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="remove"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EReference" referenceName="eStructuralFeatures" variableName="parentChildRef"> + <subModelOperations xsi:type="tool:SetValue" featureName="eType" valueExpression="var:component"/> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="child"/> + </subModelOperations> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:component"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:ToolDescription" documentation="In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects is to be treated in the same way as a single instance of an object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly [1].

[1] http://en.wikipedia.org/wiki/Composite_pattern" name="Composite pattern Without forceRefresh"> + <element name="element"/> + <elementView name="elementView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="var:self"> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="component"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Component"/> + <subModelOperations xsi:type="tool:SetValue" featureName="interface" valueExpression="true"/> + <subModelOperations xsi:type="tool:SetValue" featureName="abstract" valueExpression="true"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="operation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + </subModelOperations> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="leaf"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Leaf"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="leafOperation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + </subModelOperations> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:component"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="composite"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Composite"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentOperation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentAdd"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="add"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentRemove"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="remove"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EReference" referenceName="eStructuralFeatures" variableName="parentChildRef"> + <subModelOperations xsi:type="tool:SetValue" featureName="eType" valueExpression="var:component"/> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="child"/> + </subModelOperations> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:component"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool:ToolDescription" documentation="In software engineering, the composite pattern is a partitioning design pattern. The composite pattern describes that a group of objects is to be treated in the same way as a single instance of an object. The intent of a composite is to "compose" objects into tree structures to represent part-whole hierarchies. Implementing the composite pattern lets clients treat individual objects and compositions uniformly [1].

[1] http://en.wikipedia.org/wiki/Composite_pattern" name="Composite_With_Views_Creation"> + <element name="element"/> + <elementView name="elementView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="var:self"> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="component"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Component"/> + <subModelOperations xsi:type="tool:SetValue" featureName="interface" valueExpression="true"/> + <subModelOperations xsi:type="tool:SetValue" featureName="abstract" valueExpression="true"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" containerViewExpression="var:elementView" variableName="viewForComponent"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentOperation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@subNodeMappings[name='Operation']" containerViewExpression="var:viewForComponent" variableName="viewForComponentOperation"/> + </subModelOperations> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="leaf"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Leaf"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" containerViewExpression="var:elementView" variableName="viewForLeaf"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="leafOperation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@subNodeMappings[name='Operation']" containerViewExpression="var:viewForLeaf" variableName="viewForLeafOperation"/> + </subModelOperations> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:component"/> + <subModelOperations xsi:type="tool_1:CreateEdgeView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='ESupertypes']" containerViewExpression="var:elementView" variableName="leafSuperTypeView" sourceExpression="var:leaf" targetExpression="var:component"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="composite"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="Composite"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" containerViewExpression="var:elementView" variableName="viewForComposite"/> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentOperation"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="operation"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@subNodeMappings[name='Operation']" containerViewExpression="var:viewForComposite" variableName="viewForCompositeOperation"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentAdd"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="add"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@subNodeMappings[name='Operation']" containerViewExpression="var:viewForComposite" variableName="viewForCompositeAdd"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EOperation" referenceName="eOperations" variableName="componentRemove"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="remove"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@subNodeMappings[name='Operation']" containerViewExpression="var:viewForComposite" variableName="viewForCompositeRemove"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EReference" referenceName="eStructuralFeatures" variableName="parentChildRef"> + <subModelOperations xsi:type="tool:SetValue" featureName="eType" valueExpression="var:component"/> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="child"/> + <subModelOperations xsi:type="tool_1:CreateEdgeView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']" containerViewExpression="var:elementView" variableName="parentChildRefView" sourceExpression="var:composite" targetExpression="var:component"/> + </subModelOperations> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:component"/> + <subModelOperations xsi:type="tool_1:CreateEdgeView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='ESupertypes']" containerViewExpression="var:elementView" variableName="compositeSuperTypeView" sourceExpression="var:composite" targetExpression="var:component"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + </toolSections> + <toolSections name="Class creation"> + <ownedTools xsi:type="tool_1:ContainerCreationDescription" name="Create_two_sub_class" precondition="[container.oclIsKindOf(ecore::EClass)/]" forceRefresh="true" containerMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" extraMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="[container.eContainer()/]"> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="subClass"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="['Sub' + containerView.name+'_1'/]"/> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:container"/> + </subModelOperations> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="subClass2"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="['Sub' + containerView.name+'_2'/]"/> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:container"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool_1:ContainerCreationDescription" name="Create_sub_class_with_Views" precondition="[container.oclIsKindOf(ecore::EClass)/]" elementsToSelect="[containerView.eContainer()/]" containerMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" extraMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="[container.eContainer()/]"> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EClass" referenceName="eClassifiers" variableName="subClass"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="['Sub' + container.name/]"/> + <subModelOperations xsi:type="tool_1:CreateView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" containerViewExpression="[containerView.eContainer()/]" variableName="subClassView"/> + <subModelOperations xsi:type="tool:SetValue" featureName="eSuperTypes" valueExpression="var:container"/> + <subModelOperations xsi:type="tool_1:CreateEdgeView" mapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='ESupertypes']" containerViewExpression="[containerView.eContainer()/]" variableName="superTypeView" sourceExpression="var:subClass" targetExpression="var:container"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool_1:DeleteElementDescription" name="Delete Class"> + <element name="element"/> + <elementView name="elementView"/> + <containerView name="containerView"/> + <initialOperation/> + </ownedTools> + <ownedTools xsi:type="tool_1:ContainerDropDescription" name="Drop EClass" mappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"> + <oldContainer name="oldSemanticContainer"/> + <newContainer name="newSemanticContainer"/> + <element name="element"/> + <newViewContainer name="newContainerView"/> + <initialOperation/> + </ownedTools> + <ownedTools xsi:type="tool_1:NodeCreationDescription" name="Package Creation"> + <variable name="container"/> + <viewVariable name="containerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EPackage" referenceName="eSubpackages"/> + </initialOperation> + </ownedTools> + </toolSections> + <toolSections name="Edge creation"> + <ownedTools xsi:type="tool_1:EdgeCreationDescription" name="Reference" forceRefresh="true" edgeMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']" extraSourceMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']" extraTargetMappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"> + <sourceVariable name="source"/> + <targetVariable name="target"/> + <sourceViewVariable name="sourceView"/> + <targetViewVariable name="targetView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="var:source"> + <subModelOperations xsi:type="tool:CreateInstance" typeName="ecore.EReference" referenceName="eStructuralFeatures"> + <subModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="aql:target.name.toLower()"/> + <subModelOperations xsi:type="tool:SetValue" featureName="eType" valueExpression="var:target"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool_1:ReconnectEdgeDescription" name="ReconnectEReference"> + <source name="source"/> + <target name="target"/> + <sourceView name="sourceView"/> + <targetView name="targetView"/> + <element name="element"/> + <initialOperation/> + <edgeView name="edgeView"/> + </ownedTools> + </toolSections> + <toolSections name="Direct Edit"> + <ownedTools xsi:type="tool_1:DirectEditLabel" name="Edit Name"> + <mask mask="{0}"/> + <initialOperation> + <firstModelOperations xsi:type="tool:SetValue" featureName="name" valueExpression="var:arg0"/> + </initialOperation> + </ownedTools> + <ownedTools xsi:type="tool_1:DoubleClickDescription" name="Double Click" mappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"> + <element name="element"/> + <elementView name="elementView"/> + <initialOperation/> + </ownedTools> + </toolSections> + <toolSections name="DragNDrop"> + <ownedTools xsi:type="tool_1:ContainerDropDescription" name="DnDPortOut" mappings="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@borderedNodeMappings[name='PortOut']"> + <oldContainer name="oldSemanticContainer"/> + <newContainer name="newSemanticContainer"/> + <element name="element"/> + <newViewContainer name="newContainerView"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="var:newSemanticContainer"> + <subModelOperations xsi:type="tool:SetValue" featureName="eStructuralFeatures" valueExpression="var:element"/> + <subModelOperations xsi:type="tool:ChangeContext" browseExpression="var:newSemanticContainer"> + <subModelOperations xsi:type="tool:SetValue" featureName="eStructuralFeatures" valueExpression="[oldSemanticContainer.oclAsType(ecore::EClass).eReferences->first()/]"/> + </subModelOperations> + </firstModelOperations> + </initialOperation> + </ownedTools> + </toolSections> + </defaultLayer> + <additionalLayers name="Package" activeByDefault="true"/> + </ownedRepresentations> + <ownedRepresentations xsi:type="description_1:DiagramDescription" name="DiagramWithBracketEdge" domainClass="ecore.EPackage"> + <metamodel href="http://www.eclipse.org/emf/2002/Ecore#/"/> + <defaultLayer name="Default"> + <nodeMappings name="EAnnotationMapping" semanticCandidatesExpression="aql:self.eAnnotations" domainClass="ecore.EAnnotation"> + <style xsi:type="style:DotDescription" labelExpression="aql:self.source"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> + </style> + </nodeMappings> + <edgeMappings name="EReferenceMapping" preconditionExpression="aql:self.eOpposite = null" semanticElements="var:self" synchronizationLock="true" sourceMapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='DiagramWithBracketEdge']/@defaultLayer/@containerMappings[name='EClassMapping']" targetMapping="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='DiagramWithBracketEdge']/@defaultLayer/@containerMappings[name='EClassMapping']" targetFinderExpression="feature:eType" sourceFinderExpression="feature:eContainer" domainClass="EReference" useDomainElement="true" reconnections="//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='DiagramWithBracketEdge']/@defaultLayer/@toolSections.0/@ownedTools[name='ReconnectEReferenceTool']"> + <style xsi:type="style:BracketEdgeStyleDescription" sourceArrow="InputArrow" sizeComputationExpression="2" routingStyle="tree"> + <strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/> + <beginLabelStyleDescription labelExpression="aql:self.name+'Begin'"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </beginLabelStyleDescription> + <centerLabelStyleDescription labelExpression="aql:self.name+'Center'"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </centerLabelStyleDescription> + <endLabelStyleDescription labelExpression="aql:self.name+'End'"> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + </endLabelStyleDescription> + </style> + </edgeMappings> + <containerMappings name="EClassMapping" semanticCandidatesExpression="feature:eClassifiers" domainClass="ecore.EClass" childrenPresentation="List"> + <style xsi:type="style:FlatContainerStyleDescription" arcWidth="1" arcHeight="1" borderSizeComputationExpression="1" tooltipExpression="feature:name" backgroundStyle="GradientTopToBottom"> + <borderColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/> + <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/> + <foregroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='light_gray']"/> + </style> + </containerMappings> + <toolSections> + <ownedTools xsi:type="tool_1:ReconnectEdgeDescription" name="ReconnectEReferenceTool" reconnectionKind="RECONNECT_BOTH"> + <source name="source"/> + <target name="target"/> + <sourceView name="sourceView"/> + <targetView name="targetView"/> + <element name="element"/> + <initialOperation> + <firstModelOperations xsi:type="tool:ChangeContext" browseExpression="var:source"> + <subModelOperations xsi:type="tool:If" conditionExpression="[source!=element.eContainer/]"> + <subModelOperations xsi:type="tool:ChangeContext" browseExpression="var:element"> + <subModelOperations xsi:type="tool:SetValue" featureName="eType" valueExpression="var:target"/> + </subModelOperations> + </subModelOperations> + <subModelOperations xsi:type="tool:If" conditionExpression="[source==element.eContainer/]"> + <subModelOperations xsi:type="tool:If" conditionExpression="[otherEnd == sourceView/]"> + <subModelOperations xsi:type="tool:If" conditionExpression="[otherEnd == edgeView.targetNode/]"> + <subModelOperations xsi:type="tool:ChangeContext" browseExpression="var:target"> + <subModelOperations xsi:type="tool:SetValue" featureName="eStructuralFeatures" valueExpression="var:element"/> + </subModelOperations> + </subModelOperations> + <subModelOperations xsi:type="tool:If" conditionExpression="[otherEnd != $edgeView.targetNode/]"> + <subModelOperations xsi:type="tool:ChangeContext" browseExpression="var:element"> + <subModelOperations xsi:type="tool:SetValue" featureName="eType" valueExpression="aql:edgeView.targetNode.target"/> + </subModelOperations> + <subModelOperations xsi:type="tool:ChangeContext" browseExpression="[otherEnd.getTarget()/]"> + <subModelOperations xsi:type="tool:SetValue" featureName="eStructuralFeatures" valueExpression="var:element"/> + </subModelOperations> + </subModelOperations> + </subModelOperations> + <subModelOperations xsi:type="tool:If" conditionExpression="[otherEnd != sourceView]"> + <subModelOperations xsi:type="tool:ChangeContext" browseExpression="var:target"> + <subModelOperations xsi:type="tool:SetValue" featureName="eStructuralFeatures" valueExpression="var:element"/> + </subModelOperations> + </subModelOperations> + </subModelOperations> + </firstModelOperations> + </initialOperation> + <edgeView name="edgeView"/> + </ownedTools> + </toolSections> + </defaultLayer> + </ownedRepresentations> + </ownedViewpoints> + <userColorsPalettes name="Ecore Palette"> + <entries xsi:type="description:UserFixedColor" red="255" green="252" blue="216" name="EClass"/> + <entries xsi:type="description:UserFixedColor" red="228" green="228" blue="228" name="Abstract EClass"/> + <entries xsi:type="description:UserFixedColor" name="Dark EClass"/> + </userColorsPalettes> +</description:Group> diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/mouseZoomTest.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/mouseZoomTest.aird new file mode 100644 index 0000000000..79968dc661 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/mouseZoomTest.aird @@ -0,0 +1,308 @@ +<?xml version="1.0" encoding="UTF-8"?> +<viewpoint:DAnalysis xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_SEc7wFiYEea85cvr5QCr2w" selectedViews="_S90zwFiYEea85cvr5QCr2w" version="11.1.0.201606300900"> + <semanticResources>mouseZoomTest.ecore</semanticResources> + <ownedViews xmi:type="viewpoint:DView" xmi:id="_S90zwFiYEea85cvr5QCr2w"> + <viewpoint xmi:type="description:Viewpoint" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']"/> + <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" xmi:id="_T8GZ4FiYEea85cvr5QCr2w" name="zoomMouseDiagram" representation="_T8GZ4ViYEea85cvr5QCr2w"> + <description xmi:type="description_1:DiagramDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']"/> + <target xmi:type="ecore:EPackage" href="mouseZoomTest.ecore#/"/> + </ownedRepresentationDescriptors> + <ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_T8GZ4ViYEea85cvr5QCr2w" name="zoomMouseDiagram"> + <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_T8GZ4liYEea85cvr5QCr2w" source="DANNOTATION_CUSTOMIZATION_KEY"> + <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_T8GZ41iYEea85cvr5QCr2w"/> + </ownedAnnotationEntries> + <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_T8LSYFiYEea85cvr5QCr2w" source="GMF_DIAGRAMS"> + <data xmi:type="notation:Diagram" xmi:id="_T8LSYViYEea85cvr5QCr2w" type="Sirius" element="_T8GZ4ViYEea85cvr5QCr2w" measurementUnit="Pixel"> + <children xmi:type="notation:Node" xmi:id="_T8QK4FiYEea85cvr5QCr2w" type="2003" element="_T8GZ5FiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8T1QFiYEea85cvr5QCr2w" type="5007"/> + <children xmi:type="notation:Node" xmi:id="_T8T1QViYEea85cvr5QCr2w" type="7004"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8T1QliYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8T1Q1iYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8QK4ViYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8QK4liYEea85cvr5QCr2w" x="130" y="50"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8T1RFiYEea85cvr5QCr2w" type="2003" element="_T8GZ5liYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8T1R1iYEea85cvr5QCr2w" type="5007"/> + <children xmi:type="notation:Node" xmi:id="_T8T1SFiYEea85cvr5QCr2w" type="7004"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8T1SViYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8T1SliYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8T1RViYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8T1RliYEea85cvr5QCr2w" x="313" y="165"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8T1S1iYEea85cvr5QCr2w" type="2003" element="_T8GZ6FiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8T1TliYEea85cvr5QCr2w" type="5007"/> + <children xmi:type="notation:Node" xmi:id="_T8T1T1iYEea85cvr5QCr2w" type="7004"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8T1UFiYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8T1UViYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8T1TFiYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8T1TViYEea85cvr5QCr2w" x="492" y="325"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8T1UliYEea85cvr5QCr2w" type="2003" element="_T8GZ6liYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8T1VViYEea85cvr5QCr2w" type="5007"/> + <children xmi:type="notation:Node" xmi:id="_T8T1VliYEea85cvr5QCr2w" type="7004"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8T1V1iYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8T1WFiYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8T1U1iYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8T1VFiYEea85cvr5QCr2w" x="1065" y="55"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8T1WViYEea85cvr5QCr2w" type="2003" element="_T8GZ7FiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8T1XFiYEea85cvr5QCr2w" type="5007"/> + <children xmi:type="notation:Node" xmi:id="_T8T1XViYEea85cvr5QCr2w" type="7004"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8T1XliYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8T1X1iYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8T1WliYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8T1W1iYEea85cvr5QCr2w" x="705" y="530"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8T1YFiYEea85cvr5QCr2w" type="2003" element="_T8GZ7liYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8T1Y1iYEea85cvr5QCr2w" type="5007"/> + <children xmi:type="notation:Node" xmi:id="_T8T1ZFiYEea85cvr5QCr2w" type="7004"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8T1ZViYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8T1ZliYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8T1YViYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8T1YliYEea85cvr5QCr2w" x="1315" y="335"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8T1Z1iYEea85cvr5QCr2w" type="2002" element="_T8GZ8FiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8dmQFiYEea85cvr5QCr2w" type="5006"/> + <children xmi:type="notation:Node" xmi:id="_T8eNUFiYEea85cvr5QCr2w" type="7001"> + <children xmi:type="notation:Node" xmi:id="_T8fbcFiYEea85cvr5QCr2w" type="3009" element="_T8GZ8liYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8fbc1iYEea85cvr5QCr2w" type="5004"/> + <children xmi:type="notation:Node" xmi:id="_T8gpkFiYEea85cvr5QCr2w" type="7003"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8gpkViYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8gpkliYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8fbcViYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8fbcliYEea85cvr5QCr2w" x="30" y="159"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8hQoFiYEea85cvr5QCr2w" type="3009" element="_T8GZ9FiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8h3sFiYEea85cvr5QCr2w" type="5004"/> + <children xmi:type="notation:Node" xmi:id="_T8h3sViYEea85cvr5QCr2w" type="7003"> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8h3sliYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8h3s1iYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8hQoViYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8hQoliYEea85cvr5QCr2w" x="30" y="29"/> + </children> + <styles xmi:type="notation:SortingStyle" xmi:id="_T8eNUViYEea85cvr5QCr2w"/> + <styles xmi:type="notation:FilteringStyle" xmi:id="_T8eNUliYEea85cvr5QCr2w"/> + </children> + <styles xmi:type="notation:ShapeStyle" xmi:id="_T8T1aFiYEea85cvr5QCr2w" fontColor="9031421" fontName="Segoe UI" fontHeight="8"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8T1aViYEea85cvr5QCr2w" x="60" y="305" width="373" height="318"/> + </children> + <styles xmi:type="notation:DiagramStyle" xmi:id="_T8LSYliYEea85cvr5QCr2w"/> + <edges xmi:type="notation:Edge" xmi:id="_T8kT8FiYEea85cvr5QCr2w" type="4001" element="_T8GZ9liYEea85cvr5QCr2w" source="_T8QK4FiYEea85cvr5QCr2w" target="_T8T1RFiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8liEFiYEea85cvr5QCr2w" type="6001"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8liEViYEea85cvr5QCr2w" y="-10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8mwMFiYEea85cvr5QCr2w" type="6002"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8mwMViYEea85cvr5QCr2w" x="4" y="8"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8nXQFiYEea85cvr5QCr2w" type="6003"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8nXQViYEea85cvr5QCr2w" y="10"/> + </children> + <styles xmi:type="notation:ConnectorStyle" xmi:id="_T8kT8ViYEea85cvr5QCr2w" routing="Rectilinear"/> + <styles xmi:type="notation:FontStyle" xmi:id="_T8kT8liYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_T8kT81iYEea85cvr5QCr2w" points="[-58, 98, -241, -115]$[-58, 147, -241, -66]$[66, 147, -117, -66]$[66, 150, -117, -63]$[124, 150, -59, -63]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8rBoFiYEea85cvr5QCr2w" id="(0.5,0.0)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8rBoViYEea85cvr5QCr2w" id="(0.5,1.0)"/> + </edges> + <edges xmi:type="notation:Edge" xmi:id="_T8rosFiYEea85cvr5QCr2w" type="4001" element="_T8GZ-1iYEea85cvr5QCr2w" source="_T8T1S1iYEea85cvr5QCr2w" target="_T8T1UliYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8sPwFiYEea85cvr5QCr2w" type="6001"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8sPwViYEea85cvr5QCr2w" x="183" y="10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8sPwliYEea85cvr5QCr2w" type="6002"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8sPw1iYEea85cvr5QCr2w" x="80" y="10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8s20FiYEea85cvr5QCr2w" type="6003"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8s20ViYEea85cvr5QCr2w" x="63" y="-57"/> + </children> + <styles xmi:type="notation:ConnectorStyle" xmi:id="_T8rosViYEea85cvr5QCr2w" routing="Rectilinear"/> + <styles xmi:type="notation:FontStyle" xmi:id="_T8rosliYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_T8ros1iYEea85cvr5QCr2w" points="[0, 0, -573, 172]$[0, -113, -573, 59]$[573, -113, 0, 59]$[573, -172, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8s20liYEea85cvr5QCr2w" id="(0.5,0.0)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8s201iYEea85cvr5QCr2w" id="(0.5,1.0)"/> + </edges> + <edges xmi:type="notation:Edge" xmi:id="_T8td4FiYEea85cvr5QCr2w" type="4001" element="_T8GaAFiYEea85cvr5QCr2w" source="_T8T1WViYEea85cvr5QCr2w" target="_T8T1YFiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8td5FiYEea85cvr5QCr2w" type="6001"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8td5ViYEea85cvr5QCr2w" x="-13"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8uE8FiYEea85cvr5QCr2w" type="6002"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8uE8ViYEea85cvr5QCr2w" x="-38"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8uE8liYEea85cvr5QCr2w" type="6003"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8uE81iYEea85cvr5QCr2w" x="-83"/> + </children> + <styles xmi:type="notation:ConnectorStyle" xmi:id="_T8td4ViYEea85cvr5QCr2w" routing="Rectilinear"/> + <styles xmi:type="notation:FontStyle" xmi:id="_T8td4liYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_T8td41iYEea85cvr5QCr2w" points="[0, 0, -610, 97]$[0, -31, -610, 66]$[555, -31, -55, 66]$[555, -97, -55, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8uE9FiYEea85cvr5QCr2w" id="(0.5,0.0)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8uE9ViYEea85cvr5QCr2w" id="(0.5,1.0)"/> + </edges> + <edges xmi:type="notation:Edge" xmi:id="_T8usAFiYEea85cvr5QCr2w" type="4001" element="_T8GaBViYEea85cvr5QCr2w" source="_T8fbcFiYEea85cvr5QCr2w" target="_T8hQoFiYEea85cvr5QCr2w"> + <children xmi:type="notation:Node" xmi:id="_T8usBFiYEea85cvr5QCr2w" type="6001"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8usBViYEea85cvr5QCr2w" y="-10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8vTEFiYEea85cvr5QCr2w" type="6002"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8vTEViYEea85cvr5QCr2w" y="10"/> + </children> + <children xmi:type="notation:Node" xmi:id="_T8vTEliYEea85cvr5QCr2w" type="6003"> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_T8vTE1iYEea85cvr5QCr2w" y="10"/> + </children> + <styles xmi:type="notation:ConnectorStyle" xmi:id="_T8usAViYEea85cvr5QCr2w" routing="Rectilinear"/> + <styles xmi:type="notation:FontStyle" xmi:id="_T8usAliYEea85cvr5QCr2w" fontName="Segoe UI" fontHeight="8"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_T8usA1iYEea85cvr5QCr2w" points="[0, -50, 0, 110]$[0, -110, 0, 50]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8v6IFiYEea85cvr5QCr2w" id="(0.5,0.0)"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_T8v6IViYEea85cvr5QCr2w" id="(0.5,1.0)"/> + </edges> + </data> + </ownedAnnotationEntries> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ5FiYEea85cvr5QCr2w" name="A" tooltipText="A" outgoingEdges="_T8GZ9liYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//A"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//A"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ5ViYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ5liYEea85cvr5QCr2w" name="B" tooltipText="B" incomingEdges="_T8GZ9liYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//B"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//B"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ51iYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ6FiYEea85cvr5QCr2w" name="C" tooltipText="C" outgoingEdges="_T8GZ-1iYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//C"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//C"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ6ViYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ6liYEea85cvr5QCr2w" name="D" tooltipText="D" incomingEdges="_T8GZ-1iYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//D"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//D"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ61iYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ7FiYEea85cvr5QCr2w" name="E" tooltipText="E" outgoingEdges="_T8GaAFiYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//E"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//E"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ7ViYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ7liYEea85cvr5QCr2w" name="F" tooltipText="F" incomingEdges="_T8GaAFiYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//F"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//F"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ71iYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_T8GZ8FiYEea85cvr5QCr2w" name="P1"> + <target xmi:type="ecore:EPackage" href="mouseZoomTest.ecore#//P1"/> + <semanticElements xmi:type="ecore:EPackage" href="mouseZoomTest.ecore#//P1"/> + <arrangeConstraints>KEEP_LOCATION</arrangeConstraints> + <arrangeConstraints>KEEP_SIZE</arrangeConstraints> + <arrangeConstraints>KEEP_RATIO</arrangeConstraints> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ8ViYEea85cvr5QCr2w" labelColor="253,206,137" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Dropped%20Package']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='Dropped%20Package']"/> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ8liYEea85cvr5QCr2w" name="C1A" tooltipText="C1A" outgoingEdges="_T8GaBViYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//P1/C1A"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//P1/C1A"/> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ81iYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_T8GZ9FiYEea85cvr5QCr2w" name="C1B" tooltipText="C1B" incomingEdges="_T8GaBViYEea85cvr5QCr2w" width="12" height="10"> + <target xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//P1/C1B"/> + <semanticElements xmi:type="ecore:EClass" href="mouseZoomTest.ecore#//P1/C1B"/> + <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_T8GZ9ViYEea85cvr5QCr2w" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="Liquid" foregroundColor="255,252,216"> + <description xmi:type="style:FlatContainerStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']/@style"/> + </ownedStyle> + <actualMapping xmi:type="description_1:ContainerMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@containerMappings[name='EClass']"/> + </ownedDiagramElements> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_T8GZ9liYEea85cvr5QCr2w" name="refToBCenter" sourceNode="_T8GZ5FiYEea85cvr5QCr2w" targetNode="_T8GZ5liYEea85cvr5QCr2w" beginLabel="refToBBegin" endLabel="refToBEnd"> + <target xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//A/refToB"/> + <semanticElements xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//A/refToB"/> + <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_T8GZ91iYEea85cvr5QCr2w" sourceArrow="Diamond" routingStyle="manhattan" strokeColor="0,0,0"> + <description xmi:type="style:EdgeStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/> + <beginLabelStyle xmi:type="diagram:BeginLabelStyle" xmi:id="_T8GZ-FiYEea85cvr5QCr2w"/> + <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_T8GZ-ViYEea85cvr5QCr2w" showIcon="false"/> + <endLabelStyle xmi:type="diagram:EndLabelStyle" xmi:id="_T8GZ-liYEea85cvr5QCr2w" showIcon="false"/> + </ownedStyle> + <actualMapping xmi:type="description_1:EdgeMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_T8GZ-1iYEea85cvr5QCr2w" name="refToDCenter" sourceNode="_T8GZ6FiYEea85cvr5QCr2w" targetNode="_T8GZ6liYEea85cvr5QCr2w" beginLabel="refToDBegin" endLabel="refToDEnd"> + <target xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//C/refToD"/> + <semanticElements xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//C/refToD"/> + <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_T8GZ_FiYEea85cvr5QCr2w" sourceArrow="Diamond" routingStyle="manhattan" strokeColor="0,0,0"> + <description xmi:type="style:EdgeStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/> + <beginLabelStyle xmi:type="diagram:BeginLabelStyle" xmi:id="_T8GZ_ViYEea85cvr5QCr2w"/> + <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_T8GZ_liYEea85cvr5QCr2w" showIcon="false"/> + <endLabelStyle xmi:type="diagram:EndLabelStyle" xmi:id="_T8GZ_1iYEea85cvr5QCr2w" showIcon="false"/> + </ownedStyle> + <actualMapping xmi:type="description_1:EdgeMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_T8GaAFiYEea85cvr5QCr2w" name="refToFCenter" sourceNode="_T8GZ7FiYEea85cvr5QCr2w" targetNode="_T8GZ7liYEea85cvr5QCr2w" beginLabel="refToFBegin" endLabel="refToFEnd"> + <target xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//E/refToF"/> + <semanticElements xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//E/refToF"/> + <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_T8GaAViYEea85cvr5QCr2w" sourceArrow="Diamond" routingStyle="manhattan" strokeColor="0,0,0"> + <description xmi:type="style:EdgeStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/> + <beginLabelStyle xmi:type="diagram:BeginLabelStyle" xmi:id="_T8GaAliYEea85cvr5QCr2w"/> + <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_T8GaA1iYEea85cvr5QCr2w" showIcon="false"/> + <endLabelStyle xmi:type="diagram:EndLabelStyle" xmi:id="_T8GaBFiYEea85cvr5QCr2w" showIcon="false"/> + </ownedStyle> + <actualMapping xmi:type="description_1:EdgeMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']"/> + </ownedDiagramElements> + <ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_T8GaBViYEea85cvr5QCr2w" name="refToC1BCenter" sourceNode="_T8GZ8liYEea85cvr5QCr2w" targetNode="_T8GZ9FiYEea85cvr5QCr2w" beginLabel="refToC1BBegin" endLabel="refToC1BEnd"> + <target xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//P1/C1A/refToC1B"/> + <semanticElements xmi:type="ecore:EReference" href="mouseZoomTest.ecore#//P1/C1A/refToC1B"/> + <ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_T8GaBliYEea85cvr5QCr2w" sourceArrow="Diamond" routingStyle="manhattan" strokeColor="0,0,0"> + <description xmi:type="style:EdgeStyleDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']/@style"/> + <beginLabelStyle xmi:type="diagram:BeginLabelStyle" xmi:id="_T8GaB1iYEea85cvr5QCr2w"/> + <centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_T8GaCFiYEea85cvr5QCr2w" showIcon="false"/> + <endLabelStyle xmi:type="diagram:EndLabelStyle" xmi:id="_T8GaCViYEea85cvr5QCr2w" showIcon="false"/> + </ownedStyle> + <actualMapping xmi:type="description_1:EdgeMapping" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer/@edgeMappings[name='EReference']"/> + </ownedDiagramElements> + <description xmi:type="description_1:DiagramDescription" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']"/> + <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_T8GaCliYEea85cvr5QCr2w"/> + <activatedLayers xmi:type="description_1:Layer" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@defaultLayer"/> + <activatedLayers xmi:type="description_1:AdditionalLayer" href="VSMForMouseZoomTest.odesign#//@ownedViewpoints[name='VSMForMouseZoomTest']/@ownedRepresentations[name='Diagram']/@additionalLayers[name='Package']"/> + <target xmi:type="ecore:EPackage" href="mouseZoomTest.ecore#/"/> + </ownedRepresentations> + </ownedViews> +</viewpoint:DAnalysis> diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/mouseZoomTest.ecore b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/mouseZoomTest.ecore new file mode 100644 index 0000000000..d4f6136f78 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/mouseZoom/mouseZoomTest.ecore @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="P0"> + <eClassifiers xsi:type="ecore:EClass" name="A"> + <eStructuralFeatures xsi:type="ecore:EReference" name="refToB" eType="#//B"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="B"/> + <eClassifiers xsi:type="ecore:EClass" name="C"> + <eStructuralFeatures xsi:type="ecore:EReference" name="refToD" eType="#//D"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="D"/> + <eClassifiers xsi:type="ecore:EClass" name="E"> + <eStructuralFeatures xsi:type="ecore:EReference" name="refToF" eType="#//F"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="F"/> + <eSubpackages name="P1"> + <eClassifiers xsi:type="ecore:EClass" name="C1A"> + <eStructuralFeatures xsi:type="ecore:EReference" name="refToC1B" eType="#//P1/C1B"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="C1B"/> + </eSubpackages> +</ecore:EPackage> diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DiagramMouseZoomTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DiagramMouseZoomTest.java new file mode 100644 index 0000000000..500cc0bd3e --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/DiagramMouseZoomTest.java @@ -0,0 +1,327 @@ +/******************************************************************************* + * Copyright (c) 2016 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.tests.swtbot; + +import static org.junit.Assert.assertNotEquals; + +import org.eclipse.draw2d.ScalableFigure; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.ui.tools.internal.graphical.edit.part.DDiagramRootEditPart; +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.UILocalSession; +import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource; +import org.eclipse.sirius.tests.swtbot.support.api.condition.CheckDiagramSelected; +import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor; +import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils; +import org.eclipse.swt.SWT; +import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; +import org.eclipse.swtbot.swt.finder.waits.ICondition; + +/** + * Tests that the zoom started by CTRL+Mouse wheel on a diagram is correct + * regarding its specification. + * + * The diagram point behind the mouse location must stay at the same position in + * the viewport after zoom when no diagram boundaries are inside the viewport + * after zoom. + * + * If boundaries are visible after zoom, then the diagram point behind mouse + * location will be shifted regarding the zoom level and viewport location from + * some pixel on x or y axis or both because diagram cannot be extend during + * zoom. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +public class DiagramMouseZoomTest extends AbstractSiriusSwtBotGefTestCase { + + private static final String FILE_DIR = "/"; + + private static final String DIAGRAM_INSTANCE_NAME = "zoomMouseDiagram"; + + private static final String DIAGRAM_DESCRIPTION = "Diagram"; + + private static final String MODEL_FILE = "mouseZoomTest.ecore"; + + private static final String SESSION_FILE = "mouseZoomTest.aird"; + + private static final String VSM_FILE = "VSMForMouseZoomTest.odesign"; + + private static final String DATA_UNIT_DIR = "data/unit/mouseZoom/"; + + private SWTBotSiriusDiagramEditor editor; + + private UIResource sessionAirdResource; + + private UILocalSession localSession; + + @Override + protected void onSetUpBeforeClosingWelcomePage() throws Exception { + copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, MODEL_FILE, SESSION_FILE, VSM_FILE); + } + + @Override + protected void onSetUpAfterOpeningDesignerPerspective() throws Exception { + sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE); + localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true); + + } + + /** + * {@inheritDoc} + */ + @Override + protected void tearDown() throws Exception { + // Restore the default zoom level + editor.click(0, 0); // Set the focus on the diagram + editor.zoom(ZoomLevel.ZOOM_100); + // Go to the origin to avoid scroll bar + editor.scrollTo(0, 0); + SWTBotUtils.waitAllUiEvents(); + super.tearDown(); + } + + private void openDiagram(String descriptionName, String instanceName, ZoomLevel zoomLevel) { + editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), descriptionName, instanceName, DDiagram.class); + editor.zoom(zoomLevel); + SWTBotUtils.waitAllUiEvents(); + } + + private enum BoundariesVisible { + NONE, ZOOMOUT, ZOOMIN + } + + /** + * Assert that the viewport is shifted to the right location when doing a + * zoom with CTRL+MouseScroll when the mouse is over the origin point of the + * given part. + * + * @param editPart + * the edit part from which we will apply a mouse zoom on its + * origin. + * @param targetZoomLevel + * The final zoom to apply. + * @param originalZoomLevel + * the zoom level before zooming. + * @param zoomIncrement + * the zoom increment leading to the wanted zoom. + * @param scrollX + * the x coordinate to scroll to the diagram. + * @param scrollY + * the y coordinate to scroll to the diagram. + * @param boundariesVisible + * If {@link BoundariesVisible#NONE}, then checks the viewport is + * right positioned with the zoom point at the same place after + * zoom. If {@link BoundariesVisible#ZOOMOUT}, then checks the + * viewport is at (0,0) position. And the zoomed point has been + * shifted regarding the zoom on the lower and right direction. + * If {@link BoundariesVisible#ZOOMIN}, then checks the viewport + * is at the lowest and rightmost position. And the zoomed point + * has been shifted regarding the zoom on a lower and rightmost + * direction. + */ + private void assertViewportShiftedRightForMouseZoom(SWTBotGefEditPart editPart, ZoomLevel originalZoomLevel, ZoomLevel targetZoomLevel, int zoomIncrement, int scrollX, int scrollY, + BoundariesVisible boundariesVisible) { + ICondition condition = new CheckDiagramSelected(editor); + editor.click(new Point(0, 0)); + bot.waitUntil(condition); + DiagramEditPart diagramPart = (DiagramEditPart) ((IStructuredSelection) editor.getSelection()).getFirstElement(); + DDiagramRootEditPart parentDiagram = (DDiagramRootEditPart) diagramPart.getParent(); + editor.scrollTo(scrollX, scrollY); + SWTBotUtils.waitAllUiEvents(); + + IGraphicalEditPart zoomTargetPart = (IGraphicalEditPart) editPart.part(); + Point mouseZoomAbsoluteLocationBeforeZoom = zoomTargetPart.getFigure().getBounds().getCopy().getLocation(); + zoomTargetPart.getFigure().translateToAbsolute(mouseZoomAbsoluteLocationBeforeZoom); + + assertNotEquals(new Rectangle(0, 0, 0, 0), zoomTargetPart); + + // We do the zoom algorithm part that computes the expected viewport + // location after zoom to have the expected viewport location that we + // know is working because of manual test. + ScalableFigure scalableFigure = parentDiagram.getZoomManager().getScalableFigure(); + Point expectedMouseRelativeLocation = new Point(mouseZoomAbsoluteLocationBeforeZoom); + scalableFigure.translateToRelative(expectedMouseRelativeLocation); + Point originalViewLocation = diagramPart.getViewport().getViewLocation(); + Dimension difference = originalViewLocation.getDifference(new Point(expectedMouseRelativeLocation.x, expectedMouseRelativeLocation.y)); + Point scaledPoint = new Point(expectedMouseRelativeLocation.x, expectedMouseRelativeLocation.y).scale(targetZoomLevel.getAmount() / originalZoomLevel.getAmount()); + Point expectedViewportOriginPoint = scaledPoint.getTranslated(difference); + + editor.mouseScrollWithKey(mouseZoomAbsoluteLocationBeforeZoom.x, mouseZoomAbsoluteLocationBeforeZoom.y, SWT.CTRL, zoomIncrement); + SWTBotUtils.waitAllUiEvents(); + + Point newViewLocation = diagramPart.getViewport().getViewLocation(); + if (BoundariesVisible.NONE == boundariesVisible) { + assertEquals("viewport after zoom has not been placed at the right position on the x axis.", expectedViewportOriginPoint.x, newViewLocation.x, 1); + assertEquals("viewport after zoom has not been placed at the right position on the y axis.", expectedViewportOriginPoint.y, newViewLocation.y, 1); + } else if (BoundariesVisible.ZOOMOUT == boundariesVisible) { + assertEquals("viewport after zoom has not been placed at the right position on the x axis.", 0, newViewLocation.x, 1); + assertEquals("viewport after zoom has not been placed at the right position on the y axis.", 0, newViewLocation.y, 1); + } else if (BoundariesVisible.ZOOMIN == boundariesVisible) { + assertEquals("viewport after zoom has not been placed at the rightest and lowest position on the x axis.", diagramPart.getViewport().getHorizontalRangeModel().getMaximum(), + newViewLocation.x + diagramPart.getViewport().getHorizontalRangeModel().getExtent(), 1); + assertEquals("viewport after zoom has not been placed at the rightest and lowest position on the y axis.", diagramPart.getViewport().getVerticalRangeModel().getMaximum(), + newViewLocation.y + diagramPart.getViewport().getVerticalRangeModel().getExtent(), 1); + } else { + throw new UnsupportedOperationException("nothing is tested."); + } + Rectangle zoomTargetAbsoluteBoundsAfterZoom = zoomTargetPart.getFigure().getBounds().getCopy(); + zoomTargetPart.getFigure().translateToAbsolute(zoomTargetAbsoluteBoundsAfterZoom); + if (BoundariesVisible.NONE == boundariesVisible) { + assertEquals("The point behind the mouse is not the same one after zoom than before. x axis does not match.", mouseZoomAbsoluteLocationBeforeZoom.x, zoomTargetAbsoluteBoundsAfterZoom.x, + 1); + assertEquals("The point behind the mouse is not the same one after zoom than before. y axis does not match.", mouseZoomAbsoluteLocationBeforeZoom.y, zoomTargetAbsoluteBoundsAfterZoom.y, + 1); + } else if (BoundariesVisible.ZOOMIN == boundariesVisible) { + assertEquals("The point behind the mouse is the same one after zoom than before. Whereas it should be shifted regarding the zoom.", + mouseZoomAbsoluteLocationBeforeZoom.x - difference.width, zoomTargetAbsoluteBoundsAfterZoom.x, 1); + assertEquals("The point behind the mouse is the same one after zoom than before. Whereas it should not.", mouseZoomAbsoluteLocationBeforeZoom.y - difference.height, + zoomTargetAbsoluteBoundsAfterZoom.y, 1); + } else if (BoundariesVisible.ZOOMOUT == boundariesVisible) { + assertEquals("The point behind the mouse is the same one after zoom than before. Whereas it should be shifted regarding the zoom.", + mouseZoomAbsoluteLocationBeforeZoom.x + + (expectedViewportOriginPoint.x + (diagramPart.getViewport().getHorizontalRangeModel().getMaximum() - diagramPart.getViewport().getHorizontalRangeModel().getExtent())), + zoomTargetAbsoluteBoundsAfterZoom.x, 1); + assertEquals("The point behind the mouse is the same one after zoom than before. Whereas it should not.", + mouseZoomAbsoluteLocationBeforeZoom.y + + (expectedViewportOriginPoint.y - (diagramPart.getViewport().getVerticalRangeModel().getMaximum() - diagramPart.getViewport().getVerticalRangeModel().getExtent())), + zoomTargetAbsoluteBoundsAfterZoom.y, 1); + } else { + throw new UnsupportedOperationException("nothing is tested."); + } + } + + /** + * Tests that the viewport is shifted to the right position after zoom when + * a zoom in from 100% to 125% is done. + * + * The zoomed point is in the left upper corner. + * + * No diagram boundaries are visible after zoom so the viewport must keep + * the point behind the mouse to the same location on it after zoom on x and + * y axis. + * + * Original scroll is (0,0). + */ + public void testZoomInWithMouseWithoutBoundaryVisibleAfterZoomOnViewport() { + openDiagram(DIAGRAM_DESCRIPTION, DIAGRAM_INSTANCE_NAME, ZoomLevel.ZOOM_100); + SWTBotGefEditPart editPart = editor.getEditPart("A"); + + assertViewportShiftedRightForMouseZoom(editPart, ZoomLevel.ZOOM_100, ZoomLevel.ZOOM_125, 2, 0, 0, BoundariesVisible.NONE); + + } + + /** + * Tests that the viewport is shifted to the right position after zoom when + * a zoom in from 50% to 75% is done. + * + * The zoomed point is in the left upper corner. + * + * Upper and left diagram boundaries are visible after zoom so the viewport + * will not keep the point behind the mouse to the same location on it after + * zoom on x and y axis. And Viewport will not move its origin because it is + * blocked by boundaries. + * + * Original scroll is (0,0). + */ + public void testZoomInWithMouseWithLeftAndUpperBoundaryVisibleOnViewport() { + openDiagram(DIAGRAM_DESCRIPTION, DIAGRAM_INSTANCE_NAME, ZoomLevel.ZOOM_25); + SWTBotGefEditPart editPart = editor.getEditPart("A"); + + assertViewportShiftedRightForMouseZoom(editPart, ZoomLevel.ZOOM_25, ZoomLevel.ZOOM_50, 2, 0, 0, BoundariesVisible.ZOOMIN); + } + + /** + * Tests that the viewport is shifted to the right position after zoom when + * a zoom in from 75% to 100% is done. + * + * The zoomed point is in the right lower corner. + * + * Lower and right diagram boundaries are visible after zoom so the viewport + * has been blocked on this sides so the zoomed point will not be at the + * same position in the viewport. It will be shifted to the lower and right + * position. + * + * Original scroll is (0,0). + */ + public void testZoomInWithMouseWithLowerAndRightBoundaryVisibleOnViewport() { + openDiagram(DIAGRAM_DESCRIPTION, DIAGRAM_INSTANCE_NAME, ZoomLevel.ZOOM_25); + SWTBotGefEditPart editPart = editor.getEditPart("F"); + + assertViewportShiftedRightForMouseZoom(editPart, ZoomLevel.ZOOM_25, ZoomLevel.ZOOM_50, 2, 0, 0, BoundariesVisible.ZOOMIN); + } + + /** + * Tests that the viewport is shifted to the right position after zoom when + * a zoom out from 175% to 150% is done. + * + * The zoomed point is in the left upper corner. + * + * No diagram boundaries are visible after zoom out so the viewport must + * keep the point behind the mouse to the same location on it after zoom on + * x and y axis. + * + * Original scroll is (60,60). + */ + public void testZoomOutWithMouseWithoutBoundaryVisibleAfterZoomOnViewport() { + openDiagram(DIAGRAM_DESCRIPTION, DIAGRAM_INSTANCE_NAME, ZoomLevel.ZOOM_175); + SWTBotGefEditPart editPart = editor.getEditPart("A"); + + assertViewportShiftedRightForMouseZoom(editPart, ZoomLevel.ZOOM_175, ZoomLevel.ZOOM_150, -2, 60, 60, BoundariesVisible.NONE); + } + + /** + * Tests that the viewport is shifted to the right position after zoom when + * a zoom out from 175% to 150% is done. + * + * The zoomed point is in the left upper corner. + * + * Upper and left diagram boundaries are visible after zoom out so the + * viewport will not keep the point behind the mouse to the same location on + * it after zoom on x and y axis. And Viewport will not move its origin + * because it is blocked by boundaries. + * + * Original scroll is (0,0). + */ + public void testZoomOutWithMouseWithLeftAndUpperBoundaryVisibleOnViewport() { + openDiagram(DIAGRAM_DESCRIPTION, DIAGRAM_INSTANCE_NAME, ZoomLevel.ZOOM_75); + SWTBotGefEditPart editPart = editor.getEditPart("A"); + + assertViewportShiftedRightForMouseZoom(editPart, ZoomLevel.ZOOM_75, ZoomLevel.ZOOM_50, -2, 0, 0, BoundariesVisible.ZOOMOUT); + } + + /** + * Tests that the viewport is shifted to the right position after zoom when + * a zoom out from 125% to 100% is done. + * + * The zoomed point is in the right lower corner. + * + * Lower and right diagram boundaries are visible after zoom so the viewport + * has been blocked on this sides so the zoomed point will not be at the + * same position in the viewport. It will be shifted to the lower and right + * position. + * + * Original scroll is (0,0). + */ + public void testZoomOutWithMouseWithLowerAndRightBoundaryVisibleOnViewport() { + openDiagram(DIAGRAM_DESCRIPTION, DIAGRAM_INSTANCE_NAME, ZoomLevel.ZOOM_50); + SWTBotGefEditPart editPart = editor.getEditPart("F"); + + assertViewportShiftedRightForMouseZoom(editPart, ZoomLevel.ZOOM_50, ZoomLevel.ZOOM_25, -2, 0, 0, BoundariesVisible.ZOOMOUT); + } +} diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java index a49417bfef..5ca1dea3a2 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java @@ -153,6 +153,8 @@ public class AllTestSuite extends TestCase { suite.addTestSuite(CompartmentsCreationTest.class); suite.addTestSuite(CompartmentsDragAndDropTest.class); suite.addTestSuite(EdgeSelectionTest.class); + suite.addTestSuite(DiagramMouseZoomTest.class); + } /** @@ -239,6 +241,7 @@ public class AllTestSuite extends TestCase { suite.addTestSuite(ArrangeAllLinkedBorderedNodesLayoutStabilityAppTemoinTest.class); suite.addTestSuite(ArrangeAllLinkedBorderedNodesLayoutStabilityTest.class); suite.addTestSuite(DistributeActionTests.class); + // TODO CBR : fix these tests // suite.addTestSuite(ArrangeAllTest.class); suite.addTestSuite(EdgeStabilityOnBendpointsAlignmentTest.class); |
