diff options
| author | Laurent Redor | 2016-08-12 15:19:54 +0000 |
|---|---|---|
| committer | Laurent Redor | 2016-08-19 15:19:54 +0000 |
| commit | 0ad066a071687f40b3757ba6b148a8498908fb16 (patch) | |
| tree | 7a2d00d8a128d4de9520cf291f75af61c2b1dd08 | |
| parent | 2e389961ec140cbad351b972a9cd6ea3b62b0c53 (diff) | |
| download | org.eclipse.sirius-0ad066a071687f40b3757ba6b148a8498908fb16.tar.gz org.eclipse.sirius-0ad066a071687f40b3757ba6b148a8498908fb16.tar.xz org.eclipse.sirius-0ad066a071687f40b3757ba6b148a8498908fb16.zip | |
[496466] Replace layoutDataManager extension point by formatDataManager
* Add the new extension point
org.eclipse.sirius.diagram.ui.formatDataManager (a copy of
org.eclipse.sirius.diagram.ui.layoutDataManager). The previous one is
deprecated.
* Duplicate all necessary *LayoutData* classes in *FormatData classes
* Duplicate or refactor existing tests to test new extension point
* Depreciate extension point (and also all corresponding classes)
Bug: 496466
Change-Id: I20807a83e65067f60f89d5ab0818b56c46b5026d
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
124 files changed, 5407 insertions, 1275 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF index fa4f74609d..e1c8ee3055 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF @@ -39,6 +39,7 @@ Require-Bundle: com.google.guava;bundle-version="[11.0.2,16.0)", org.eclipse.sirius.ext.gmf.runtime;bundle-version="2.0.0";visibility:=reexport, org.eclipse.sirius.ui;bundle-version="2.0.0";visibility:=reexport, org.eclipse.sirius.diagram.layoutdata;bundle-version="2.0.0", + org.eclipse.sirius.diagram.formatdata;bundle-version="4.1.0", org.eclipse.sirius.ecore.extender;bundle-version="2.0.0", org.eclipse.ui.navigator;bundle-version="3.5.200", org.eclipse.ui.navigator.resources;bundle-version="3.4.400", @@ -50,7 +51,7 @@ Export-Package: org.eclipse.sirius.diagram.description.concern.provider;version= org.eclipse.sirius.diagram.description.provider;version="2.2.0", org.eclipse.sirius.diagram.description.style.provider;version="2.3.0", org.eclipse.sirius.diagram.description.tool.provider;version="3.0.0", - org.eclipse.sirius.diagram.internal.description.provider, + org.eclipse.sirius.diagram.internal.description.provider;version="4.0.0", org.eclipse.sirius.diagram.provider;version="4.0.0", org.eclipse.sirius.diagram.ui.business.api.helper.graphicalfilters;version="2.0.4", org.eclipse.sirius.diagram.ui.business.api.image;version="2.0.4", @@ -111,6 +112,7 @@ Export-Package: org.eclipse.sirius.diagram.description.concern.provider;version= org.eclipse.sirius.diagram.ui.tools.api.figure;version="3.2.0", org.eclipse.sirius.diagram.ui.tools.api.figure.anchor;version="2.0.4", org.eclipse.sirius.diagram.ui.tools.api.figure.locator;version="3.0.0", + org.eclipse.sirius.diagram.ui.tools.api.format;version="4.1.0", org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.palette;version="2.0.4", org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles;version="2.0.4", org.eclipse.sirius.diagram.ui.tools.api.image;version="3.0.0", @@ -160,6 +162,9 @@ Export-Package: org.eclipse.sirius.diagram.description.concern.provider;version= org.eclipse.sirius.diagram.ui.tools.internal.figure.util;version="2.1.0";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.filter;version="3.0.0";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.find;version="2.0.4";x-internal:=true, + org.eclipse.sirius.diagram.ui.tools.internal.format;version="4.1.0";x-internal:=true, + org.eclipse.sirius.diagram.ui.tools.internal.format.data.extension;version="4.1.0";x-internal:=true, + org.eclipse.sirius.diagram.ui.tools.internal.format.semantic;version="4.1.0";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.graphical.edit.handles;version="2.0.4";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.graphical.edit.part;version="2.0.4";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.graphical.edit.policies;version="2.1.0";x-internal:=true, @@ -167,7 +172,6 @@ Export-Package: org.eclipse.sirius.diagram.description.concern.provider;version= org.eclipse.sirius.diagram.ui.tools.internal.handler;version="2.0.4";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.layout;version="2.0.4";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.layout.data.extension;version="2.0.4";x-internal:=true, - org.eclipse.sirius.diagram.ui.tools.internal.layout.diagram;version="2.0.4";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.layout.ordering;version="2.0.4";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.layout.provider;version="2.1.0";x-internal:=true, org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic;version="2.0.4";x-internal:=true, diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties index 522ad9e01d..2d51e0c58d 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties @@ -83,6 +83,7 @@ command.unpinElements.name = Unpin elements command.validateDiagram.label = Validate diagram command.validateDiagram.name = Validate Diagram extension-point.diagramIdentifierProvider.name = org.eclipse.sirius.diagram.ui.diagramIdentifierProvider +extension-point.formatDataManager.name = org.eclipse.sirius.diagram.ui.formatDataManager extension-point.imageSelector.name = org.eclipse.sirius.diagram.ui.imageSelector extension-point.layoutDataManager.name = org.eclipse.sirius.diagram.ui.layoutDataManager extension-point.layoutProvider.name = org.eclipse.sirius.diagram.ui.layoutProvider @@ -829,6 +830,7 @@ DEdgeCreateCommand_executionErrorMsg = Invalid arguments in create link command DEdgeLabelItemProvider_label = label DNodeContainerViewNodeContainerCompartment2EditPart_title=ViewNodeContainerCompartment DNodeContainerViewNodeContainerCompartmentEditPart_title=ViewNodeContainerCompartment +DNodeFormatDataKey_wrongKeyMsg = The key uses to store this format data can only be an AbstractDNode or a DDiagram. DNodeLayoutDataKey_wrongKeyMsg = The key uses to store this layout data can only be an AbstractDNode or a DDiagram. DNodeListViewNodeListCompartment2EditPart_title=ViewNodeListCompartment DNodeListViewNodeListCompartmentEditPart_title=ViewNodeListCompartment @@ -922,6 +924,9 @@ FiltersPropertySection_removeButtonLabel = < Remove FiltersTableViewer_columnName = Filter FontPropertySection_strikeThrough = StrikeThrough FontPropertySection_underline = Underline +FormatData_illegalTarget = The target of a FormatData can only be an AbstractDNode, a DEdge or a DDiagram. +FormatData_unhandledDiagramElementKind = This kind of diagram element ({0}) is not yet managed by the FormatDataManager. +FormatDataHelperImpl_unkownFormatData = Formatdata of type {0} is unknown GMFCommandWrapper_label = GMF Command Wrapper GMFCommandWrapper_nullCommand = the command is null GMFCommandWrapper_nullDomain = the domain is null diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml index f1d0653e40..d12434f549 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml @@ -17,6 +17,7 @@ <extension-point id="diagramIdentifierProvider" name="%extension-point.diagramIdentifierProvider.name" schema="schema/diagramIdentifierProvider.exsd"/> <extension-point id="layoutProvider" name="%extension-point.layoutProvider.name" schema="schema/layoutProvider.exsd"/> <extension-point id="layoutDataManager" name="%extension-point.layoutDataManager.name" schema="schema/layoutDataManager.exsd"/> + <extension-point id="formatDataManager" name="%extension-point.formatDataManager.name" schema="schema/formatDataManager.exsd"/> <extension-point id="imageSelector" name="%extension-point.imageSelector.name" schema="schema/imageSelector.exsd"/> <extension-point id="tabbarContributor" name="%extension-point.tabbarContributor.name" schema="schema/tabbarContributor.exsd"/> diff --git a/plugins/org.eclipse.sirius.diagram.ui/schema/formatDataManager.exsd b/plugins/org.eclipse.sirius.diagram.ui/schema/formatDataManager.exsd new file mode 100644 index 0000000000..cf9988bf62 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/schema/formatDataManager.exsd @@ -0,0 +1,116 @@ +<?xml version='1.0' encoding='UTF-8'?> +<!-- Schema file written by PDE --> +<schema targetNamespace="org.eclipse.sirius.diagram.ui" xmlns="http://www.w3.org/2001/XMLSchema"> +<annotation> + <appInfo> + <meta.schema plugin="org.eclipse.sirius.diagram.ui" id="formatDataManager" name="org.eclipse.sirius.diagram.ui.formatDataManager"/> + </appInfo> + <documentation> + Extension point to provide new format data managers for "Copy Format" and "Paste Format/Layout/Style" actions. + </documentation> + </annotation> + + <element name="extension"> + <annotation> + <appInfo> + <meta.element /> + </appInfo> + </annotation> + <complexType> + <sequence> + <element ref="formatDataManagerProvider" minOccurs="1" maxOccurs="unbounded"/> + </sequence> + <attribute name="point" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="id" type="string"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="name" type="string"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute translatable="true"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <element name="formatDataManagerProvider"> + <complexType> + <attribute name="id" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + </annotation> + </attribute> + <attribute name="class" type="string" use="required"> + <annotation> + <documentation> + + </documentation> + <appInfo> + <meta.attribute kind="java" basedOn=":org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider"/> + </appInfo> + </annotation> + </attribute> + </complexType> + </element> + + <annotation> + <appInfo> + <meta.section type="since"/> + </appInfo> + <documentation> + Sirius 4.1.0 (replace the deprecated org.eclipse.sirius.diagram.ui.layoutDataManager). + </documentation> + </annotation> + + <annotation> + <appInfo> + <meta.section type="examples"/> + </appInfo> + <documentation> + The following is an example of a specific format data manager extension: +<p> +<pre> + <extension + point="org.eclipse.sirius.diagram.ui.formatDataManager"> + <formatDataManagerProvider + class="com.example.xyz.FormatDataManagerXYZ" + id="com.example.xyz.formatDataManagerXYZ"> + </formatDataManagerProvider> + </extension> +</pre> +</p> + </documentation> + </annotation> + + + + <annotation> + <appInfo> + <meta.section type="copyright"/> + </appInfo> + <documentation> + Copyright (c) 2016 THALES GLOBAL SERVICES<br> +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 +<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> + </documentation> + </annotation> + +</schema> diff --git a/plugins/org.eclipse.sirius.diagram.ui/schema/layoutDataManager.exsd b/plugins/org.eclipse.sirius.diagram.ui/schema/layoutDataManager.exsd index 94ffce0ff9..6913a55d92 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/schema/layoutDataManager.exsd +++ b/plugins/org.eclipse.sirius.diagram.ui/schema/layoutDataManager.exsd @@ -7,6 +7,7 @@ </appInfo> <documentation> Extension point to provide new layout data managers for "Copy Layout" and "Paste Layout" actions. +Deprecated since Sirius 4.1.0. Use org.eclipse.sirius.diagram.ui.formatDataManager instead. </documentation> </annotation> @@ -74,7 +75,7 @@ <meta.section type="since"/> </appInfo> <documentation> - 4.1 + Sirius 0.9 </documentation> </annotation> @@ -104,14 +105,13 @@ <appInfo> <meta.section type="copyright"/> </appInfo> - <documentation> + <documentation> Copyright (c) 2007, 2011 THALES GLOBAL SERVICES<br> 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 <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> </documentation> - </annotation> </schema> diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/AbstractSiriusFormatDataManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/AbstractSiriusFormatDataManager.java new file mode 100644 index 0000000000..4fecd0eb94 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/AbstractSiriusFormatDataManager.java @@ -0,0 +1,1060 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.ui.tools.api.format; + +import java.text.MessageFormat; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; + +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gef.ConnectionEditPart; +import org.eclipse.gef.EditPartViewer; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.core.util.ViewRefactorHelper; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.Bendpoints; +import org.eclipse.gmf.runtime.notation.Bounds; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.IdentityAnchor; +import org.eclipse.gmf.runtime.notation.JumpLinkStatus; +import org.eclipse.gmf.runtime.notation.JumpLinkType; +import org.eclipse.gmf.runtime.notation.Location; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.NotationFactory; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.RelativeBendpoints; +import org.eclipse.gmf.runtime.notation.Routing; +import org.eclipse.gmf.runtime.notation.RoutingStyle; +import org.eclipse.gmf.runtime.notation.Smoothness; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; +import org.eclipse.sirius.common.tools.api.util.StringUtil; +import org.eclipse.sirius.diagram.AbstractDNode; +import org.eclipse.sirius.diagram.ContainerStyle; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DDiagramElement; +import org.eclipse.sirius.diagram.DDiagramElementContainer; +import org.eclipse.sirius.diagram.DEdge; +import org.eclipse.sirius.diagram.DNode; +import org.eclipse.sirius.diagram.DNodeContainer; +import org.eclipse.sirius.diagram.DNodeList; +import org.eclipse.sirius.diagram.DNodeListElement; +import org.eclipse.sirius.diagram.DiagramPlugin; +import org.eclipse.sirius.diagram.EdgeStyle; +import org.eclipse.sirius.diagram.EdgeTarget; +import org.eclipse.sirius.diagram.NodeStyle; +import org.eclipse.sirius.diagram.business.api.query.DDiagramElementQuery; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.diagram.formatdata.EdgeFormatData; +import org.eclipse.sirius.diagram.formatdata.FormatdataFactory; +import org.eclipse.sirius.diagram.formatdata.FormatdataPackage; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; +import org.eclipse.sirius.diagram.formatdata.Point; +import org.eclipse.sirius.diagram.ui.business.api.query.NodeQuery; +import org.eclipse.sirius.diagram.ui.business.api.view.SiriusGMFHelper; +import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramBorderNodeEditPart; +import org.eclipse.sirius.diagram.ui.internal.operation.CenterEdgeEndModelChangeOperation; +import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper; +import org.eclipse.sirius.diagram.ui.internal.refresh.borderednode.CanonicalDBorderItemLocator; +import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.graphical.edit.styles.IBorderItemOffsets; +import org.eclipse.sirius.ext.draw2d.figure.FigureUtilities; +import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.Style; +import org.eclipse.sirius.viewpoint.ViewpointPackage; + +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +/** + * An abstract implementation for {@link SiriusFormatDataManager}. <BR> + * Provide a method to store a format from a graphicalEditPart and iterates on + * it's children. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * + */ +public abstract class AbstractSiriusFormatDataManager implements SiriusFormatDataManager { + + private static final Class<?>[] CLASS_EXCEPTIONS = new Class[] { DNodeListElement.class }; + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#storeFormatData(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) + */ + @Override + public void storeFormatData(final IGraphicalEditPart rootEditPart) { + final Collection<FormatDataKey> discoveredKeys = Sets.newHashSet(); + final EObject semanticElement = rootEditPart.resolveSemanticElement(); + final View toStoreView = (View) rootEditPart.getModel(); + if (toStoreView instanceof Edge && semanticElement instanceof DEdge) { + addEdgeFormatData(null, (DEdge) semanticElement, rootEditPart.getRoot().getViewer()); + } else if (toStoreView instanceof Diagram && semanticElement instanceof DDiagram) { + addChildFormat((DDiagram) semanticElement, rootEditPart, discoveredKeys); + } else if (toStoreView instanceof Node) { + if (semanticElement instanceof DDiagramElement && semanticElement instanceof DSemanticDecorator) { + addChildFormat(null, (DSemanticDecorator) semanticElement, (Node) toStoreView, rootEditPart, discoveredKeys); + } + } + discoveredKeys.clear(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#applyFormat(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart, + * org.eclipse.gef.EditPartViewer) + */ + @Override + public void applyFormat(final IGraphicalEditPart rootEditPart) { + applyFormat(rootEditPart, true, true); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#applyFormat(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart, + * org.eclipse.gef.EditPartViewer) + */ + @Override + public void applyLayout(final IGraphicalEditPart rootEditPart) { + applyFormat(rootEditPart, true, false); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#applyStyle(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart, + * org.eclipse.gef.EditPartViewer) + */ + @Override + public void applyStyle(final IGraphicalEditPart rootEditPart) { + applyFormat(rootEditPart, false, true); + } + + /** + * Apply the format to the <code>rootEditPart</code>. + * + * @param rootEditPart + * The root edit from which we would try to apply the current + * stored format + * @param applyFormat + * true if the format must be applied, false otherwise + * @param applyStyle + * true if the style must be applied, false otherwise + */ + protected void applyFormat(final IGraphicalEditPart rootEditPart, boolean applyFormat, boolean applyStyle) { + final EObject semanticElement = rootEditPart.resolveSemanticElement(); + final View toStoreView = (View) rootEditPart.getModel(); + if (toStoreView instanceof Edge) { + // Currently not managed... + } else if (toStoreView instanceof Diagram && semanticElement instanceof DDiagram) { + applyFormat((DDiagram) semanticElement, (Diagram) toStoreView, rootEditPart.getRoot().getViewer(), applyFormat, applyStyle); + centerEdgesEnds(toStoreView); + } else if (toStoreView instanceof Node) { + if (semanticElement instanceof DDiagramElement && semanticElement instanceof DSemanticDecorator) { + applyFormat((DSemanticDecorator) semanticElement, (Node) toStoreView, rootEditPart.getRoot().getViewer(), null, applyFormat, applyStyle); + } + centerEdgesEnds(toStoreView); + } + } + + @SuppressWarnings("unchecked") + private void centerEdgesEnds(View view) { + Set<Edge> edges = new HashSet<Edge>(); + if (view instanceof Diagram) { + edges.addAll(((Diagram) view).getEdges()); + } else { + ViewUtil.getAllRelatedEdgesForView(view, edges); + } + for (Edge edge : edges) { + CenterEdgeEndModelChangeOperation centerEdgeEndModelChangeOperation = new CenterEdgeEndModelChangeOperation(edge, false); + centerEdgeEndModelChangeOperation.execute(); + } + + } + + /** + * @param semanticDecorator + * @param toStoreView + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + */ + private void applyFormat(final DDiagram diagram, final Diagram toStoreView, final EditPartViewer editPartViewer, boolean applyFormat, boolean applyStyle) { + // We don't apply format on diagram but only on its node children (the + // edge is applied during source node). + for (final AbstractDNode node : Iterables.filter(diagram.getOwnedDiagramElements(), AbstractDNode.class)) { + final Node gmfNode = SiriusGMFHelper.getGmfNode(node); + if (gmfNode != null) { + applyFormat(node, gmfNode, editPartViewer, null, applyFormat, applyStyle); + } + } + } + + /** + * @param sourceNode + * @param editPartViewer + */ + private void applyFormatToOutgoingEdge(final EdgeTarget sourceNode, final EditPartViewer editPartViewer, boolean applyFormat, boolean applyStyle) { + for (final DEdge edge : sourceNode.getOutgoingEdges()) { + final Edge gmfEdge = SiriusGMFHelper.getGmfEdge(edge); + if (gmfEdge != null) { + applyFormat(edge, gmfEdge, editPartViewer, applyFormat, applyStyle); + } + } + } + + /** + * @param edge + * @param gmfEdge + * @param editPartViewer + */ + private void applyFormat(final DEdge edge, final Edge gmfEdge, final EditPartViewer editPartViewer, boolean applyFormat, boolean applyStyle) { + final EdgeFormatData formatData = (EdgeFormatData) getFormatData(createKey(edge)); + if (formatData != null) { + if (applyFormat) { + final Bendpoints bendpoints = convertPointsToGMFBendpoint(formatData); + gmfEdge.setBendpoints(bendpoints); + + if (formatData.getSourceTerminal() != null) { + if (gmfEdge.getSourceAnchor() == null) { + gmfEdge.setSourceAnchor(NotationFactory.eINSTANCE.createIdentityAnchor()); + } + if (gmfEdge.getSourceAnchor() instanceof IdentityAnchor) { + ((IdentityAnchor) gmfEdge.getSourceAnchor()).setId(formatData.getSourceTerminal()); + } + } else if (gmfEdge.getSourceAnchor() instanceof IdentityAnchor) { + gmfEdge.setSourceAnchor(null); + } + if (formatData.getTargetTerminal() != null) { + if (gmfEdge.getTargetAnchor() == null) { + gmfEdge.setTargetAnchor(NotationFactory.eINSTANCE.createIdentityAnchor()); + } + if (gmfEdge.getTargetAnchor() instanceof IdentityAnchor) { + ((IdentityAnchor) gmfEdge.getTargetAnchor()).setId(formatData.getTargetTerminal()); + } + } else if (gmfEdge.getTargetAnchor() instanceof IdentityAnchor) { + gmfEdge.setTargetAnchor(null); + } + final RoutingStyle routingStyle = (RoutingStyle) gmfEdge.getStyle(NotationPackage.eINSTANCE.getRoutingStyle()); + if (routingStyle != null) { + routingStyle.setRouting(Routing.get(formatData.getRouting())); + routingStyle.setJumpLinkStatus(JumpLinkStatus.get(formatData.getJumpLinkStatus())); + routingStyle.setJumpLinkType(JumpLinkType.get(formatData.getJumpLinkType())); + routingStyle.setJumpLinksReverse(formatData.isReverseJumpLink()); + routingStyle.setSmoothness(Smoothness.get(formatData.getSmoothness())); + } + } + if (applyStyle) { + // Apply Sirius style properties + applySiriusStyle(edge, formatData); + // Apply GMF style properties + applyGMFStyle(gmfEdge, formatData); + } + + applyLabelFormat(gmfEdge, formatData, applyFormat, applyStyle); + + } + } + + private void applyLabelFormat(final View gmfView, final AbstractFormatData parentFormatData, boolean applyFormat, boolean applyStyle) { + if (parentFormatData != null) { + final Node labelNode = SiriusGMFHelper.getLabelNode(gmfView); + if (parentFormatData.getLabel() != null && labelNode != null) { + if (applyFormat) { + if (!parentFormatData.getLabel().eIsSet(FormatdataPackage.eINSTANCE.getNodeFormatData_Width()) + && !parentFormatData.getLabel().eIsSet(FormatdataPackage.eINSTANCE.getNodeFormatData_Height())) { + Location location = NotationFactory.eINSTANCE.createLocation(); + location.setX(parentFormatData.getLabel().getLocation().getX()); + location.setY(parentFormatData.getLabel().getLocation().getY()); + labelNode.setLayoutConstraint(location); + } else { + Bounds bounds = NotationFactory.eINSTANCE.createBounds(); + bounds.setX(parentFormatData.getLabel().getLocation().getX()); + bounds.setY(parentFormatData.getLabel().getLocation().getY()); + bounds.setWidth(parentFormatData.getLabel().getWidth()); + bounds.setHeight(parentFormatData.getLabel().getHeight()); + labelNode.setLayoutConstraint(bounds); + } + } + if (applyStyle) { + // Apply GMF style properties + applyGMFStyle(labelNode, parentFormatData.getLabel()); + } + } + } + } + + /** + * @param edgeFormatData + * The format data of the edge + * @return + */ + private Bendpoints convertPointsToGMFBendpoint(final EdgeFormatData edgeFormatData) { + final RelativeBendpoints result = NotationFactory.eINSTANCE.createRelativeBendpoints(); + + final List<RelativeBendpoint> relativeBendpoints = new LinkedList<RelativeBendpoint>(); + + final Point source = edgeFormatData.getSourceRefPoint(); + final Point target = edgeFormatData.getTargetRefPoint(); + + /* source and target may be null if edit part was not created */ + if (source != null && target != null) { + final org.eclipse.draw2d.geometry.Point sourceRefPoint = new org.eclipse.draw2d.geometry.Point(source.getX(), source.getY()); + final org.eclipse.draw2d.geometry.Point targetRefPoint = new org.eclipse.draw2d.geometry.Point(target.getX(), target.getY()); + + for (final Point point : edgeFormatData.getPointList()) { + final org.eclipse.draw2d.geometry.Point tempPoint = new org.eclipse.draw2d.geometry.Point(point.getX(), point.getY()); + final Dimension s = tempPoint.getDifference(sourceRefPoint); + final Dimension t = tempPoint.getDifference(targetRefPoint); + relativeBendpoints.add(new RelativeBendpoint(s.width, s.height, t.width, t.height)); + } + } + result.setPoints(relativeBendpoints); + + return result; + } + + /** + * Search a format corresponding to the semantic decorator and applies it to + * the node. Then it applies to it's children and outgoing edges. + * + * @param semanticDecorator + * The semantic decorator to search the corresponding format + * @param toRestoreView + * Node on which to apply the format + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + * @parentFormatData the format of the parent of <code>toRestoreView<code> + */ + private void applyFormat(final DSemanticDecorator semanticDecorator, final Node toRestoreView, final EditPartViewer editPartViewer, final NodeFormatData parentFormatData, boolean applyFormat, + boolean applyStyle) { + FormatDataKey key = createKey(semanticDecorator); + NodeFormatData formatData = (NodeFormatData) getFormatData(key); + + // If a direct child have the same format data and key than its parents, + // look in the parent format data 's children for a child format data + // with the expected id. + if (parentFormatData != null && parentFormatData == formatData && !StringUtil.isEmpty(key.getId())) { + formatData = null; + for (NodeFormatData childFormatData : parentFormatData.getChildren()) { + // if many children format with same id, a choice will not be + // possible; + if (key.getId().equals(childFormatData.getId())) { + if (formatData == null) { + formatData = childFormatData; + } else { + formatData = null; + break; + } + } + } + } + + if (formatData != null && applyFormat) { + + final Bounds bounds = NotationFactory.eINSTANCE.createBounds(); + final IGraphicalEditPart graphicalEditPart = (IGraphicalEditPart) editPartViewer.getEditPartRegistry().get(toRestoreView); + Point locationToApply; + boolean isCollapsed = false; + if (graphicalEditPart instanceof AbstractDiagramBorderNodeEditPart) { + // Specific treatment for border node + // Compute absolute location + locationToApply = FormatDataHelper.INSTANCE.getAbsoluteLocation(formatData); + // Compute the best location according to other existing + // bordered nodes. + Node parentNode = (Node) toRestoreView.eContainer(); + CanonicalDBorderItemLocator locator = new CanonicalDBorderItemLocator(parentNode, PositionConstants.NSEW); + if (semanticDecorator instanceof DDiagramElement) { + if (new DDiagramElementQuery((DDiagramElement) semanticDecorator).isIndirectlyCollapsed()) { + isCollapsed = true; + locator.setBorderItemOffset(IBorderItemOffsets.COLLAPSE_FILTER_OFFSET); + } else { + locator.setBorderItemOffset(IBorderItemOffsets.DEFAULT_OFFSET); + } + } else { + locator.setBorderItemOffset(IBorderItemOffsets.DEFAULT_OFFSET); + } + final Rectangle rect = new Rectangle(locationToApply.getX(), locationToApply.getY(), formatData.getWidth(), formatData.getHeight()); + final org.eclipse.draw2d.geometry.Point realLocation = locator.getValidLocation(rect, toRestoreView, Lists.newArrayList(toRestoreView)); + // Compute the new relative position to the parent + final org.eclipse.draw2d.geometry.Point parentAbsoluteLocation = ((IGraphicalEditPart) graphicalEditPart.getParent()).getFigure().getBounds().getTopLeft().getCopy(); + FigureUtilities.translateToAbsoluteByIgnoringScrollbar(((IGraphicalEditPart) graphicalEditPart.getParent()).getFigure(), parentAbsoluteLocation); + locationToApply.setX(realLocation.x); + locationToApply.setY(realLocation.y); + locationToApply = FormatDataHelper.INSTANCE.getTranslated(locationToApply, parentAbsoluteLocation.negate()); + } else { + locationToApply = FormatDataHelper.INSTANCE.getRelativeLocation(formatData, graphicalEditPart); + + // Apply the location to the figure to, to correctly compute + // the relative location of the children + graphicalEditPart.getFigure().setLocation(new org.eclipse.draw2d.geometry.Point(locationToApply.getX(), locationToApply.getY())); + } + bounds.setX(locationToApply.getX()); + bounds.setY(locationToApply.getY()); + if (isCollapsed) { + Dimension dim = new NodeQuery(toRestoreView).getCollapsedSize(); + bounds.setHeight(dim.height); + bounds.setWidth(dim.width); + } else { + bounds.setHeight(formatData.getHeight()); + bounds.setWidth(formatData.getWidth()); + } + toRestoreView.setLayoutConstraint(bounds); + } + if (formatData != null && applyStyle) { + // Apply Sirius style properties + applySiriusStyle(semanticDecorator, formatData); + // Apply GMF style properties + applyGMFStyle(toRestoreView, formatData); + } + + if (semanticDecorator instanceof DNode) { + applyFormatToNodeChildren((DNode) semanticDecorator, editPartViewer, formatData, applyFormat, applyStyle); + } else if (semanticDecorator instanceof DNodeContainer) { + applyFormatToNodeContainerChildren((DNodeContainer) semanticDecorator, editPartViewer, formatData, applyFormat, applyStyle); + } else if (semanticDecorator instanceof DNodeList) { + applyFormatToNodeListChildren((DNodeList) semanticDecorator, editPartViewer, formatData, applyFormat, applyStyle); + } else { + logWarnMessage(semanticDecorator); + } + // Deal with the outgoing edges + if (semanticDecorator instanceof EdgeTarget) { + applyFormatToOutgoingEdge((EdgeTarget) semanticDecorator, editPartViewer, applyFormat, applyStyle); + } + } + + /** + * Apply the Sirius style contained in <code>formatData</code> on the + * <code>semanticDecorator</code>. + * + * @param semanticDecorator + * The {@link DSemanticDecorator} on which to apply the style. + * @param formatData + * The format data containing the sirius style + */ + protected void applySiriusStyle(DSemanticDecorator semanticDecorator, AbstractFormatData formatData) { + // Make a copy of the style to allow several Paste with the same + // FormatData. + Style copyOfSiriusStyle = EcoreUtil.copy(formatData.getSiriusStyle()); + if ((semanticDecorator instanceof DNode || semanticDecorator instanceof DNodeListElement) && copyOfSiriusStyle instanceof NodeStyle) { + if (semanticDecorator instanceof DNode) { + computeCustomFeatures(((DNode) semanticDecorator).getOwnedStyle(), copyOfSiriusStyle); + ((DNode) semanticDecorator).setOwnedStyle((NodeStyle) copyOfSiriusStyle); + } else { + computeCustomFeatures(((DNodeListElement) semanticDecorator).getOwnedStyle(), copyOfSiriusStyle); + ((DNodeListElement) semanticDecorator).setOwnedStyle((NodeStyle) copyOfSiriusStyle); + } + } else if (semanticDecorator instanceof DDiagramElementContainer && copyOfSiriusStyle instanceof ContainerStyle) { + computeCustomFeatures(((DDiagramElementContainer) semanticDecorator).getOwnedStyle(), copyOfSiriusStyle); + ((DDiagramElementContainer) semanticDecorator).setOwnedStyle((ContainerStyle) copyOfSiriusStyle); + } else if (semanticDecorator instanceof DEdge && copyOfSiriusStyle instanceof EdgeStyle) { + computeCustomFeatures(((DEdge) semanticDecorator).getOwnedStyle(), copyOfSiriusStyle); + ((DEdge) semanticDecorator).setOwnedStyle((EdgeStyle) copyOfSiriusStyle); + } + } + + /** + * Copies the appearance of the old view to the new view. Typically this + * means copying the visibility and the styles of the root and it's + * children. + * + * @param newView + * The new view to copy style features to + * @param formatData + * The format data containing the old view to copy style features + * from + */ + @SuppressWarnings("unchecked") + protected void applyGMFStyle(View newView, AbstractFormatData formatData) { + if (newView != null && formatData.getGmfView() != null) { + @SuppressWarnings("rawtypes") + List excludedStyles = Lists.newArrayList(); + if (newView instanceof Edge) { + // The style of RoutingStyle class is considered as format + // properties. So they have already been pasted during paste + // format. + excludedStyles.add(NotationPackage.eINSTANCE.getRoutingStyle()); + } + new ViewRefactorHelper().copyViewAppearance(formatData.getGmfView(), newView, excludedStyles); + } + } + + private void logWarnMessage(final DSemanticDecorator semanticDecorator) { + final Class<?> clazz = semanticDecorator.getClass(); + + boolean logWarn = true; + for (final Class<?> exceptionClass : CLASS_EXCEPTIONS) { + if (exceptionClass.isAssignableFrom(clazz)) { + logWarn = false; + break; + } + } + + if (logWarn) { + DiagramPlugin.getDefault().logWarning(MessageFormat.format(Messages.AbstractSiriusLayoutDataManager_unhandledDiagramElementKind, semanticDecorator.getClass().getName())); + } + } + + /** + * Try to apply a format to the children of the {@link DNode}. + * + * @param parentNode + * The parent containing children to apply format on. + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + */ + private void applyFormatToNodeChildren(final DNode parentNode, final EditPartViewer editPartViewer, final NodeFormatData formatData, boolean applyFormat, boolean applyStyle) { + // Restore Bordered nodes + applyFormatForBorderedNodes(parentNode.getOwnedBorderedNodes(), editPartViewer, formatData, applyFormat, applyStyle); + // Restore label + final Node gmfNode = SiriusGMFHelper.getGmfNode(parentNode); + applyLabelFormat(gmfNode, formatData, applyFormat, applyStyle); + } + + /** + * Try to apply a format to the children of the {@link DNodeContainer}. + * + * @param container + * The parent containing children to apply format on. + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + */ + private void applyFormatToNodeContainerChildren(final DNodeContainer container, final EditPartViewer editPartViewer, final NodeFormatData formatData, boolean applyFormat, boolean applyStyle) { + // Restore children + for (final DDiagramElement child : container.getOwnedDiagramElements()) { + if (child instanceof AbstractDNode) { + // Search the GMF node corresponding to the child + final Node gmfNode = SiriusGMFHelper.getGmfNode(child); + if (gmfNode != null) { + applyFormat(child, gmfNode, editPartViewer, formatData, applyFormat, applyStyle); + } + } + } + // Restore Bordered nodes + applyFormatForBorderedNodes(container.getOwnedBorderedNodes(), editPartViewer, formatData, applyFormat, applyStyle); + // Restore label + final Node gmfNode = SiriusGMFHelper.getGmfNode(container); + applyLabelFormat(gmfNode, formatData, applyFormat, applyStyle); + } + + /** + * Try to apply the format to the bordered nodes. + * + * @param borderedNodes + * The list of bordered nodes to deals with + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + * @param parentFormatData + * The formatData of the parent of the borderedNodes + */ + private void applyFormatForBorderedNodes(EList<DNode> borderedNodes, EditPartViewer editPartViewer, NodeFormatData parentFormatData, boolean applyFormat, boolean applyStyle) { + HashMap<Node, NodeFormatData> nodesWithFormatDataToApply = Maps.newHashMap(); + HashMap<Node, DSemanticDecorator> nodesWithCoresspondingDSemanticDecorator = Maps.newHashMap(); + // Search each bordered nodes that have formatData to apply + for (final DNode child : borderedNodes) { + // Search the GMF node corresponding to the child + final Node gmfNode = SiriusGMFHelper.getGmfNode(child); + if (gmfNode != null) { + FormatDataKey key = createKey(child); + NodeFormatData formatData = (NodeFormatData) getFormatData(key); + + // If a direct child have the same format data and key than its + // parents, look in the parent format data 's children for a + // child format data with the expected id. + if (parentFormatData != null && parentFormatData == formatData && !StringUtil.isEmpty(key.getId())) { + formatData = null; + for (NodeFormatData childFormatData : parentFormatData.getChildren()) { + // if many children format with same id, a choice will + // not be possible + if (key.getId().equals(childFormatData.getId())) { + if (formatData == null) { + formatData = childFormatData; + } else { + formatData = null; + break; + } + } + } + } + if (formatData != null) { + nodesWithFormatDataToApply.put(gmfNode, formatData); + nodesWithCoresspondingDSemanticDecorator.put(gmfNode, child); + } + } + } + // Iterate over each bordered nodes which have format data to apply to + Set<Node> toIgnore = nodesWithFormatDataToApply.keySet(); + for (Entry<Node, NodeFormatData> entry : nodesWithFormatDataToApply.entrySet()) { + Node node = entry.getKey(); + applyFormatForBorderedNode(nodesWithCoresspondingDSemanticDecorator.get(node), node, editPartViewer, entry.getValue(), toIgnore, applyFormat, applyStyle); + } + } + + /** + * Try to apply the format to a bordered node. + * + * @param semanticDecorator + * The semantic decorator associated with this Node + * @param toRestoreView + * Node on which to apply the format + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + * @param formatData + * the format to apply on <code>toRestoreView<code> + * @param portsNodesToIgnore + * The list of bordered nodes to ignore in the conflict detection + */ + private void applyFormatForBorderedNode(final DSemanticDecorator semanticDecorator, final Node toRestoreView, final EditPartViewer editPartViewer, final NodeFormatData formatData, + final Set<Node> portsNodesToIgnore, boolean applyFormat, boolean applyStyle) { + if (applyFormat) { + final Bounds bounds = NotationFactory.eINSTANCE.createBounds(); + Point locationToApply; + boolean isCollapsed = false; + if (!(toRestoreView.eContainer() instanceof Node)) { + return; + } + Node parentNode = (Node) toRestoreView.eContainer(); + + Object parentGraphicalEditPart = editPartViewer.getEditPartRegistry().get(parentNode); + NodeQuery nodeQuery = new NodeQuery(toRestoreView); + + if (nodeQuery.isBorderedNode() && parentGraphicalEditPart instanceof IGraphicalEditPart) { + // Specific treatment for border node + // Compute absolute location + locationToApply = FormatDataHelper.INSTANCE.getAbsoluteLocation(formatData); + // Compute the best location according to other existing + // bordered nodes. + + CanonicalDBorderItemLocator locator = new CanonicalDBorderItemLocator(parentNode, PositionConstants.NSEW); + if (semanticDecorator instanceof DDiagramElement) { + if (new DDiagramElementQuery((DDiagramElement) semanticDecorator).isIndirectlyCollapsed()) { + isCollapsed = true; + locator.setBorderItemOffset(IBorderItemOffsets.COLLAPSE_FILTER_OFFSET); + } else { + locator.setBorderItemOffset(IBorderItemOffsets.DEFAULT_OFFSET); + } + } else { + locator.setBorderItemOffset(IBorderItemOffsets.DEFAULT_OFFSET); + } + + // CanonicalDBorderItemLocator works with absolute GMF parent + // location so we need to translate BorderedNode absolute + // location + // from Draw2D to GMF. + + Point delta = getGMFDraw2DDelta(parentNode, (IGraphicalEditPart) parentGraphicalEditPart); + final Rectangle rect = new Rectangle(locationToApply.getX() - delta.getX(), locationToApply.getY() - delta.getY(), formatData.getWidth(), formatData.getHeight()); + + final org.eclipse.draw2d.geometry.Point realLocation = locator.getValidLocation(rect, toRestoreView, portsNodesToIgnore); + + // Compute the new relative position to the parent + final org.eclipse.draw2d.geometry.Point parentAbsoluteLocation = GMFHelper.getAbsoluteBounds(parentNode).getTopLeft(); + locationToApply.setX(realLocation.x); + locationToApply.setY(realLocation.y); + locationToApply = FormatDataHelper.INSTANCE.getTranslated(locationToApply, parentAbsoluteLocation.negate()); + + } else { + Object graphicalEditPart = editPartViewer.getEditPartRegistry().get(toRestoreView); + if (graphicalEditPart instanceof IGraphicalEditPart) { + locationToApply = FormatDataHelper.INSTANCE.getRelativeLocation(formatData, (IGraphicalEditPart) graphicalEditPart); + // Apply the location to the figure to, to correctly compute + // the relative location of the children + ((GraphicalEditPart) graphicalEditPart).getFigure().setLocation(new org.eclipse.draw2d.geometry.Point(locationToApply.getX(), locationToApply.getY())); + } else { + locationToApply = FormatdataFactory.eINSTANCE.createPoint(); + } + } + bounds.setX(locationToApply.getX()); + bounds.setY(locationToApply.getY()); + if (isCollapsed) { + Dimension dim = new NodeQuery(toRestoreView).getCollapsedSize(); + bounds.setHeight(dim.height); + bounds.setWidth(dim.width); + } else { + bounds.setHeight(formatData.getHeight()); + bounds.setWidth(formatData.getWidth()); + } + + toRestoreView.setLayoutConstraint(bounds); + } + if (applyStyle) { + // Apply Sirius style properties + applySiriusStyle(semanticDecorator, formatData); + // Apply GMF style properties + applyGMFStyle(toRestoreView, formatData); + } + + if (semanticDecorator instanceof DNode) { + applyFormatToNodeChildren((DNode) semanticDecorator, editPartViewer, formatData, applyFormat, applyStyle); + } else if (semanticDecorator instanceof DNodeContainer) { + applyFormatToNodeContainerChildren((DNodeContainer) semanticDecorator, editPartViewer, formatData, applyFormat, applyStyle); + } else if (semanticDecorator instanceof DNodeList) { + applyFormatToNodeListChildren((DNodeList) semanticDecorator, editPartViewer, formatData, applyFormat, applyStyle); + } else { + logWarnMessage(semanticDecorator); + } + if (semanticDecorator instanceof EdgeTarget) { + applyFormatToOutgoingEdge((EdgeTarget) semanticDecorator, editPartViewer, applyFormat, applyStyle); + } + } + + private Point getGMFDraw2DDelta(Node parentNode, IGraphicalEditPart parentEditPart) { + + Point delta = FormatdataFactory.eINSTANCE.createPoint(); + + org.eclipse.draw2d.geometry.Point parentDraw2DAbsoluteLocation = parentEditPart.getFigure().getBounds().getTopLeft().getCopy(); + FigureUtilities.translateToAbsoluteByIgnoringScrollbar(parentEditPart.getFigure(), parentDraw2DAbsoluteLocation); + + org.eclipse.draw2d.geometry.Point parentGMFAbsoluteLocation = GMFHelper.getAbsoluteLocation(parentNode); + delta.setX(parentDraw2DAbsoluteLocation.x - parentGMFAbsoluteLocation.x); + delta.setY(parentDraw2DAbsoluteLocation.y - parentGMFAbsoluteLocation.y); + + return delta; + } + + /** + * Try to apply a format to the children of the {@link DNodeList}. + * + * @param nodeList + * The parent containing children to apply format on. + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + */ + private void applyFormatToNodeListChildren(final DNodeList nodeList, final EditPartViewer editPartViewer, final NodeFormatData formatData, boolean applyFormat, boolean applyStyle) { + // Restore Bordered nodes + applyFormatForBorderedNodes(nodeList.getOwnedBorderedNodes(), editPartViewer, formatData, applyFormat, applyStyle); + + // Restore label + final Node gmfNode = SiriusGMFHelper.getGmfNode(nodeList); + applyLabelFormat(gmfNode, formatData, applyFormat, applyStyle); + } + + /** + * Add the format for the children of a node. + * + * @param parentNode + * The parent of the children + * @param parentFormatData + * The corresponding formatData + * @param parentEditPart + * The editPart corresponding to the parent FormatData + * @param gmfView + * GMF view + * @param discoveredKeys + * The {@link FormatDataKey} discovered during the current store + * action. + */ + protected void addNodeChildren(final DNode parentNode, final NodeFormatData parentFormatData, final IGraphicalEditPart parentEditPart, final View gmfView, + Collection<FormatDataKey> discoveredKeys) { + for (final DNode child : parentNode.getOwnedBorderedNodes()) { + checkDataAndAddChildFormat(parentFormatData, child, parentEditPart, discoveredKeys); + } + // Add the label format data (if exists). + addLabelFormatData(parentFormatData, gmfView); + } + + /** + * Add a format (if we have enough information : GMF view and editPart). + * + * @param parentFormatData + * The parent format data + * @param child + * The child from which we want to add a new format + * @param parentSavedEditPart + * The previous saved editPart (corresponds to parentFormatData) + * @param discoveredKeys + * The {@link FormatDataKey} discovered during the current store + * action. + */ + protected void checkDataAndAddChildFormat(final NodeFormatData parentFormatData, final AbstractDNode child, final IGraphicalEditPart parentSavedEditPart, + Collection<FormatDataKey> discoveredKeys) { + // Search the GMF node corresponding to the child + final Node gmfNode = SiriusGMFHelper.getGmfNode(child); + if (gmfNode != null) { + final IGraphicalEditPart editPart = (IGraphicalEditPart) parentSavedEditPart.getRoot().getViewer().getEditPartRegistry().get(gmfNode); + if (editPart != null) { + addChildFormat(parentFormatData, child, gmfNode, editPart, discoveredKeys); + } + } + } + + /** + * Add children of the node. + * + * @param container + * The parent of the children + * @param parentFormatData + * The corresponding formatData + * @param parentEditPart + * The editPart corresponding to the parent FormatData + * @param discoveredKeys + * The {@link FormatDataKey} discovered during the current store + * action. + */ + protected void addNodeContainerChildren(final DNodeContainer container, final NodeFormatData parentFormatData, final IGraphicalEditPart parentEditPart, Collection<FormatDataKey> discoveredKeys) { + for (final DDiagramElement child : container.getOwnedDiagramElements()) { + if (child instanceof AbstractDNode) { + checkDataAndAddChildFormat(parentFormatData, (AbstractDNode) child, parentEditPart, discoveredKeys); + } + } + for (final DNode child : container.getOwnedBorderedNodes()) { + checkDataAndAddChildFormat(parentFormatData, child, parentEditPart, discoveredKeys); + } + } + + /** + * Add children of the node. + * + * @param nodeList + * The parent of the children + * @param parentFormatData + * The corresponding formatData + * @param parentEditPart + * The editPart corresponding to the parent FormatData + * @param discoveredKeys + * The {@link FormatDataKey} discovered during the current store + * action. + */ + protected void addNodeListChildren(final DNodeList nodeList, final NodeFormatData parentFormatData, final IGraphicalEditPart parentEditPart, Collection<FormatDataKey> discoveredKeys) { + for (final DNode child : nodeList.getOwnedBorderedNodes()) { + checkDataAndAddChildFormat(parentFormatData, child, parentEditPart, discoveredKeys); + } + } + + /** + * Add the child format of the diagram. + * + * @param diagram + * the diagram + * @param editPart + * The viewer responsible for the current editparts lifecycle + */ + private void addChildFormat(final DDiagram diagram, final IGraphicalEditPart diagramEditPart, final Collection<FormatDataKey> discoveredKeys) { + + for (final AbstractDNode child : Iterables.filter(diagram.getOwnedDiagramElements(), AbstractDNode.class)) { + // Search the GMF node corresponding to the child + final Node gmfNode = SiriusGMFHelper.getGmfNode(child); + if (gmfNode != null) { + final IGraphicalEditPart editPart = (IGraphicalEditPart) diagramEditPart.getRoot().getViewer().getEditPartRegistry().get(gmfNode); + if (editPart != null) { + addChildFormat(null, child, gmfNode, editPart, discoveredKeys); + } + } + } + } + + /** + * Add a format. + * + * @param parentFormatData + * The parent format data + * @param child + * The child from which we want to add a new format + * @param gmfNode + * The corresponding GMF node. + * @param editPart + * The editPart corresponding to the new format + */ + private void addChildFormat(final NodeFormatData parentFormatData, final DSemanticDecorator child, final Node gmfNode, final IGraphicalEditPart editPart, + final Collection<FormatDataKey> discoveredKeys) { + final NodeFormatData childFormatData = FormatDataHelper.INSTANCE.createNodeFormatData(gmfNode, editPart, parentFormatData); + if (parentFormatData != null) { + parentFormatData.getChildren().add(childFormatData); + } + + FormatDataKey childKey = createKey(child); + childFormatData.setId(childKey.getId()); + + // If the current node have the same key than than one of the previously + // inspected node, the previously computed data might be replaced. It + // could so replaced one of the initially selected parts. + if (!discoveredKeys.contains(childKey)) { + addFormatData(childKey, childFormatData); + discoveredKeys.add(childKey); + } else if (parentFormatData == null) { + // In this case, the same key is used for a root format data and for + // an other view (child or border of an other view), the root data + // should be stored. + addFormatData(childKey, childFormatData); + } + + if (child instanceof DNode) { + addNodeChildren((DNode) child, childFormatData, editPart, gmfNode, discoveredKeys); + } else if (child instanceof DNodeContainer) { + addNodeContainerChildren((DNodeContainer) child, childFormatData, editPart, discoveredKeys); + } else if (child instanceof DNodeList) { + addNodeListChildren((DNodeList) child, childFormatData, editPart, discoveredKeys); + } else { + logWarnMessage(child); + } + if (child instanceof EdgeTarget) { + addOutgoingEdge(childFormatData, (EdgeTarget) child, editPart.getRoot().getViewer()); + } + } + + /** + * Add outgoing edge of the edgeTarget. + * + * @param parentFormatData + * The parent format data + * @param sourceOfEdge + * The DDiagramElement that is the source of the edge + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + */ + protected void addOutgoingEdge(final NodeFormatData parentFormatData, final EdgeTarget sourceOfEdge, final EditPartViewer editPartViewer) { + for (final DEdge outgoingEdge : sourceOfEdge.getOutgoingEdges()) { + addEdgeFormatData(parentFormatData, outgoingEdge, editPartViewer); + } + } + + /** + * Add edge format data. + * + * @param parentFormatData + * The parent format data + * @param edge + * The DEdge + * @param editPartViewer + * The viewer responsible for the current editparts lifecycle. + */ + protected void addEdgeFormatData(final NodeFormatData parentFormatData, final DEdge edge, final EditPartViewer editPartViewer) { + // Search the GMF edge corresponding to the child + final Edge gmfEdge = SiriusGMFHelper.getGmfEdge(edge); + if (gmfEdge != null) { + final EdgeFormatData edgeFormatData = FormatDataHelper.INSTANCE.createEdgeFormatData(gmfEdge, (ConnectionEditPart) editPartViewer.getEditPartRegistry().get(gmfEdge)); + if (parentFormatData != null) { + parentFormatData.getOutgoingEdges().add(edgeFormatData); + } + + FormatDataKey edgeKey = createKey(edge); + edgeFormatData.setId(edgeKey.getId()); + + // Add the edge format data. + addFormatData(edgeKey, edgeFormatData); + // Add the label format data (if exists). + addLabelFormatData(edgeFormatData, gmfEdge); + } + } + + /** + * Add the format data of the label of the edge. This format data sets the + * <code>edgeLabelFormatData</code> of the {@link EdgeFormatData}. It's not + * added to the format data with a key in the manager. + * + * @param parentFormatData + * The edge format data + * @param element + * The DEdge + * @param gmfElement + * The edge corresponding view + */ + private void addLabelFormatData(final AbstractFormatData parentFormatData, final View gmfElement) { + final Node labelNode = SiriusGMFHelper.getLabelNode(gmfElement); + if (labelNode != null && parentFormatData != null) { + final NodeFormatData labelFormatData = FormatDataHelper.INSTANCE.createLabelFormatData(labelNode); + if (labelNode.getElement() instanceof DSemanticDecorator) { + labelFormatData.setId(createKey((DSemanticDecorator) labelNode.getElement()).getId()); + } + parentFormatData.setLabel(labelFormatData); + } + } + + /** + * Check for each attribute of newStyle if it is the same in oldStyle. On + * the other hand, this attribute is added to the custom features of the + * newStyle. + * + * @param oldStyle + * The old style to compare with + * @param newStyle + * The new style in which to add custom features. + */ + protected void computeCustomFeatures(Style oldStyle, Style newStyle) { + for (EAttribute attribute : newStyle.eClass().getEAllAttributes()) { + if (!ViewpointPackage.Literals.CUSTOMIZABLE__CUSTOM_FEATURES.equals(attribute)) { + EAttribute attributeOfOldStyle = getCorrespondingEAttribute(attribute, oldStyle); + if (attributeOfOldStyle != null) { + if (newStyle.eIsSet(attribute)) { + if (!newStyle.eGet(attribute).equals(oldStyle.eGet(attributeOfOldStyle))) { + newStyle.getCustomFeatures().add(attributeOfOldStyle.getName()); + } + } else if (oldStyle.eIsSet(attributeOfOldStyle)) { + newStyle.getCustomFeatures().add(attributeOfOldStyle.getName()); + } + } + } + } + } + + private EAttribute getCorrespondingEAttribute(EAttribute attribute, Style style) { + EAttribute result = null; + if (style.eClass().getFeatureID(attribute) != -1) { + result = attribute; + } else { + // This attribute does not exist in the style. Check specific + // mapping cases. + EStructuralFeature structuralFeature = style.eClass().getEStructuralFeature(attribute.getName()); + if (structuralFeature instanceof EAttribute) { + result = (EAttribute) structuralFeature; + } else if ("color".equals(attribute.getName())) { //$NON-NLS-1$ + structuralFeature = style.eClass().getEStructuralFeature("backgroundColor"); //$NON-NLS-1$ + if (structuralFeature instanceof EAttribute) { + result = (EAttribute) structuralFeature; + } + } else if ("backgroundColor".equals(attribute.getName())) { //$NON-NLS-1$ + structuralFeature = style.eClass().getEStructuralFeature("color"); //$NON-NLS-1$ + if (structuralFeature instanceof EAttribute) { + result = (EAttribute) structuralFeature; + } + } else if ("width".equals(attribute.getName())) { //$NON-NLS-1$ + structuralFeature = style.eClass().getEStructuralFeature("horizontalDiameter"); //$NON-NLS-1$ + if (structuralFeature instanceof EAttribute) { + result = (EAttribute) structuralFeature; + } + } else if ("horizontalDiameter".equals(attribute.getName())) { //$NON-NLS-1$ + structuralFeature = style.eClass().getEStructuralFeature("width"); //$NON-NLS-1$ + if (structuralFeature instanceof EAttribute) { + result = (EAttribute) structuralFeature; + } + } else if ("height".equals(attribute.getName())) { //$NON-NLS-1$ + structuralFeature = style.eClass().getEStructuralFeature("verticalDiameter"); //$NON-NLS-1$ + if (structuralFeature instanceof EAttribute) { + result = (EAttribute) structuralFeature; + } + } else if ("verticalDiameter".equals(attribute.getName())) { //$NON-NLS-1$ + structuralFeature = style.eClass().getEStructuralFeature("height"); //$NON-NLS-1$ + if (structuralFeature instanceof EAttribute) { + result = (EAttribute) structuralFeature; + } + } + } + return result; + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/FormatDataHelper.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/FormatDataHelper.java new file mode 100644 index 0000000000..39f8ddbfe3 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/FormatDataHelper.java @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.api.format; + +import java.util.Map; + +import org.eclipse.gef.ConnectionEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.diagram.formatdata.EdgeFormatData; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; +import org.eclipse.sirius.diagram.formatdata.Point; +import org.eclipse.sirius.diagram.ui.tools.internal.format.FormatDataHelperImpl; + +/** + * Helper to manage the format data. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public interface FormatDataHelper { + /** + * The singleton instance of the FormatDataHelper. + */ + FormatDataHelper INSTANCE = new FormatDataHelperImpl(); + + /** + * Create a node formatData. + * + * @param gmfNode + * The corresponding GMF view + * @param editPart + * The corresponding editPart + * @param parentFormatData + * The parent format data + * @return a new NodeFormatData + */ + NodeFormatData createNodeFormatData(Node gmfNode, IGraphicalEditPart editPart, NodeFormatData parentFormatData); + + /** + * Create an edge formatData with the information of edge. + * + * @param gmfEdge + * The corresponding GMF view + * @param connectionEditPart + * The corresponding edit part + * @return a new NodeFormatData + */ + EdgeFormatData createEdgeFormatData(Edge gmfEdge, ConnectionEditPart connectionEditPart); + + /** + * Create a label edge formatData with the location of the label (the width + * and height of this {@link NodeFormatData} are not set). + * + * @param labelNode + * the corresponding GMF view. + * @return a new NodeFormatData + */ + NodeFormatData createLabelFormatData(Node labelNode); + + /** + * Compute the absolute location of the <code>nodeFormatData</code>.<BR> + * Add recursively the location of its parent. + * + * @param nodeFormatData + * The concern nodeFormatData + * @return The absolute location + */ + Point getAbsoluteLocation(NodeFormatData nodeFormatData); + + /** + * Compute the relative location of the <code>nodeFormatData</code> to the + * figure of the edit part.<BR> + * + * @param formatData + * The concern nodeFormatData + * @param editPart + * The corresponding edit part + * @return The relative location + */ + Point getRelativeLocation(NodeFormatData formatData, IGraphicalEditPart editPart); + + /** + * Creates a new Point which is translated by the values of the provided + * Point. + * + * @param originalPoint + * The point to translate. + * @param pt + * Point which provides the translation amounts. + * @return A new Point + */ + Point getTranslated(Point originalPoint, org.eclipse.draw2d.geometry.Point pt); + + /** + * Filter collection to get only root format data. + * + * @param collection + * Collection to filter. + * @return Filtered collection. + */ + Map<? extends FormatDataKey, ? extends AbstractFormatData> getRootFormatData(Map<? extends FormatDataKey, ? extends AbstractFormatData> collection); + + /** + * Create key from node format data. + * + * @param formatData + * Format data. + * @return Created key. + */ + FormatDataKey createKey(AbstractFormatData formatData); +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/FormatDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/FormatDataKey.java new file mode 100644 index 0000000000..e487f90b51 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/FormatDataKey.java @@ -0,0 +1,27 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.api.format; + +/** + * Interface for all kind of key use to store formatData ( + * {@link org.eclipse.sirius.diagram.formatdata.AbstractFormatData}. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public interface FormatDataKey { + + /** + * Get the ID of this key. + * + * @return The ID of this key. + */ + String getId(); +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/IFormatDataManagerProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/IFormatDataManagerProvider.java new file mode 100644 index 0000000000..fbf5620271 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/IFormatDataManagerProvider.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.api.format; + +import org.eclipse.sirius.diagram.DDiagram; + +/** + * Interface used be the extension point + * <code>org.eclipse.sirius.diagram.ui.formatDataManager</code> to implements to + * override the default behavior of Copy/Paste format actions. + * + * @author <a href="mailto:maxime.porhel@obeo.fr">Maxime Porhel</a> + */ +public interface IFormatDataManagerProvider { + + /** + * Returns <code>true</code> if this provider provides a specific format + * data manager for the given diagram. + * + * @param diagram + * the current diagram. + * @return <code>true</code> if this provider provides a specific format + * data manager for the given diagram. + */ + boolean provides(DDiagram diagram); + + /** + * Provides its specific format data manager. It will be called once. + * + * @return the extension of the refresh mechanism. + */ + SiriusFormatDataManager getFormatDataManager(); +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/SiriusFormatDataManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/SiriusFormatDataManager.java new file mode 100644 index 0000000000..86e2e8ce6d --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/SiriusFormatDataManager.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.api.format; + +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.viewpoint.DSemanticDecorator; + +/** + * An interface for all the SiriusFormatDataManager for mapping key ( + * {@link FormatDataKey}) and formatData ({@link AbstractFormatData}). + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * + */ +public interface SiriusFormatDataManager { + + /** + * Get the format data corresponding to the key. + * + * @param key + * The key + * @return the format data corresponding to the key or null if not found. + */ + AbstractFormatData getFormatData(final FormatDataKey key); + + /** + * Add a format data according to the key. + * + * @param key + * The key + * @param formatData + * The format data + */ + void addFormatData(final FormatDataKey key, final AbstractFormatData formatData); + + /** + * Create a key corresponding to the semanticDecorator and available for + * this manager. + * + * @param semanticDecorator + * the semantic decorator + * @return a new key corresponding to the semanticDecorator and available + * for this manager. + */ + FormatDataKey createKey(final DSemanticDecorator semanticDecorator); + + /** + * Store the format data for this edit part and all it's children. + * + * @param rootEditPart + * the root of the editParts to store. + */ + void storeFormatData(IGraphicalEditPart rootEditPart); + + /** + * Apply the current format data to the rootEditPart. + * + * @param rootEditPart + * the root edit from which we would try to apply the current + * stored format + */ + void applyFormat(IGraphicalEditPart rootEditPart); + + /** + * Apply the current layout data to the rootEditPart. + * + * @param rootEditPart + * the root edit from which we would try to apply the current + * stored format + */ + void applyLayout(IGraphicalEditPart rootEditPart); + + /** + * Apply the current style data to the rootEditPart. + * + * @param rootEditPart + * the root edit from which we would try to apply the current + * stored style + */ + void applyStyle(IGraphicalEditPart rootEditPart); + + /** + * Check if the manager contains data. + * + * @return true if the manager contains data, false otherwise. + */ + boolean containsData(); + + /** + * Remove all the stored format data. + */ + void clearFormatData(); + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/SiriusFormatDataManagerForSemanticElementsFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/SiriusFormatDataManagerForSemanticElementsFactory.java new file mode 100644 index 0000000000..f1f4fbeb0f --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/format/SiriusFormatDataManagerForSemanticElementsFactory.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.api.format; + +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; + +/** + * A factory to give access to a {@link SiriusFormatDataManager} managed by + * semantic elements. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * + */ +public class SiriusFormatDataManagerForSemanticElementsFactory { + private static final SiriusFormatDataManagerForSemanticElementsFactory INSTANCE = new SiriusFormatDataManagerForSemanticElementsFactory(); + + private static final SiriusFormatDataManagerForSemanticElements SIRIUS_FORMAT_DATA_MANAGER = new SiriusFormatDataManagerForSemanticElements(); + + /** + * gives access to the singleton instance of + * <code>SiriusFormatDataManagerForSemanticElementsFactory</code>. + * + * @return the singleton instance + */ + public static SiriusFormatDataManagerForSemanticElementsFactory getInstance() { + return INSTANCE; + } + + /** + * Get the {@link SiriusFormatDataManager}. + * + * @return an instance of {@link SiriusFormatDataManagerForSemanticElements} + */ + public SiriusFormatDataManager getSiriusFormatDataManager() { + return SIRIUS_FORMAT_DATA_MANAGER; + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/AbstractSiriusLayoutDataManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/AbstractSiriusLayoutDataManager.java index 7e842461ff..481641e62d 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/AbstractSiriusLayoutDataManager.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/AbstractSiriusLayoutDataManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 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 @@ -96,8 +96,12 @@ import com.google.common.collect.Sets; * it's children. * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * @deprecated since Sirius 4.1.0. Use + * {@link org.eclipse.sirius.diagram.ui.tools.api.format.AbstractSiriusFormatDataManager} + * instead. * */ +@Deprecated public abstract class AbstractSiriusLayoutDataManager implements SiriusLayoutDataManager { private static final Class<?>[] CLASS_EXCEPTIONS = new Class[] { DNodeListElement.class }; @@ -172,7 +176,7 @@ public abstract class AbstractSiriusLayoutDataManager implements SiriusLayoutDat final EObject semanticElement = rootEditPart.resolveSemanticElement(); final View toStoreView = (View) rootEditPart.getModel(); if (toStoreView instanceof Edge) { - // TODO LRE : Manage the edge as root ? + // Currently not managed... } else if (toStoreView instanceof Diagram && semanticElement instanceof DDiagram) { applyFormat((DDiagram) semanticElement, (Diagram) toStoreView, rootEditPart.getRoot().getViewer(), applyLayout, applyStyle); centerEdgesEnds(toStoreView); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/ILayoutDataManagerProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/ILayoutDataManagerProvider.java index 925be8965c..85a7ba9a56 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/ILayoutDataManagerProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/ILayoutDataManagerProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011 THALES GLOBAL SERVICES. + * Copyright (c) 2011, 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 @@ -18,7 +18,11 @@ import org.eclipse.sirius.diagram.DDiagram; * override the default behavior of Copy/Paste layout actions. * * @author <a href="mailto:maxime.porhel@obeo.fr">Maxime Porhel</a> + * @deprecated since Sirius 4.1.0. Use + * {@link org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider} + * instead. */ +@Deprecated public interface ILayoutDataManagerProvider { /** diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataHelper.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataHelper.java index a3170d0706..fc1c991c3f 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataHelper.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 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 @@ -26,7 +26,11 @@ import org.eclipse.sirius.diagram.ui.tools.internal.layout.LayoutDataHelperImpl; * Helper to manage the layout data. * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * @deprecated since Sirius 4.1.0. Use + * {@link org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper} + * instead. */ +@Deprecated public interface LayoutDataHelper { /** * The singleton instance of the LayoutDataHelper. diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataKey.java index bc56d6f610..8a127f6e7a 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataKey.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/LayoutDataKey.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 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 @@ -15,7 +15,11 @@ package org.eclipse.sirius.diagram.ui.tools.api.layout; * {@link org.eclipse.sirius.diagram.layoutdata.AbstractLayoutData}. * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * @deprecated since Sirius 4.1.0. Use + * {@link org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey} + * instead. */ +@Deprecated public interface LayoutDataKey { /** diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManager.java index 9a9c7186ae..c6c4efb05b 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManager.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 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 @@ -19,8 +19,11 @@ import org.eclipse.sirius.viewpoint.DSemanticDecorator; * {@link LayoutDataKey}) and layoutData ({@link AbstractLayoutData}). * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> - * + * @deprecated Since Sirius 4.1.0. Use + * {@link org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager} + * instead. */ +@Deprecated public interface SiriusLayoutDataManager { /** diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManagerForSemanticElementsFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManagerForSemanticElementsFactory.java index 2694c90b44..11b32eac41 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManagerForSemanticElementsFactory.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/api/layout/SiriusLayoutDataManagerForSemanticElementsFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2009, 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 @@ -17,8 +17,11 @@ import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SiriusLayout * semantic elements. * * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> - * + * @deprecated Since Sirius 4.1.0. Use + * {@link org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerForSemanticElementsFactory} + * instead. */ +@Deprecated public class SiriusLayoutDataManagerForSemanticElementsFactory { private static final SiriusLayoutDataManagerForSemanticElementsFactory INSTANCE = new SiriusLayoutDataManagerForSemanticElementsFactory(); @@ -37,8 +40,7 @@ public class SiriusLayoutDataManagerForSemanticElementsFactory { /** * Get the {@link SiriusLayoutDataManager}. * - * @return an instance of - * {@link SiriusLayoutDataManagerForSemanticElements} + * @return an instance of {@link SiriusLayoutDataManagerForSemanticElements} */ public SiriusLayoutDataManager getSiriusLayoutDataManager() { return VIEWPOINT_LAYOUT_DATA_MANAGER; diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/CopyFormatAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/CopyFormatAction.java index 6f01a3df5a..e8f27147c0 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/CopyFormatAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/CopyFormatAction.java @@ -33,10 +33,12 @@ import org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart; import org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramNameEditPart; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; import org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl; +import org.eclipse.sirius.diagram.ui.tools.internal.format.data.extension.FormatDataManagerRegistry; import org.eclipse.sirius.diagram.ui.tools.internal.layout.data.extension.LayoutDataManagerRegistry; import org.eclipse.sirius.ext.base.Option; import org.eclipse.swt.SWT; @@ -124,6 +126,9 @@ public class CopyFormatAction extends AbstractCopyPasteFormatAction { */ @Override public void execute() { + for (SiriusFormatDataManager formatDataManager : FormatDataManagerRegistry.getAllSiriusFormatDataManagers()) { + formatDataManager.clearFormatData(); + } for (SiriusLayoutDataManager layoutDataManager : LayoutDataManagerRegistry.getAllSiriusLayoutDataManagers()) { layoutDataManager.clearLayoutData(); } @@ -223,6 +228,9 @@ public class CopyFormatAction extends AbstractCopyPasteFormatAction { @Override protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { + for (SiriusFormatDataManager formatDataManager : FormatDataManagerRegistry.getSiriusFormatDataManagers(dDiagram)) { + formatDataManager.storeFormatData(toStore); + } for (SiriusLayoutDataManager layoutDataManager : LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram)) { layoutDataManager.storeLayoutData(toStore); } @@ -237,6 +245,9 @@ public class CopyFormatAction extends AbstractCopyPasteFormatAction { */ @Override protected IStatus doUndo(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { + for (SiriusFormatDataManager formatDataManager : FormatDataManagerRegistry.getSiriusFormatDataManagers(dDiagram)) { + formatDataManager.clearFormatData(); + } for (SiriusLayoutDataManager layoutDataManager : LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram)) { layoutDataManager.clearLayoutData(); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteFormatAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteFormatAction.java index d95514074d..929d65d41a 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteFormatAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteFormatAction.java @@ -29,10 +29,13 @@ import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerForSemanticElementsFactory; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManagerForSemanticElementsFactory; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; +import org.eclipse.sirius.diagram.ui.tools.internal.format.data.extension.FormatDataManagerRegistry; import org.eclipse.sirius.diagram.ui.tools.internal.layout.data.extension.LayoutDataManagerRegistry; import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry; import org.eclipse.sirius.ext.base.Option; @@ -96,7 +99,8 @@ public class PasteFormatAction extends AbstractCopyPasteFormatAction { @Override protected Command getCommand() { Command pasteFormatCommand = UnexecutableCommand.INSTANCE; - if (SiriusLayoutDataManagerForSemanticElementsFactory.getInstance().getSiriusLayoutDataManager().containsData()) { + if (SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager().containsData() + || SiriusLayoutDataManagerForSemanticElementsFactory.getInstance().getSiriusLayoutDataManager().containsData()) { // Create a compound command to hold the paste commands CompoundCommand doPasteFormatsCmd = new CompoundCommand(Messages.PasteFormatAction_restoreFormatCommandLabel); @@ -161,12 +165,26 @@ public class PasteFormatAction extends AbstractCopyPasteFormatAction { */ @Override protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { - List<SiriusLayoutDataManager> layoutDataManagers = LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram); - - if (!layoutDataManagers.isEmpty()) { - layoutDataManagers.get(0).applyFormat(editPartToRestore); + List<SiriusFormatDataManager> formatDataManagers = FormatDataManagerRegistry.getSiriusFormatDataManagers(dDiagram); + if (!formatDataManagers.isEmpty()) { + boolean deprecatedLayoutManagerUsed = false; + if (formatDataManagers.size() == 1 && SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager().equals(formatDataManagers.get(0))) { + // If there is only the default implementation of + // formatDataManager, we search in deprecated + // layoutDataManager + List<SiriusLayoutDataManager> layoutDataManagers = LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram); + // If there is at least one extension point using the + // deprecated layoutDataManager, the deprecated system is + // used + if (layoutDataManagers.size() > 1) { + deprecatedLayoutManagerUsed = true; + layoutDataManagers.get(0).applyFormat(editPartToRestore); + } + } + if (!deprecatedLayoutManagerUsed) { + formatDataManagers.get(0).applyFormat(editPartToRestore); + } } - return CommandResult.newOKCommandResult(); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteLayoutAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteLayoutAction.java index 3193eae7a2..7567610f51 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteLayoutAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteLayoutAction.java @@ -30,10 +30,13 @@ import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerForSemanticElementsFactory; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManagerForSemanticElementsFactory; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; +import org.eclipse.sirius.diagram.ui.tools.internal.format.data.extension.FormatDataManagerRegistry; import org.eclipse.sirius.diagram.ui.tools.internal.layout.data.extension.LayoutDataManagerRegistry; import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry; import org.eclipse.sirius.ext.base.Option; @@ -95,7 +98,8 @@ public class PasteLayoutAction extends AbstractCopyPasteFormatAction { @Override protected Command getCommand() { Command pasteLayoutCommand = UnexecutableCommand.INSTANCE; - if (SiriusLayoutDataManagerForSemanticElementsFactory.getInstance().getSiriusLayoutDataManager().containsData()) { + if (SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager().containsData() + || SiriusLayoutDataManagerForSemanticElementsFactory.getInstance().getSiriusLayoutDataManager().containsData()) { // Create a compound command to hold the paste commands CompoundCommand doPasteLayoutsCmd = new CompoundCommand(Messages.PasteLayoutAction_restoreLayoutCommandLabel); @@ -160,10 +164,25 @@ public class PasteLayoutAction extends AbstractCopyPasteFormatAction { */ @Override protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { - List<SiriusLayoutDataManager> layoutDataManagers = LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram); - - if (!layoutDataManagers.isEmpty()) { - layoutDataManagers.get(0).applyLayout(editPartToRestore); + List<SiriusFormatDataManager> formatDataManagers = FormatDataManagerRegistry.getSiriusFormatDataManagers(dDiagram); + if (!formatDataManagers.isEmpty()) { + boolean deprecatedLayoutManagerUsed = false; + if (formatDataManagers.size() == 1 && SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager().equals(formatDataManagers.get(0))) { + // If there is only the default implementation of + // formatDataManager, we search in deprecated + // layoutDataManager + List<SiriusLayoutDataManager> layoutDataManagers = LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram); + // If there is at least one extension point using the + // deprecated layoutDataManager, the deprecated system is + // used + if (layoutDataManagers.size() > 1) { + deprecatedLayoutManagerUsed = true; + layoutDataManagers.get(0).applyLayout(editPartToRestore); + } + } + if (!deprecatedLayoutManagerUsed) { + formatDataManagers.get(0).applyLayout(editPartToRestore); + } } return CommandResult.newOKCommandResult(); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteStyleAction.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteStyleAction.java index 005bd24b22..48728c5e0c 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteStyleAction.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/actions/layout/PasteStyleAction.java @@ -29,10 +29,13 @@ import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerForSemanticElementsFactory; import org.eclipse.sirius.diagram.ui.tools.api.image.DiagramImagesPath; import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManagerForSemanticElementsFactory; import org.eclipse.sirius.diagram.ui.tools.api.ui.actions.ActionIds; +import org.eclipse.sirius.diagram.ui.tools.internal.format.data.extension.FormatDataManagerRegistry; import org.eclipse.sirius.diagram.ui.tools.internal.layout.data.extension.LayoutDataManagerRegistry; import org.eclipse.sirius.ecore.extender.business.api.permission.PermissionAuthorityRegistry; import org.eclipse.sirius.ext.base.Option; @@ -94,7 +97,8 @@ public class PasteStyleAction extends AbstractCopyPasteFormatAction { @Override protected Command getCommand() { Command pasteStyleCommand = UnexecutableCommand.INSTANCE; - if (SiriusLayoutDataManagerForSemanticElementsFactory.getInstance().getSiriusLayoutDataManager().containsData()) { + if (SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager().containsData() + || SiriusLayoutDataManagerForSemanticElementsFactory.getInstance().getSiriusLayoutDataManager().containsData()) { // Create a compound command to hold the paste commands CompoundCommand doPasteStylesCmd = new CompoundCommand(Messages.PasteStyleAction_restoreStyleCommandLabel); @@ -158,10 +162,25 @@ public class PasteStyleAction extends AbstractCopyPasteFormatAction { */ @Override protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException { - List<SiriusLayoutDataManager> layoutDataManagers = LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram); - - if (!layoutDataManagers.isEmpty()) { - layoutDataManagers.get(0).applyStyle(editPartToRestore); + List<SiriusFormatDataManager> formatDataManagers = FormatDataManagerRegistry.getSiriusFormatDataManagers(dDiagram); + if (!formatDataManagers.isEmpty()) { + boolean deprecatedLayoutManagerUsed = false; + if (formatDataManagers.size() == 1 && SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager().equals(formatDataManagers.get(0))) { + // If there is only the default implementation of + // formatDataManager, we search in deprecated + // layoutDataManager + List<SiriusLayoutDataManager> layoutDataManagers = LayoutDataManagerRegistry.getSiriusLayoutDataManagers(dDiagram); + // If there is at least one extension point using the + // deprecated layoutDataManager, the deprecated system is + // used + if (layoutDataManagers.size() > 1) { + deprecatedLayoutManagerUsed = true; + layoutDataManagers.get(0).applyStyle(editPartToRestore); + } + } + if (!deprecatedLayoutManagerUsed) { + formatDataManagers.get(0).applyStyle(editPartToRestore); + } } return CommandResult.newOKCommandResult(); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/AdvancedSiriusFormatDataManager.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/AdvancedSiriusFormatDataManager.java new file mode 100644 index 0000000000..d0c6f3af8a --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/AdvancedSiriusFormatDataManager.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.format; + +import java.util.Map; + +import org.eclipse.sirius.diagram.formatdata.EdgeFormatData; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; + +/** + * Interface to manage + * {@link org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager} + * . + * + * @author dlecan + */ +public interface AdvancedSiriusFormatDataManager extends SiriusFormatDataManager { + + /** + * Get only root node format data, that is to say only the format data + * without parent. + * + * @return Map. + */ + Map<? extends FormatDataKey, ? extends NodeFormatData> getRootNodeFormatData(); + + /** + * Get node format data. + * + * @return Map. + */ + Map<? extends NodeFormatDataKey, NodeFormatData> getNodeFormatData(); + + /** + * Get edge format data. + * + * @return Map. + */ + Map<? extends EdgeFormatDataKey, EdgeFormatData> getEdgeFormatData(); + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/EdgeFormatDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/EdgeFormatDataKey.java new file mode 100644 index 0000000000..55b9addb0a --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/EdgeFormatDataKey.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.format; + +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; + +/** + * Interface for all kind of key use to store + * {@link org.eclipse.sirius.diagram.formatdata.EdgeFormatData}. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public interface EdgeFormatDataKey extends FormatDataKey { + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/FormatDataHelperImpl.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/FormatDataHelperImpl.java new file mode 100644 index 0000000000..596c35bdeb --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/FormatDataHelperImpl.java @@ -0,0 +1,358 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.ui.tools.internal.format; + +import java.text.MessageFormat; +import java.util.Map; + +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.PointList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.gef.ConnectionEditPart; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; +import org.eclipse.gmf.runtime.notation.Bounds; +import org.eclipse.gmf.runtime.notation.ConnectorStyle; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.IdentityAnchor; +import org.eclipse.gmf.runtime.notation.LayoutConstraint; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.Size; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.diagram.DDiagramElement; +import org.eclipse.sirius.diagram.business.api.query.DDiagramElementQuery; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.diagram.formatdata.EdgeFormatData; +import org.eclipse.sirius.diagram.formatdata.FormatdataFactory; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; +import org.eclipse.sirius.diagram.formatdata.Point; +import org.eclipse.sirius.diagram.ui.business.api.query.NodeQuery; +import org.eclipse.sirius.diagram.ui.provider.Messages; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticEdgeFormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticNodeFormatDataKey; +import org.eclipse.sirius.ext.base.Option; +import org.eclipse.sirius.ext.draw2d.figure.FigureUtilities; +import org.eclipse.sirius.viewpoint.DStylizable; + +import com.google.common.base.Predicate; +import com.google.common.collect.Maps; + +/** + * Helper to manage the format data. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public class FormatDataHelperImpl implements FormatDataHelper { + + private static final Predicate<EObject> ROOT_PREDICATE = new Predicate<EObject>() { + + /** + * {@inheritDoc} + */ + @Override + public boolean apply(final EObject input) { + return input.eContainer() == null; + } + }; + + /** + * Creates the default FormatDataHelper implementation. + */ + public FormatDataHelperImpl() { + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper#createNodeFormatData(org.eclipse.gmf.runtime.notation.Node, + * org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart, + * org.eclipse.sirius.diagram.formatdata.NodeFormatData) + */ + @Override + public NodeFormatData createNodeFormatData(final Node node, final IGraphicalEditPart editPart, final NodeFormatData parentFormatData) { + final NodeFormatData result = FormatdataFactory.eINSTANCE.createNodeFormatData(); + + Dimension primarySize = new Dimension(0, 0); + // Compute the relative location from the parent format data + // 1-Get the relative location + final org.eclipse.draw2d.geometry.Point relativeLocation = editPart.getFigure().getBounds().getLocation().getCopy(); + + // 2-Transform to absolute location + FigureUtilities.translateToAbsoluteByIgnoringScrollbar(editPart.getFigure(), relativeLocation); + + boolean isCollapsed = false; + if (new DDiagramElementQuery((DDiagramElement) node.getElement()).isIndirectlyCollapsed()) { + isCollapsed = true; + } + if (isCollapsed) { + LayoutConstraint formatConstraint = node.getLayoutConstraint(); + if (formatConstraint instanceof Bounds) { + NodeQuery nodeQuery = new NodeQuery(node); + Option<Bounds> option = nodeQuery.getExtendedBounds(); + if (option.some()) { + Bounds unCollapseBounds = option.get(); + int deltaX = ((Bounds) formatConstraint).getX() - unCollapseBounds.getX(); + int deltaY = ((Bounds) formatConstraint).getY() - unCollapseBounds.getY(); + + relativeLocation.setLocation(relativeLocation.x - deltaX, relativeLocation.y - deltaY); + primarySize = new Dimension(unCollapseBounds.getWidth(), unCollapseBounds.getHeight()); + } + } + } else { + final Integer width = (Integer) ViewUtil.getStructuralFeatureValue(node, NotationPackage.eINSTANCE.getSize_Width()); + final Integer height = (Integer) ViewUtil.getStructuralFeatureValue(node, NotationPackage.eINSTANCE.getSize_Height()); + primarySize = new Dimension(width.intValue(), height.intValue()); + if (width.intValue() == -1 || height.intValue() == -1) { + primarySize = editPart.getFigure().getSize().getCopy(); + } + } + + // 3-Remove the parent absolute location + if (parentFormatData != null) { + final Point parentAbsoluteLocation = FormatDataHelper.INSTANCE.getAbsoluteLocation(parentFormatData); + relativeLocation.translate(-parentAbsoluteLocation.getX(), -parentAbsoluteLocation.getY()); + } + + result.setHeight(primarySize.height); + result.setWidth(primarySize.width); + final Point location = FormatdataFactory.eINSTANCE.createPoint(); + location.setX(relativeLocation.x); + location.setY(relativeLocation.y); + result.setLocation(location); + + // 4-Copy Sirius and GMF styles + copyViewStyleInFormatData(result, node); + + return result; + } + + private void copyViewStyleInFormatData(AbstractFormatData formatData, View view) { + // 1-Copy Sirius Style + if (view.getElement() instanceof DStylizable) { + formatData.setSiriusStyle(EcoreUtil.copy(((DStylizable) view.getElement()).getStyle())); + } + + // 2-Copy GMF view to retrieve GMF style + EcoreUtil.Copier copierWithoutElementRef = new EcoreUtil.Copier(false, false); + View viewCopy = (View) copierWithoutElementRef.copy(view); + formatData.setGmfView(viewCopy); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper#createEdgeFormatData(org.eclipse.gmf.runtime.notation.Edge) + */ + @Override + public EdgeFormatData createEdgeFormatData(final Edge gmfEdge, final ConnectionEditPart connectionEditPart) { + final EdgeFormatData result = FormatdataFactory.eINSTANCE.createEdgeFormatData(); + final ConnectorStyle connectorStyle = (ConnectorStyle) gmfEdge.getStyle(NotationPackage.eINSTANCE.getConnectorStyle()); + if (connectorStyle != null) { + result.setRouting(connectorStyle.getRouting().getValue()); + result.setJumpLinkStatus(connectorStyle.getJumpLinkStatus().getValue()); + result.setJumpLinkType(connectorStyle.getJumpLinkType().getValue()); + result.setReverseJumpLink(connectorStyle.isJumpLinksReverse()); + result.setSmoothness(connectorStyle.getSmoothness().getValue()); + } + if (connectionEditPart != null) { + final PolylineConnectionEx polylineConnectionEx = (PolylineConnectionEx) connectionEditPart.getFigure(); + polylineConnectionEx.getConnectionRouter().route(polylineConnectionEx); + final org.eclipse.draw2d.geometry.Point originialSourceRefPoint = polylineConnectionEx.getSourceAnchor().getReferencePoint().getCopy(); + polylineConnectionEx.translateToRelative(originialSourceRefPoint); + result.setSourceRefPoint(createPoint(originialSourceRefPoint)); + + final org.eclipse.draw2d.geometry.Point originialTargetRefPoint = polylineConnectionEx.getTargetAnchor().getReferencePoint().getCopy(); + polylineConnectionEx.translateToRelative(originialTargetRefPoint); + result.setTargetRefPoint(createPoint(originialTargetRefPoint)); + + initPointList(result.getPointList(), polylineConnectionEx.getPoints().getCopy()); + } + if (gmfEdge.getSourceAnchor() instanceof IdentityAnchor) { + result.setSourceTerminal(((IdentityAnchor) gmfEdge.getSourceAnchor()).getId()); + } + if (gmfEdge.getTargetAnchor() instanceof IdentityAnchor) { + result.setTargetTerminal(((IdentityAnchor) gmfEdge.getTargetAnchor()).getId()); + } + + // 4-Copy Sirius and GMF styles + copyViewStyleInFormatData(result, gmfEdge); + + return result; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper#createLabelFormatData(org.eclipse.gmf.runtime.notation.Node) + */ + @Override + public NodeFormatData createLabelFormatData(final Node labelNode) { + final NodeFormatData result = FormatdataFactory.eINSTANCE.createNodeFormatData(); + + if (labelNode.getLayoutConstraint() instanceof Size) { + final Integer width = (Integer) ViewUtil.getStructuralFeatureValue(labelNode, NotationPackage.eINSTANCE.getSize_Width()); + final Integer height = (Integer) ViewUtil.getStructuralFeatureValue(labelNode, NotationPackage.eINSTANCE.getSize_Height()); + + result.setWidth(width); + result.setHeight(height); + } + + final Integer x = (Integer) ViewUtil.getStructuralFeatureValue(labelNode, NotationPackage.eINSTANCE.getLocation_X()); + final Integer y = (Integer) ViewUtil.getStructuralFeatureValue(labelNode, NotationPackage.eINSTANCE.getLocation_Y()); + + final Point location = FormatdataFactory.eINSTANCE.createPoint(); + location.setX(x); + location.setY(y); + + result.setLocation(location); + + return result; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper#getAbsoluteLocation(org.eclipse.sirius.diagram.formatdata.NodeFormatData) + */ + @Override + public Point getAbsoluteLocation(final NodeFormatData nodeFormatData) { + Point result = getCopy(nodeFormatData.getLocation()); + if (nodeFormatData.eContainer() instanceof NodeFormatData) { + result = getTranslated(result, getAbsoluteLocation((NodeFormatData) nodeFormatData.eContainer())); + } + return result; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper#getRelativeLocation(org.eclipse.sirius.diagram.formatdata.NodeFormatData, + * org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) + */ + @Override + public Point getRelativeLocation(final NodeFormatData formatData, final IGraphicalEditPart editPart) { + final Point result = getAbsoluteLocation(formatData); + final org.eclipse.draw2d.geometry.Point p = new org.eclipse.draw2d.geometry.Point(result.getX(), result.getY()); + FigureUtilities.translateToRelativeByIgnoringScrollbar(editPart.getFigure(), p); + result.setX(p.x); + result.setY(p.y); + + return result; + } + + /** + * Create a new point from a draw2d point. + * + * @param draw2dPoint + * The original point + * @return A new point + */ + private Point createPoint(final org.eclipse.draw2d.geometry.Point draw2dPoint) { + final Point newPoint = FormatdataFactory.eINSTANCE.createPoint(); + newPoint.setX(draw2dPoint.x); + newPoint.setY(draw2dPoint.y); + return newPoint; + } + + /** + * Initialize a list of {@link Point} from a {@link PointList}. + * + * @param pointsList + * the list to initialize + * @param draw2dPointsList + * the original points of the line + */ + private void initPointList(final EList<Point> pointList, final PointList draw2dPointsList) { + for (int i = 0; i < draw2dPointsList.size(); i++) { + pointList.add(createPoint(draw2dPointsList.getPoint(i))); + } + + } + + /** + * Return a copy of this Point. + * + * @param point + * the point to copy + * @return a copy of this Point + */ + private Point getCopy(final Point point) { + final Point copy = FormatdataFactory.eINSTANCE.createPoint(); + copy.setX(point.getX()); + copy.setY(point.getY()); + return copy; + } + + /** + * Creates a new Point which is translated by the values of the provided + * Point. + * + * @param originalPoint + * The point to translate. + * @param pt + * Point which provides the translation amounts. + * @return A new Point + */ + protected Point getTranslated(final Point originalPoint, final Point pt) { + final Point translatedPoint = FormatdataFactory.eINSTANCE.createPoint(); + translatedPoint.setX(originalPoint.getX() + pt.getX()); + translatedPoint.setY(originalPoint.getY() + pt.getY()); + return translatedPoint; + } + + /** + * Creates a new Point which is translated by the values of the provided + * Point. + * + * @param originalPoint + * The point to translate. + * @param pt + * Point which provides the translation amounts. + * @return A new Point + */ + @Override + public Point getTranslated(final Point originalPoint, final org.eclipse.draw2d.geometry.Point pt) { + final Point translatedPoint = FormatdataFactory.eINSTANCE.createPoint(); + translatedPoint.setX(originalPoint.getX() + pt.x); + translatedPoint.setY(originalPoint.getY() + pt.y); + return translatedPoint; + } + + /** + * {@inheritDoc} + */ + @Override + public Map<? extends FormatDataKey, ? extends AbstractFormatData> getRootFormatData(final Map<? extends FormatDataKey, ? extends AbstractFormatData> collection) { + return Maps.filterValues(collection, ROOT_PREDICATE); + } + + /** + * {@inheritDoc} + */ + @Override + public FormatDataKey createKey(final AbstractFormatData formatData) { + FormatDataKey result; + if (formatData instanceof NodeFormatData) { + result = new SemanticNodeFormatDataKey(formatData.getId()); + } else if (formatData instanceof EdgeFormatData) { + result = new SemanticEdgeFormatDataKey(formatData.getId()); + } else { + throw new IllegalArgumentException(MessageFormat.format(Messages.LayoutDataHelperImpl_unkownLayoutData, formatData.getClass())); + } + return result; + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/NodeFormatDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/NodeFormatDataKey.java new file mode 100644 index 0000000000..a5ef4d23a2 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/NodeFormatDataKey.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.format; + +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; + +/** + * Interface for all kind of key use to store + * {@link org.eclipse.sirius.diagram.formatdata.NodeFormatData}. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public interface NodeFormatDataKey extends FormatDataKey { + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerDescriptor.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerDescriptor.java new file mode 100644 index 0000000000..114cb58680 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerDescriptor.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.format.data.extension; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.sirius.common.ui.SiriusTransPlugin; +import org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider; + +/** + * Describes an extension as contributed to the + * {@link FormatDataManagerRegistryListener#FORMAT_DATA_MANAGER_PROVIDER_EXTENSION_POINT} + * extension point. + * + * @author mporhel + * + */ +public class FormatDataManagerDescriptor { + + /** + * Name of the attribute corresponding to the contributed class's path. + */ + public static final String FORMAT_DATA_MANAGER_PROVIDER_CLASS_NAME = "class"; //$NON-NLS-1$ + + /** + * Name of the attribute corresponding to the contributed id. + */ + public static final String FORMAT_DATA_MANAGER_PROVIDER_ID = "id"; //$NON-NLS-1$ + + /** + * Configuration element of this descriptor . + */ + private final IConfigurationElement element; + + /** + * The path of the contributed class. + */ + private String extensionClassName; + + /** + * The {@link IFormatDataManagerProvider} described by this descriptor. + */ + private IFormatDataManagerProvider extension; + + private String id; + + /** + * Instantiates a descriptor with all information. + * + * @param configuration + * Configuration element from which to create this descriptor. + */ + public FormatDataManagerDescriptor(IConfigurationElement configuration) { + element = configuration; + extensionClassName = configuration.getAttribute(FORMAT_DATA_MANAGER_PROVIDER_CLASS_NAME); + } + + /** + * Creates an instance of this descriptor's + * {@link IFormatDataManagerProvider} . + * + * @return A new instance of this descriptor's + * {@link IFormatDataManagerProvider}. + */ + public IFormatDataManagerProvider getFormatDataManagerProvider() { + if (extension == null) { + try { + extension = (IFormatDataManagerProvider) element.createExecutableExtension(FORMAT_DATA_MANAGER_PROVIDER_CLASS_NAME); + } catch (CoreException e) { + SiriusTransPlugin.INSTANCE.error(e.getMessage(), e); + } + } + return extension; + } + + /** + * Return the id of the current tab extension. + * + * @return the id of the current tab extension. + */ + public String getId() { + if (id == null) { + id = element.getAttribute(FORMAT_DATA_MANAGER_PROVIDER_ID); + } + return id; + } + + /** + * Returns the fully qualified name of the contributed class. + * + * @return the fully qualified name of the contributed class + */ + public String getExtensionClassName() { + return extensionClassName; + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerRegistry.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerRegistry.java new file mode 100644 index 0000000000..699e55f771 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerRegistry.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.format.data.extension; + +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import org.eclipse.sirius.common.tools.api.util.StringUtil; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerForSemanticElementsFactory; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +/** + * Registry containing all format data manager providers that have been parsed + * from the + * {@link FormatDataManagerRegistryListener#FORMAT_DATA_MANAGER_PROVIDER_EXTENSION_POINT} + * extension point. + * + * @author mporhel + * + */ +public final class FormatDataManagerRegistry { + /** + * The registered {@link FormatDataManagerDescriptor}s. + */ + private static final Map<FormatDataManagerDescriptor, SiriusFormatDataManager> EXTENSIONS = Maps.newLinkedHashMap(); + + /** + * Utility classes don't need a default constructor. + */ + private FormatDataManagerRegistry() { + + } + + /** + * Adds an extension to the registry, with the given behavior. + * + * @param extension + * The extension that is to be added to the registry + */ + public static void addExtension(FormatDataManagerDescriptor extension) { + EXTENSIONS.put(extension, null); + } + + /** + * Removes all extensions from the registry. This will be called at plugin + * stopping. + */ + public static void clearRegistry() { + EXTENSIONS.clear(); + } + + /** + * Returns a copy of the registered extensions list. + * + * @return A copy of the registered extensions list. + */ + public static Collection<FormatDataManagerDescriptor> getRegisteredExtensions() { + return Lists.newArrayList(EXTENSIONS.keySet()); + } + + /** + * Removes a phantom from the registry. + * + * @param extensionClassName + * Qualified class name of the sync element which corresponding + * phantom is to be removed from the registry. + */ + public static void removeExtension(String extensionClassName) { + for (FormatDataManagerDescriptor extension : getRegisteredExtensions()) { + if (extension.getExtensionClassName().equals(extensionClassName)) { + EXTENSIONS.remove(extension); + } + } + } + + /** + * Get the extension with the given id. + * + * @param id + * the requested id. + * + * @return the format data manager descriptor with the requested id if it + * exists. + */ + public static FormatDataManagerDescriptor getRegisteredExtension(String id) { + for (FormatDataManagerDescriptor desc : EXTENSIONS.keySet()) { + if (!StringUtil.isEmpty(desc.getId()) && desc.getId().equals(id)) { + return desc; + } + } + return null; + } + + /** + * Get the {@link SiriusFormatDataManager} found applicable for the given + * {@link DDiagram}. + * + * The default manager (based on semantic elements) will always be the last + * returned manager. + * + * @param diagram + * the diagram which needs a format data manager. + * + * @return a list of {@link SiriusFormatDataManager} instances. + */ + public static List<SiriusFormatDataManager> getSiriusFormatDataManagers(DDiagram diagram) { + List<SiriusFormatDataManager> applicableManagers = Lists.newArrayList(); + for (FormatDataManagerDescriptor descriptor : getRegisteredExtensions()) { + IFormatDataManagerProvider provider = descriptor.getFormatDataManagerProvider(); + if (provider != null && provider.provides(diagram)) { + SiriusFormatDataManager formatDataManager = EXTENSIONS.get(descriptor); + if (formatDataManager == null) { + formatDataManager = provider.getFormatDataManager(); + EXTENSIONS.put(descriptor, formatDataManager); + } + applicableManagers.add(formatDataManager); + } + } + applicableManagers.add(SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager()); + return applicableManagers; + } + + /** + * Get all known {@link SiriusFormatDataManager} . + * + * The default manager (based on semantic elements) will always be the last + * returned manager. + * + * @return a list of {@link SiriusFormatDataManager} instances. + */ + public static List<SiriusFormatDataManager> getAllSiriusFormatDataManagers() { + List<SiriusFormatDataManager> applicableManagers = Lists.newArrayList(); + for (FormatDataManagerDescriptor descriptor : getRegisteredExtensions()) { + IFormatDataManagerProvider provider = descriptor.getFormatDataManagerProvider(); + if (provider != null) { + SiriusFormatDataManager formatDataManager = EXTENSIONS.get(descriptor); + if (formatDataManager == null) { + formatDataManager = provider.getFormatDataManager(); + EXTENSIONS.put(descriptor, formatDataManager); + } + applicableManagers.add(formatDataManager); + } + } + applicableManagers.add(SiriusFormatDataManagerForSemanticElementsFactory.getInstance().getSiriusFormatDataManager()); + return applicableManagers; + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerRegistryListener.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerRegistryListener.java new file mode 100644 index 0000000000..c4e77c522a --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/data/extension/FormatDataManagerRegistryListener.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2011, 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.format.data.extension; + +import java.util.Set; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionDelta; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IRegistryChangeEvent; +import org.eclipse.core.runtime.IRegistryChangeListener; +import org.eclipse.core.runtime.Platform; + +import com.google.common.collect.Sets; + +/** + * This listener will allow us to be aware of contribution changes against the + * {@link FormatDataManagerRegistryListener#FORMAT_DATA_MANAGER_PROVIDER_EXTENSION_POINT} + * extension point. + * + * @author mporhel + * + */ +public class FormatDataManagerRegistryListener implements IRegistryChangeListener { + + /** Name of the extension point to parse for extensions. */ + public static final String FORMAT_DATA_MANAGER_PROVIDER_EXTENSION_POINT = "org.eclipse.sirius.diagram.ui.formatDataManager"; //$NON-NLS-1$ + + /** Name of the extension point's "Format Data Manager Extension" tag. */ + private static final String FORMAT_DATA_MANAGER_PROVIDER_EXTENSION = "formatDataManagerProvider"; //$NON-NLS-1$ + + /** + * initialize this listener. + */ + public void init() { + final IExtensionRegistry registry = Platform.getExtensionRegistry(); + registry.addRegistryChangeListener(this, FormatDataManagerRegistryListener.FORMAT_DATA_MANAGER_PROVIDER_EXTENSION_POINT); + this.parseInitialContributions(); + } + + /** + * Dispose this listener. + */ + public void dispose() { + final IExtensionRegistry registry = Platform.getExtensionRegistry(); + registry.removeRegistryChangeListener(this); + FormatDataManagerRegistry.clearRegistry(); + } + + /** + * Parses a single extension contribution. + * + * @param extension + * Parses the given extension and adds its contribution to the + * registry. + */ + private void parseExtension(IExtension extension) { + final IConfigurationElement[] configElements = extension.getConfigurationElements(); + for (IConfigurationElement elem : configElements) { + if (FORMAT_DATA_MANAGER_PROVIDER_EXTENSION.equals(elem.getName())) { + + try { + FormatDataManagerRegistry.addExtension(new FormatDataManagerDescriptor(elem)); + } catch (IllegalArgumentException e) { + // Do nothing + } + } + } + } + + /** + * + * {@inheritDoc} + * + * @see org.eclipse.core.runtime.IRegistryEventListener#added(org.eclipse.core.runtime.IExtensionPoint[]) + */ + public void added(IExtensionPoint[] extensionPoints) { + for (IExtensionPoint extensionPoint : extensionPoints) { + for (IExtension extension : extensionPoint.getExtensions()) { + parseExtension(extension); + } + } + } + + /** + * + * {@inheritDoc} + * + * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent) + */ + @Override + public void registryChanged(IRegistryChangeEvent event) { + Set<IExtension> addedExtensions = Sets.newLinkedHashSet(); + for (IExtensionDelta extensionDelta : event.getExtensionDeltas()) { + addedExtensions.add(extensionDelta.getExtension()); + } + added(addedExtensions.toArray(new IExtension[addedExtensions.size()])); + } + + /** + * Behavior when the given extensions are added. + * + * @param extensions + * the added extensions + */ + public void added(IExtension[] extensions) { + for (IExtension extension : extensions) { + parseExtension(extension); + } + } + + /** + * Though this listener reacts to the extension point changes, there could + * have been contributions before it's been registered. This will parse + * these initial contributions. + */ + private void parseInitialContributions() { + final IExtensionRegistry registry = Platform.getExtensionRegistry(); + + for (IExtension extension : registry.getExtensionPoint(FORMAT_DATA_MANAGER_PROVIDER_EXTENSION_POINT).getExtensions()) { + parseExtension(extension); + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.core.runtime.IRegistryEventListener#removed(org.eclipse.core.runtime.IExtension[]) + */ + public void removed(IExtension[] extensions) { + for (IExtension extension : extensions) { + final IConfigurationElement[] configElements = extension.getConfigurationElements(); + for (IConfigurationElement elem : configElements) { + if (FORMAT_DATA_MANAGER_PROVIDER_EXTENSION_POINT.equals(elem.getName())) { + final String extensionClassName = elem.getAttribute(FormatDataManagerDescriptor.FORMAT_DATA_MANAGER_PROVIDER_CLASS_NAME); + FormatDataManagerRegistry.removeExtension(extensionClassName); + } + } + } + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/AbstractSemanticFormatDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/AbstractSemanticFormatDataKey.java new file mode 100644 index 0000000000..a9ec583d17 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/AbstractSemanticFormatDataKey.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.format.semantic; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; + +import com.google.common.base.Objects; + +/** + * Common behavior for Semantic*FormatDataKey classes. + * + * @author dlecan + */ +public abstract class AbstractSemanticFormatDataKey implements FormatDataKey, Comparable<AbstractSemanticFormatDataKey> { + + /** URI Fragment of the element's target semantic element. */ + private final String semanticElementURIFragment; + + /** + * Constructor. + * + * @param semanticElement + * The element the create the key. + */ + public AbstractSemanticFormatDataKey(final EObject semanticElement) { + this.semanticElementURIFragment = EcoreUtil.getURI(semanticElement).fragment(); + } + + /** + * Constructor. + * + * @param uriFragment + * String to use to create the new key. + */ + public AbstractSemanticFormatDataKey(final String uriFragment) { + semanticElementURIFragment = uriFragment; + } + + protected String getSemanticElementURIFragment() { + return semanticElementURIFragment; + } + + /** + * {@inheritDoc} + * + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return Objects.hashCode(semanticElementURIFragment); + } + + /** + * {@inheritDoc} + * + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(final Object obj) { + boolean result = false; + if (this == obj) { + result = true; + } else if (obj != null && getClass().isAssignableFrom(obj.getClass()) && getSemanticElementURIFragment() != null) { + result = getId().equals(((FormatDataKey) obj).getId()); + } + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return "Key ID: " + getId(); //$NON-NLS-1$ + } + + /** + * {@inheritDoc} + */ + @Override + public String getId() { + return getSemanticElementURIFragment(); + } + + /** + * {@inheritDoc} + */ + @Override + public int compareTo(final AbstractSemanticFormatDataKey o) { + return getId().compareTo(o.getId()); + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SemanticEdgeFormatDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SemanticEdgeFormatDataKey.java new file mode 100644 index 0000000000..f47ebe0288 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SemanticEdgeFormatDataKey.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.format.semantic; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.ui.tools.internal.format.EdgeFormatDataKey; + +/** + * Kind of key use to store the format data corresponding to a semantic element + * represented by a {@link org.eclipse.sirius.diagram.DEdge}. The key is the URI + * of the semantic element. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + */ +public class SemanticEdgeFormatDataKey extends AbstractSemanticFormatDataKey implements EdgeFormatDataKey { + + /** + * Constructor. + * + * @param uriFragment + * String to use. + */ + public SemanticEdgeFormatDataKey(final String uriFragment) { + super(uriFragment); + } + + /** + * Default constructor. + * + * @param semanticElement + * The element to build the key + */ + public SemanticEdgeFormatDataKey(final EObject semanticElement) { + super(semanticElement); + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SemanticNodeFormatDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SemanticNodeFormatDataKey.java new file mode 100644 index 0000000000..8d4e84990d --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SemanticNodeFormatDataKey.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.format.semantic; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.ui.tools.internal.format.NodeFormatDataKey; + +/** + * Kind of key use to store the format data corresponding to a semantic element + * represented by a {@link org.eclipse.sirius.viewpoint.AbstractDNode} or a + * {@link org.eclipse.sirius.diagram.DDiagram}. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * + */ +public class SemanticNodeFormatDataKey extends AbstractSemanticFormatDataKey implements NodeFormatDataKey { + + /** + * Constructor. + * + * @param uriFragment + * String to use. + */ + public SemanticNodeFormatDataKey(final String uriFragment) { + super(uriFragment); + } + + /** + * Default constructor. + * + * @param semanticElement + * The element to build the key + */ + public SemanticNodeFormatDataKey(final EObject semanticElement) { + super(semanticElement); + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SiriusFormatDataManagerForSemanticElements.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SiriusFormatDataManagerForSemanticElements.java new file mode 100644 index 0000000000..cfe85c24a6 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/format/semantic/SiriusFormatDataManagerForSemanticElements.java @@ -0,0 +1,180 @@ +/******************************************************************************* + * Copyright (c) 2009, 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.format.semantic; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.AbstractDNode; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DEdge; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.diagram.formatdata.EdgeFormatData; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; +import org.eclipse.sirius.diagram.ui.tools.api.format.AbstractSiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.internal.format.AdvancedSiriusFormatDataManager; +import org.eclipse.sirius.viewpoint.DSemanticDecorator; + +/** + * SiriusFormatDataManager drives by the semantic elements (EObject). Use for + * format duplication. + * + * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> + * + */ +public class SiriusFormatDataManagerForSemanticElements extends AbstractSiriusFormatDataManager implements AdvancedSiriusFormatDataManager { + + private static final SiriusFormatDataManagerForSemanticElements INSTANCE = new SiriusFormatDataManagerForSemanticElements(); + + private final Map<SemanticNodeFormatDataKey, NodeFormatData> nodeFormatDataMap = new HashMap<SemanticNodeFormatDataKey, NodeFormatData>(); + + private final Map<SemanticEdgeFormatDataKey, EdgeFormatData> edgeFormatDataMap = new HashMap<SemanticEdgeFormatDataKey, EdgeFormatData>(); + + /** + * Default constructor. + */ + public SiriusFormatDataManagerForSemanticElements() { + // Nothing. + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#addFormatData(org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey, + * org.eclipse.sirius.diagram.formatdata.AbstractFormatData) + */ + @Override + public void addFormatData(final FormatDataKey key, final AbstractFormatData formatData) { + if (!checkKeyType(key)) { + // Kind of key not manage + formatData.setId(null); + return; + } + + if (key instanceof SemanticNodeFormatDataKey) { + if (formatData instanceof NodeFormatData) { + nodeFormatDataMap.put((SemanticNodeFormatDataKey) key, (NodeFormatData) formatData); + } else { + // Bad type of formatData for this key + } + } else if (key instanceof SemanticEdgeFormatDataKey) { + if (formatData instanceof EdgeFormatData) { + edgeFormatDataMap.put((SemanticEdgeFormatDataKey) key, (EdgeFormatData) formatData); + } else { + // Bad type of formatData for this key + } + } + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#getFormatData(org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey) + */ + @Override + public AbstractFormatData getFormatData(final FormatDataKey key) { + AbstractFormatData result = null; + if (checkKeyType(key)) { + if (key instanceof SemanticNodeFormatDataKey) { + result = nodeFormatDataMap.get(key); + } else if (key instanceof SemanticEdgeFormatDataKey) { + result = edgeFormatDataMap.get(key); + } + } + return result; + } + + /** + * Check if the key is manage by this manager. + * + * @param key + * the key to check + * @return + */ + private boolean checkKeyType(final FormatDataKey key) { + return key instanceof SemanticNodeFormatDataKey || key instanceof SemanticEdgeFormatDataKey; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#getInstance() + */ + public SiriusFormatDataManager getInstance() { + return INSTANCE; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#createKey(org.eclipse.sirius.viewpoint.DSemanticDecorator) + */ + @Override + public FormatDataKey createKey(final DSemanticDecorator semanticDecorator) { + FormatDataKey result = null; + final EObject realSemanticElement = semanticDecorator.getTarget(); + if (semanticDecorator instanceof DEdge) { + result = new SemanticEdgeFormatDataKey(realSemanticElement); + } else if (semanticDecorator instanceof AbstractDNode || semanticDecorator instanceof DDiagram) { + result = new SemanticNodeFormatDataKey(realSemanticElement); + } + return result; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#containsData() + */ + @Override + public boolean containsData() { + return !nodeFormatDataMap.isEmpty() || !edgeFormatDataMap.isEmpty(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager#clearFormatData() + */ + @Override + public void clearFormatData() { + nodeFormatDataMap.clear(); + edgeFormatDataMap.clear(); + } + + /** + * {@inheritDoc} + */ + @Override + public Map<SemanticEdgeFormatDataKey, EdgeFormatData> getEdgeFormatData() { + return edgeFormatDataMap; + } + + /** + * {@inheritDoc} + */ + @Override + public Map<? extends FormatDataKey, ? extends NodeFormatData> getRootNodeFormatData() { + return (Map<? extends FormatDataKey, ? extends NodeFormatData>) FormatDataHelper.INSTANCE.getRootFormatData(nodeFormatDataMap); + } + + /** + * {@inheritDoc} + */ + @Override + public Map<SemanticNodeFormatDataKey, NodeFormatData> getNodeFormatData() { + return nodeFormatDataMap; + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/DEdgeLayoutDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/DEdgeLayoutDataKey.java deleted file mode 100644 index f39bc36231..0000000000 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/DEdgeLayoutDataKey.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.layout.diagram; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.diagram.DEdge; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.EdgeLayoutDataKey; - -/** - * Kind of key use to store the layout data corresponding to an {@link DEdge}. - * - * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> - * - */ -public class DEdgeLayoutDataKey implements EdgeLayoutDataKey { - /** - * The target of this EdgeLayoutData - */ - private DEdge target; - - /** - * Default constructor. - * - * @param key - * The key - */ - public DEdgeLayoutDataKey(final DEdge key) { - this.target = key; - } - - protected EObject getTarget() { - return target; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataKey#getId() - */ - public String getId() { - return EcoreUtil.getURI(getTarget()).fragment(); - } -} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/DNodeLayoutDataKey.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/DNodeLayoutDataKey.java deleted file mode 100644 index a145da7a92..0000000000 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/DNodeLayoutDataKey.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2015 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.diagram.ui.tools.internal.layout.diagram; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.diagram.AbstractDNode; -import org.eclipse.sirius.diagram.DDiagram; -import org.eclipse.sirius.diagram.ui.provider.Messages; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.NodeLayoutDataKey; - -/** - * Kind of key use to store the layout data corresponding to an - * {@link AbstractDNode} or a {@link DDiagram}. - * - * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> - * - */ -public class DNodeLayoutDataKey implements NodeLayoutDataKey { - /** - * The target of this LayoutData (can only be a DDiagram or an - * AbstractDNode). - */ - private EObject target; - - /** - * Default constructor. - * - * @param target - * The target of the - */ - public DNodeLayoutDataKey(final EObject target) { - if (!(target instanceof AbstractDNode || target instanceof DDiagram)) { - throw new IllegalArgumentException(Messages.DNodeLayoutDataKey_wrongKeyMsg); - } - this.target = target; - } - - /** - * {@inheritDoc} - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object obj) { - if (obj instanceof DNodeLayoutDataKey) { - return this.getTarget().equals(((DNodeLayoutDataKey) obj).getTarget()); - } else { - return super.equals(obj); - } - } - - /** - * {@inheritDoc} - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return super.hashCode(); - } - - protected EObject getTarget() { - return target; - } - - protected void setTarget(final EObject target) { - this.target = target; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataKey#getId() - */ - @Override - public String getId() { - return EcoreUtil.getURI(getTarget()).fragment(); - } -} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/SiriusLayoutDataManagerForDDiagram.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/SiriusLayoutDataManagerForDDiagram.java deleted file mode 100644 index 26c421dca2..0000000000 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/layout/diagram/SiriusLayoutDataManagerForDDiagram.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 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.layout.diagram; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.sirius.diagram.layoutdata.AbstractLayoutData; -import org.eclipse.sirius.diagram.layoutdata.EdgeLayoutData; -import org.eclipse.sirius.diagram.layoutdata.NodeLayoutData; -import org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataKey; -import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; -import org.eclipse.sirius.viewpoint.DSemanticDecorator; - -/** - * SiriusLayoutDataManager drives by the DDiagram (DNode, DEdge, ...). Use for - * drag'n'drop and creation process. - * - * @author <a href="mailto:laurent.redor@obeo.fr">Laurent Redor</a> - * - */ -public class SiriusLayoutDataManagerForDDiagram implements SiriusLayoutDataManager { - Map<DNodeLayoutDataKey, NodeLayoutData> nodeLayoutDataMap = new HashMap<DNodeLayoutDataKey, NodeLayoutData>(); - - Map<DEdgeLayoutDataKey, EdgeLayoutData> edgeLayoutDataMap = new HashMap<DEdgeLayoutDataKey, EdgeLayoutData>(); - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#addLayoutData(org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataKey, - * org.eclipse.sirius.diagram.layoutdata.AbstractLayoutData) - */ - @Override - public void addLayoutData(final LayoutDataKey key, final AbstractLayoutData layoutData) { - if (!checkKeyType(key)) { - // Kind of key not manage - return; - } - if (key instanceof DNodeLayoutDataKey) { - if (layoutData instanceof NodeLayoutData) { - nodeLayoutDataMap.put((DNodeLayoutDataKey) key, (NodeLayoutData) layoutData); - } else { - // Bad type of layoutData for this key - } - } else if (key instanceof DEdgeLayoutDataKey) { - if (layoutData instanceof EdgeLayoutData) { - edgeLayoutDataMap.put((DEdgeLayoutDataKey) key, (EdgeLayoutData) layoutData); - } else { - // Bad type of layoutData for this key - } - } - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#getLayoutData(org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataKey) - */ - @Override - public AbstractLayoutData getLayoutData(final LayoutDataKey key) { - AbstractLayoutData result = null; - if (checkKeyType(key)) { - if (key instanceof DNodeLayoutDataKey) { - result = nodeLayoutDataMap.get(key); - } else if (key instanceof DEdgeLayoutDataKey) { - result = edgeLayoutDataMap.get(key); - } - } - return result; - } - - /** - * Check if the key is manage by this manager. - * - * @param key - * the key to check - * @return - */ - private boolean checkKeyType(final LayoutDataKey key) { - return key instanceof DNodeLayoutDataKey || key instanceof DEdgeLayoutDataKey; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#applyFormat(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) - */ - @Override - public void applyFormat(final IGraphicalEditPart rootEditPart) { - // TODO Auto-generated method stub - - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#applyLayout(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) - */ - @Override - public void applyLayout(final IGraphicalEditPart rootEditPart) { - // TODO Auto-generated method stub - - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#applyStyle(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) - */ - @Override - public void applyStyle(final IGraphicalEditPart rootEditPart) { - // TODO Auto-generated method stub - - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#clearLayoutData() - */ - @Override - public void clearLayoutData() { - // TODO Auto-generated method stub - - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#containsData() - */ - @Override - public boolean containsData() { - // TODO Auto-generated method stub - return false; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#createKey(org.eclipse.sirius.viewpoint.DSemanticDecorator) - */ - @Override - public LayoutDataKey createKey(final DSemanticDecorator semanticDecorator) { - // TODO Auto-generated method stub - return null; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#getInstance() - */ - public SiriusLayoutDataManager getInstance() { - // TODO Auto-generated method stub - return null; - } - - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager#storeLayoutData(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) - */ - @Override - public void storeLayoutData(final IGraphicalEditPart rootEditPart) { - // TODO Auto-generated method stub - - } -} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java index 0282f6cc3a..7d81000ec2 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java @@ -46,6 +46,7 @@ import org.eclipse.sirius.diagram.provider.DiagramItemProviderAdapterFactory; import org.eclipse.sirius.diagram.ui.business.internal.image.ImageSelectorDescriptorRegistryListener; import org.eclipse.sirius.diagram.ui.business.internal.image.refresh.WorkspaceImageFigureRefresher; import org.eclipse.sirius.diagram.ui.internal.refresh.listeners.WorkspaceFileResourceChangeListener; +import org.eclipse.sirius.diagram.ui.tools.internal.format.data.extension.FormatDataManagerRegistryListener; import org.eclipse.sirius.diagram.ui.tools.internal.layout.data.extension.LayoutDataManagerRegistryListener; import org.eclipse.sirius.diagram.ui.tools.internal.resource.CustomSiriusDocumentProvider; import org.eclipse.sirius.diagram.ui.tools.internal.resource.ResourceMissingDocumentProvider; @@ -140,6 +141,8 @@ public final class DiagramUIPlugin extends EMFPlugin { private LayoutDataManagerRegistryListener layoutDataManagerRegistryListener; + private FormatDataManagerRegistryListener formatDataManagerRegistryListener; + private ImageSelectorDescriptorRegistryListener imageSelectorDescriptorRegistryListener; private WorkspaceImageFigureRefresher workspaceImageFigureRefresher; @@ -174,6 +177,9 @@ public final class DiagramUIPlugin extends EMFPlugin { imageSelectorDescriptorRegistryListener = new ImageSelectorDescriptorRegistryListener(); imageSelectorDescriptorRegistryListener.init(); + formatDataManagerRegistryListener = new FormatDataManagerRegistryListener(); + formatDataManagerRegistryListener.init(); + layoutDataManagerRegistryListener = new LayoutDataManagerRegistryListener(); layoutDataManagerRegistryListener.init(); } @@ -196,6 +202,9 @@ public final class DiagramUIPlugin extends EMFPlugin { // closed when transactions have been closed) } + formatDataManagerRegistryListener.dispose(); + formatDataManagerRegistryListener = null; + layoutDataManagerRegistryListener.dispose(); layoutDataManagerRegistryListener = null; diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java index 78facaf8b4..37b4b63cd2 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/provider/Messages.java @@ -471,6 +471,9 @@ public final class Messages { public static String DNodeContainerViewNodeContainerCompartmentEditPart_title; @TranslatableMessage + public static String DNodeFormatDataKey_wrongKeyMsg; + + @TranslatableMessage public static String DNodeLayoutDataKey_wrongKeyMsg; @TranslatableMessage @@ -552,6 +555,15 @@ public final class Messages { public static String FontPropertySection_underline; @TranslatableMessage + public static String FormatData_illegalTarget; + + @TranslatableMessage + public static String FormatData_unhandledDiagramElementKind; + + @TranslatableMessage + public static String FormatDataHelperImpl_unkownFormatData; + + @TranslatableMessage public static String GMFCommandWrapper_label; @TranslatableMessage diff --git a/plugins/org.eclipse.sirius.diagram/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.diagram/META-INF/MANIFEST.MF index 98adb005ea..a5983fe272 100644 --- a/plugins/org.eclipse.sirius.diagram/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.diagram/META-INF/MANIFEST.MF @@ -10,7 +10,6 @@ Bundle-Localization: plugin Require-Bundle: com.google.guava;bundle-version="[11.0.2,16.0)", org.eclipse.gmf.runtime.diagram.core;bundle-version="1.6.1", org.eclipse.sirius.common;bundle-version="4.0.0", - org.eclipse.sirius.diagram.layoutdata;bundle-version="4.0.0", org.eclipse.sirius.ecore.extender;bundle-version="4.0.0", org.eclipse.core.runtime;bundle-version="3.8.0", org.eclipse.emf.ecore;bundle-version="2.8.2";visibility:=reexport, diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index ca15c0ba6d..5e2d5ed842 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -131,6 +131,10 @@ <li>The rules concerning the layout of compartments have been changed/completed. You can have a look at the <a href="specifier/diagrams/Diagrams.html#compartments_layout">dedicated chapter</a> in the specifier documentation for more details. </li> + <li>The extension point + <code>org.eclipse.sirius.diagram.ui.layoutDataManager</code> is deprecated. It is replaced by the new extension point + <code>org.eclipse.sirius.diagram.ui.formatDataManager</code>. The deprecated extension point will be removed in the next 5.0 Sirius major release. Several classes associated with this deprecated extension point are also deprecated (see Developer-Visible Changes for details). + </li> </ul> <h3 id="DeveloperVisibleChanges">Developer-Visible Changes</h3> <ul> @@ -289,6 +293,30 @@ <li><span class="label label-success">Added</span> <code>org.eclipse.sirius.diagram.ui.business.api.query.ViewQuery.getAncestor(int...)</code> has been added to retrieve the first ancestor of the view, or itself, that has at least one of the visualID passed as parameter. </li> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.diagram.ui.tools.api.layout.AbstractSiriusLayoutDataManager</code> is deprecated, use + <code>org.eclipse.sirius.diagram.ui.tools.api.format.AbstractSiriusFormatDataManager</code> instead. + </li> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.diagram.ui.tools.api.layout.ILayoutDataManagerProvider</code> is deprecated, use + <code>org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider</code> instead. + </li> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataHelper</code> is deprecated, use + <code>org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper</code> instead. + </li> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataKey</code> is deprecated, use + <code>org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey</code> instead. + </li> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager</code> is deprecated, use + <code>org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager</code> instead. + </li> + <li><span class="label label-info">Modified</span> + <code>org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManagerForSemanticElementsFactory</code> is deprecated, use + <code>org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerForSemanticElementsFactory</code> instead. + </li> </ul> <h4 id="Changesinorg.eclipse.sirius.ext.gmf.runtime">Changes in <code>org.eclipse.sirius.ext.gmf.runtime</code> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 201721f39c..3190d42064 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -20,6 +20,7 @@ If a viewpoint has been defined with a more recent version of Sirius than the o h3. Specifier-Visible Changes * The rules concerning the layout of compartments have been changed/completed. You can have a look at the "dedicated chapter":specifier/diagrams/Diagrams.html#compartments_layout in the specifier documentation for more details. +* The extension point @org.eclipse.sirius.diagram.ui.layoutDataManager@ is deprecated. It is replaced by the new extension point @org.eclipse.sirius.diagram.ui.formatDataManager@. The deprecated extension point will be removed in the next 5.0 Sirius major release. Several classes associated with this deprecated extension point are also deprecated (see Developer-Visible Changes for details). h3. Developer-Visible Changes @@ -65,6 +66,14 @@ h4. Changes in @org.eclipse.sirius.diagram.ui@ ** @PASTE_STYLE@: Action contribution id for the paste style. * <span class="label label-success">Added</span> @org.eclipse.sirius.diagram.ui.business.api.query.NodeQuery.isDescendantOf(View)@ has been added to know if a view is a descendant of another view. * <span class="label label-success">Added</span> @org.eclipse.sirius.diagram.ui.business.api.query.ViewQuery.getAncestor(int...)@ has been added to retrieve the first ancestor of the view, or itself, that has at least one of the visualID passed as parameter. +* <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.layout.AbstractSiriusLayoutDataManager@ is deprecated, use @org.eclipse.sirius.diagram.ui.tools.api.format.AbstractSiriusFormatDataManager@ instead. +* <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.layout.ILayoutDataManagerProvider@ is deprecated, use @org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider@ instead. +* <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataHelper@ is deprecated, use @org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper@ instead. +* <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutDataKey@ is deprecated, use @org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey@ instead. +* <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager@ is deprecated, use @org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager@ instead. +* <span class="label label-info">Modified</span> @org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManagerForSemanticElementsFactory@ is deprecated, use @org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManagerForSemanticElementsFactory@ instead. + + h4. Changes in @org.eclipse.sirius.ext.gmf.runtime@ diff --git a/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF index c1ee979cca..894a4d7b51 100644 --- a/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF @@ -73,7 +73,8 @@ Require-Bundle: org.eclipse.sirius.tests.sample.benchmark, org.eclipse.sirius.tests.sample.component.design, org.eclipse.sirius.common.acceleo.aql;bundle-version="3.1.0", org.eclipse.sirius.common.acceleo.aql.ide;bundle-version="3.1.0", - org.eclipse.ui.navigator;bundle-version="3.5.200" + org.eclipse.ui.navigator;bundle-version="3.5.200", + org.eclipse.sirius.diagram.formatdata;bundle-version="4.1.0" Bundle-Activator: org.eclipse.sirius.tests.SiriusTestsPlugin Eclipse-LazyStart: true Bundle-Localization: plugin diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index 247f3708e8..3f62453265 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="311" height="234"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="311" height="234"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="30" y="40"/> </children> <location x="425" y="55"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index b259be5e42..14774fdb39 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <children id="//p2/p2-1" width="178" height="85"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="11" y="11"/> </children> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="157" height="80"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index 196b54ba15..bd61e130a4 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="135" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="135" height="69"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="124" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="124" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="179" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="179" height="102"> <children id="//p1/C1-1" width="30" height="30"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index 0a2a0a7645..02e12b6192 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType1__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType1__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79" y="7"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="168" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="168" height="80"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index 1576b57759..b6ad319522 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="653" height="173"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="653" height="173"> <children id="//p1/C1-1" width="96" height="42"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="5" y="18"/> </children> <location x="30" y="30"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index 29cfabdf8a..bcee4ae087 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <children id="//p2/p2-1" width="169" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="153" height="53"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="243" y="36"/> </children> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="653" height="173"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="653" height="173"> <children id="//p1/p1-1" width="274" height="379"> <children id="//p1/p1-1/C1-1-1" width="74" height="47"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location x="30" y="30"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index 346e40d72c..2bb50020a9 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="150" height="70"> <location x="340" y="200"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="274" height="379"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="274" height="379"> <children id="//p1/p1-1/C1-1-1" width="74" height="47"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="227" y="66"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="261" height="127"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="261" height="127"> <children id="//p1/p1-2/C1-2-1" width="58" height="40"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="120" y="198"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="169" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="169" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="153" height="53"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="65" y="296"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="150" height="70"> <location x="273" y="296"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="653" height="173"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="653" height="173"> <children id="//p1/C1-1" width="96" height="42"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="30" y="30"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index 93f7b33b98..e50f1e6121 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType2__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType2__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <children id="//p2/p2-1/new%20EClass%201" width="153" height="53"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79" y="7"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="653" height="173"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="653" height="173"> <children id="//p1/C1-1" width="96" height="42"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="30" y="30"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index 15df4dab23..d1fef92546 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="30" height="30"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="30" height="30"> <location x="300" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="30" height="30"> <location x="210" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="30" height="30"> <location x="120" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="893" height="273"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="893" height="273"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="30" y="40"/> </children> <location x="-20" y="80"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index 9c81a6a4d2..8be92ea48a 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="30" height="30"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="30" height="30"> <location x="300" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="30" height="30"> <location x="210" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="30" height="30"> <children id="//p2/p2-1" width="178" height="85"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="11" y="11"/> </children> <location x="120" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="893" height="273"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="893" height="273"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location x="-20" y="80"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index ec51b03e16..b673842895 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="30" height="30"> <location x="300" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="30" height="30"> <location x="210" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="30" height="30"> <location x="120" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="135" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="135" height="69"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="124" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="124" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="893" height="273"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="893" height="273"> <children id="//p1/C1-1" width="30" height="30"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="-20" y="80"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index 5c18914825..98e14ab4e0 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType3__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType3__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="30" height="30"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="30" height="30"> <location x="300" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="30" height="30"> <location x="210" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="30" height="30"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79" y="7"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="120" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="893" height="273"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="893" height="273"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="-20" y="80"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index 4103c0ecdb..914a7f6c1b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="223" height="80"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="223" height="80"> <location x="935"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="245" height="80"> <location x="649"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="260" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="260" height="80"> <location x="319"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="245" height="80"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="30" y="40"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index 71418daeb2..8b5d6e4c6c 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="223" height="80"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="223" height="80"> <location x="935"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="245" height="80"> <location x="649"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="260" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="260" height="80"> <children id="//p2/p2-1" width="178" height="85"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="11" y="11"/> </children> <location x="319"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="245" height="80"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index 0a47baec3b..21dff2862b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="223" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="223" height="80"> <location x="935"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="245" height="80"> <location x="649"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="260" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="260" height="80"> <location x="319"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="135" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="135" height="69"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="124" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="124" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="245" height="80"> <children id="//p1/C1-1" width="30" height="30"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index 1edf149c77..ea46f2a7c1 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType4__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType4__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="223" height="80"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="223" height="80"> <location x="935"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="245" height="80"> <location x="649"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="260" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="260" height="80"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79" y="7"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="319"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="245" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="245" height="80"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index 4f1437cdda..5c207b183a 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="168" height="80"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="168" height="80"> <location x="35" y="230"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="157" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="157" height="91"> <location x="165" y="130"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="157" height="80"> <location x="40" y="35"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="311" height="234"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="311" height="234"> <children id="//p1/C1-1" width="96" height="35"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="-330" y="93"/> </children> <location x="425" y="55"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index e3b3282eed..7bb51ea93b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="135" height="102"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="234" height="190"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="234" height="190"> <children id="//p2/p2-1" width="178" height="85"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="11" y="11"/> </children> <location x="-22"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="157" height="80"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index f2a9a53c8a..38a94278c1 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="124" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="124" height="69"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="124" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="124" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="135" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="135" height="69"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="124" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="124" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="179" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="179" height="102"> <children id="//p1/C1-1" width="96" height="35"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index c87fa0afa0..b0466d086b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType5__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType5__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="113" height="69"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="113" height="69"> <location x="22" y="7"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="87" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="87" height="58"> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="344" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="344" height="91"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="297"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="168" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="168" height="80"> <children id="//p1/C1-1" width="96" height="35"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index e39569d116..de616f1c6e 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="168" height="80"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="168" height="80"> <location x="35" y="230"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="157" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="157" height="91"> <location x="165" y="130"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="157" height="80"> <location x="40" y="35"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="311" height="234"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="311" height="234"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location x="120" y="-15"/> @@ -38,5 +38,5 @@ <location x="-359" y="132"/> </children> <location x="425" y="55"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index eab6b98470..9dfcbeaf73 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="135" height="102"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="234" height="190"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="234" height="190"> <children id="//p2/p2-1" width="178" height="85"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="11" y="11"/> </children> <location x="-22"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="157" height="80"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index f0d5087c48..acf698f7ec 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location x="57" y="4"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="124" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="124" height="69"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="124" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="124" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="135" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="135" height="69"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="124" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="124" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="179" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="179" height="102"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location x="120" y="-15"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index 5ccb8abd27..5e8a7a78ff 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType6__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType6__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="113" height="69"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="113" height="69"> <location x="22" y="7"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="87" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="87" height="58"> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="344" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="344" height="91"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="297"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="168" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="168" height="80"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location x="120" y="-15"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index d5d78908bf..608e7077ba 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1621" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1375" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <location x="831" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location x="142" y="43"/> @@ -38,5 +38,5 @@ <location x="-22" y="80"/> </children> <location x="20" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index 49e5b46939..152450dad7 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1621" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1375" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1" width="199" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="332" y="84"/> </children> <location x="831" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/p1-1" width="199" height="137"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location x="20" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index 0afcd939fd..34409c0b7a 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="199" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="199" height="70"> <location x="609" y="60"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="199" height="137"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="199" height="137"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="100" y="54"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="199" height="70"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="360" y="240"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1621" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1375" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <location x="831" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="199" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="906" y="114"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="199" height="70"> <location x="1163" y="114"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location x="142" y="43"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="20" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index 21b7737d63..e18b47b07b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType7__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType7__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1621" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1375" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="831" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location x="142" y="43"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="20" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index 8a51bb3715..323fc1b451 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1616" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1370" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <location x="826" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="-22" y="81"/> </children> <location x="200" y="380"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index 77d7f72129..0f9b9097ab 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1616" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1370" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1" width="199" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="332" y="84"/> </children> <location x="826" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/p1-1" width="199" height="137"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location x="200" y="380"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index 78771f73eb..674800eb16 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="199" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="199" height="70"> <location x="604" y="59"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="199" height="137"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="199" height="137"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="96" y="53"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="199" height="70"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="348" y="59"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1616" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1370" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <location x="826" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="199" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="901" y="113"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="199" height="70"> <location x="1158" y="113"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="200" y="380"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index 61b326f56c..8faa3fb260 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1616" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1370" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="826" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="200" y="380"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type1__Raw__Diagram.xmi index 1ff580e07c..277a10f7ac 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="168" height="80"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="168" height="80"> <location x="35" y="230"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="157" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="157" height="91"> <location x="165" y="130"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="157" height="80"> <location x="40" y="35"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="311" height="234"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="311" height="234"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="30" y="40"/> </children> <location x="425" y="55"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type7__Raw__Diagram.xmi index 4262d59558..7f12754bd8 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="135" height="102"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="234" height="190"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="234" height="190"> <children id="//p2/p2-1" width="309" height="79"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="222" y="200"/> </children> <location x="-22"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="157" height="80"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type8__Raw__Diagram.xmi index 46589d5b23..107804ba89 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="124" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="124" height="69"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="124" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="124" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="309" height="79"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="309" height="79"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="200" y="100"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="309" height="78"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="309" height="78"> <location x="200" y="200"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="179" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="179" height="102"> <children id="//p1/C1-1" width="30" height="30"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type9__Raw__Diagram.xmi index ef0a6b4411..8ea47d4a10 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType8__of__p2___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType8__of__p2___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="113" height="69"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="113" height="69"> <location x="22" y="7"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="87" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="87" height="58"> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="344" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="344" height="91"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="297"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="168" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="168" height="80"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi index 7956bcc8ad..53ff826864 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="227" height="84"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="227" height="84"> <location x="1624" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="220" height="84"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="220" height="84"> <location x="1378" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <location x="834" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="-22" y="80"/> </children> <location x="24" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi index bd2cd3ccc3..69138cab55 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="227" height="84"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="227" height="84"> <location x="1624" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="220" height="84"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="220" height="84"> <location x="1378" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1" width="178" height="85"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="11" y="11"/> </children> <location x="834" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location x="24" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi index 8fe2296dce..1c425ee94d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="227" height="84"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="227" height="84"> <location x="1624" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="220" height="84"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="220" height="84"> <location x="1378" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <location x="834" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="135" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="135" height="69"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="31" y="15"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="124" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="124" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="24" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi index fa96b67153..054fde2308 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedLayout-DiagType9__of__MyPackage___to___storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/raw/from___storedFormat-DiagType9__of__MyPackage___to___storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="227" height="84"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="227" height="84"> <location x="1624" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="220" height="84"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="220" height="84"> <location x="1378" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="31" y="15"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="834" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="24" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType1__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType1__of__MyPackage.xmi new file mode 100644 index 0000000000..74d0f2074a --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType1__of__MyPackage.xmi @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="ASCII"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> + <location x="1644" y="30"/> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> + <location x="30" y="400"/> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> + <location x="30" y="260"/> + </formatdata:NodeFormatData> +</xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType2__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType2__of__MyPackage.xmi index 24405c5e64..8abb2ca943 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType2__of__MyPackage.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType2__of__MyPackage.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="150" height="70"> <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="150" height="70"> <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="401" height="114"> <children id="//p2/p2-1" width="169" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="153" height="53"> <location x="5" y="6"/> @@ -17,8 +17,8 @@ <location x="243" y="36"/> </children> <location x="30" y="260"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="653" height="173"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="653" height="173"> <children id="//p1/C1-1" width="96" height="42"> <outgoingEdges id="//p1/C1-1/aC1-2" sourceTerminal="(0.41666666,0.057142857)" targetTerminal="(0.57894737,0.94285715)"> <label id="//p1/C1-1/aC1-2" width="-1" height="-1"> @@ -68,5 +68,5 @@ <location x="310" y="170"/> </children> <location x="30" y="30"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType3__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType3__of__MyPackage.xmi index 2f89025820..2410e306fd 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType3__of__MyPackage.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType3__of__MyPackage.xmi @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="30" height="30"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="30" height="30"> <label id="//p4"> <location y="5"/> </label> <location x="300" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="30" height="30"> <label id="//p3"> <location y="5"/> </label> <location x="210" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="30" height="30"> <label id="//p2"> <location y="5"/> </label> <location x="120" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="893" height="273"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="893" height="273"> <label id="//p1"> <location y="5"/> </label> <location x="-20" y="80"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType4__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType4__of__MyPackage.xmi new file mode 100644 index 0000000000..d2394e0df9 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType4__of__MyPackage.xmi @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="ASCII"?> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="223" height="80"> + <location x="935"/> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="245" height="80"> + <location x="649"/> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="260" height="80"> + <location x="319"/> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="245" height="80"> + <location/> + </formatdata:NodeFormatData> +</xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType5__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType5__of__MyPackage.xmi index 74c9b30882..7d0a71a775 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType5__of__MyPackage.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType5__of__MyPackage.xmi @@ -1,45 +1,45 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-2/C1-2-1" width="30" height="30"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> </label> <location x="630"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1/new%20EClass%201" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> </label> <location/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1/C1-1-2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1/C1-1-2" width="30" height="30"> <label id="//p1/p1-1/C1-1-2"> <location y="5"/> </label> <location x="540"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/C1-1" width="96" height="35"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/C1-1" width="96" height="35"> <label id="//p1/C1-1"> <location y="5"/> </label> <location x="299" y="278"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1/C1-1-1" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> </label> <location x="450"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/C1-2" width="76" height="35"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/C1-2" width="76" height="35"> <label id="//p1/C1-2"> <location y="5"/> </label> <location x="319" y="148"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/C1-3" width="102" height="63"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/C1-3" width="102" height="63"> <label id="//p1/C1-3"> <location y="5"/> </label> <location x="95" y="148"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType6__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType6__of__MyPackage.xmi index 94ee2ea301..8d6e50cc79 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType6__of__MyPackage.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType6__of__MyPackage.xmi @@ -1,24 +1,24 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-2/C1-2-1" width="30" height="30"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> </label> <location x="539" y="219"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1/new%20EClass%201" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79"/> </label> <location x="119" y="55"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1/C1-1-2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1/C1-1-2" width="30" height="30"> <label id="//p1/p1-1/C1-1-2"> <location y="5"/> </label> <location x="109" y="25"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/C1-1" width="61" height="18"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location x="120" y="-15"/> </label> @@ -56,23 +56,23 @@ <targetRefPoint x="272" y="39"/> </outgoingEdges> <location x="169" y="89"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1/C1-1-1" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location x="57" y="4"/> </label> <location x="267" y="25"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/C1-2" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/C1-2" width="30" height="30"> <label id="//p1/C1-2"> <location x="-41" y="18"/> </label> <location x="481" y="77"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/C1-3" width="30" height="30"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/C1-3" width="30" height="30"> <label id="//p1/C1-3"> <location y="5"/> </label> <location x="66" y="187"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType7__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType7__of__MyPackage.xmi index e9e9e17e01..bc7dbc475a 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType7__of__MyPackage.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType7__of__MyPackage.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1621" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1375" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1" width="199" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="332" y="84"/> </children> <location x="831" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/p1-1" width="199" height="137"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="-22" y="80"/> </children> <location x="20" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType8__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType8__of__MyPackage.xmi index a9ad5dd7f8..0970273dc4 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType8__of__MyPackage.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType8__of__MyPackage.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="199" height="70"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="199" height="70"> <location x="604" y="59"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="199" height="137"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="199" height="137"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="33"/> </children> <location x="96" y="53"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="199" height="70"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="158" y="60"/> </children> <location x="348" y="59"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="188" height="70"> <location x="1616" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="188" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="188" height="70"> <location x="1370" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <location x="826" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="199" height="70"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="901" y="113"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="199" height="70"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="199" height="70"> <location x="1158" y="113"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="81"/> </children> <location x="200" y="380"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType8__of__p2.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType8__of__p2.xmi index 1c87a25ac1..5ec0a7e69b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType8__of__p2.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType8__of__p2.xmi @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="309" height="79"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p2/p2-1" width="309" height="79"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -8,8 +8,8 @@ <location x="-22"/> </children> <location x="200" y="100"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="309" height="78"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="309" height="78"> <location x="200" y="200"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType9__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType9__of__MyPackage.xmi index cf83dbd1de..57c0437d3b 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType9__of__MyPackage.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-DiagType9__of__MyPackage.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="227" height="84"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="227" height="84"> <location x="1624" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="220" height="84"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="220" height="84"> <location x="1378" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="499" height="114"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="499" height="114"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="31" y="15"/> @@ -14,8 +14,8 @@ <location x="-22"/> </children> <location x="834" y="29"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="635" height="323"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="635" height="323"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="498" y="313"/> </children> <location x="24" y="20"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type1__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type1__Raw__Diagram.xmi index 0dd54b459a..ebc6d592c2 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type1__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type1__Raw__Diagram.xmi @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="168" height="80"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="168" height="80"> <location x="35" y="230"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="157" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="157" height="91"> <location x="165" y="130"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="157" height="80"> <location x="40" y="35"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="311" height="234"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="311" height="234"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -38,5 +38,5 @@ <location x="30" y="40"/> </children> <location x="425" y="55"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type7__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type7__Raw__Diagram.xmi index 28170dfb52..3fce404a13 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type7__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type7__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="135" height="102"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="234" height="190"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="234" height="190"> <children id="//p2/p2-1" width="178" height="85"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> @@ -20,8 +20,8 @@ <location x="11" y="11"/> </children> <location x="-22"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="157" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="157" height="80"> <children id="//p1/p1-1" width="174" height="85"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> @@ -68,5 +68,5 @@ <location x="9" y="70"/> </children> <location/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type8__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type8__Raw__Diagram.xmi index 5b07420519..04cb1d5e5e 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type8__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type8__Raw__Diagram.xmi @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p1/p1-3" width="146" height="58"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p1/p1-3" width="146" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-1" width="311" height="113"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-1" width="311" height="113"> <children id="//p1/p1-1/C1-1-1" width="30" height="30"> <label id="//p1/p1-1/C1-1-1"> <location y="5"/> @@ -17,8 +17,8 @@ <location x="-22" y="8"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1/p1-2" width="157" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1/p1-2" width="157" height="58"> <children id="//p1/p1-2/C1-2-1" width="30" height="30"> <label id="//p1/p1-2/C1-2-1"> <location y="5"/> @@ -26,17 +26,17 @@ <location x="6" y="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p4" width="124" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p4" width="124" height="69"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="135" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="135" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="124" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="124" height="102"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-1" width="135" height="69"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-1" width="135" height="69"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location y="5"/> @@ -44,11 +44,11 @@ <location x="-22"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2/p2-2" width="124" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2/p2-2" width="124" height="58"> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="179" height="102"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="179" height="102"> <children id="//p1/C1-1" width="30" height="30"> <label id="//p1/C1-1"> <location y="5"/> @@ -68,5 +68,5 @@ <location x="-22" y="39"/> </children> <location x="-11" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type9__Raw__Diagram.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type9__Raw__Diagram.xmi index 2394edabd6..2bc8de8172 100644 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-Type9__Raw__Diagram.xmi +++ b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedFormat-Type9__Raw__Diagram.xmi @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="113" height="69"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:formatdata="http://www.eclipse.org/sirius/dsl/formatdata/1.1.0"> + <formatdata:NodeFormatData id="//p4" width="113" height="69"> <location x="22" y="7"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="87" height="58"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p3" width="87" height="58"> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="344" height="91"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p2" width="344" height="91"> <children id="//p2/p2-1/new%20EClass%201" width="30" height="30"> <label id="//p2/p2-1/new%20EClass%201"> <location x="-79" y="7"/> @@ -14,8 +14,8 @@ <location x="-22" y="22"/> </children> <location x="297"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="168" height="80"> + </formatdata:NodeFormatData> + <formatdata:NodeFormatData id="//p1" width="168" height="80"> <children id="//p1/C1-1" width="61" height="18"> <label id="//p1/C1-1"> <location y="5"/> @@ -53,5 +53,5 @@ <location x="4" y="70"/> </children> <location x="22" y="11"/> - </layoutdata:NodeLayoutData> + </formatdata:NodeFormatData> </xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType1__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType1__of__MyPackage.xmi deleted file mode 100644 index b604102883..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType1__of__MyPackage.xmi +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="150" height="70"> - <location x="1644" y="30"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="150" height="70"> - <location x="30" y="400"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="401" height="114"> - <location x="30" y="260"/> - </layoutdata:NodeLayoutData> -</xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType4__of__MyPackage.xmi b/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType4__of__MyPackage.xmi deleted file mode 100644 index ef50a8b3bf..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/data/unit/layout/data/xmi/storedLayout-DiagType4__of__MyPackage.xmi +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="ASCII"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:layoutdata="http://www.eclipse.org/sirius/dsl/layoutdata/1.1.0"> - <layoutdata:NodeLayoutData id="//p4" width="223" height="80"> - <location x="935"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p3" width="245" height="80"> - <location x="649"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p2" width="260" height="80"> - <location x="319"/> - </layoutdata:NodeLayoutData> - <layoutdata:NodeLayoutData id="//p1" width="245" height="80"> - <location/> - </layoutdata:NodeLayoutData> -</xmi:XMI> diff --git a/plugins/org.eclipse.sirius.tests.junit/plugin.xml b/plugins/org.eclipse.sirius.tests.junit/plugin.xml index 2fbf2e376a..8cb2f8f542 100644 --- a/plugins/org.eclipse.sirius.tests.junit/plugin.xml +++ b/plugins/org.eclipse.sirius.tests.junit/plugin.xml @@ -72,14 +72,21 @@ </constraintProvider> </extension> <extension + point="org.eclipse.sirius.diagram.ui.formatDataManager"> + <formatDataManagerProvider + class="org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleDataProvider" + id="sampleDataProvider"> + </formatDataManagerProvider> + <formatDataManagerProvider + class="org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider" + id="sampleNameDataProvider"> + </formatDataManagerProvider> + </extension> + <extension point="org.eclipse.sirius.diagram.ui.layoutDataManager"> <layoutDataManagerProvider class="org.eclipse.sirius.tests.unit.diagram.layout.data.manager.extension.SampleDataProvider" - id="sampleDataProvider"> - </layoutDataManagerProvider> - <layoutDataManagerProvider - class="org.eclipse.sirius.tests.unit.diagram.layout.data.manager.extension.SampleNameDataProvider" - id="sampleNameDataProvider"> + id="sampleDataProviderDeprecatedExtensionPoint"> </layoutDataManagerProvider> </extension> </plugin> diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java index e9b4c03d5f..d2c2c9134d 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramPluginsTests.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 @@ -10,11 +10,6 @@ *******************************************************************************/ package org.eclipse.sirius.tests.suite.diagram; -import junit.framework.JUnit4TestAdapter; -import junit.framework.Test; -import junit.framework.TestSuite; -import junit.textui.TestRunner; - import org.eclipse.core.runtime.Platform; import org.eclipse.sirius.tests.suite.diagram.sequence.AllSequenceDiagramsPluginTests; import org.eclipse.sirius.tests.support.api.TestsUtil; @@ -120,6 +115,14 @@ import org.eclipse.sirius.tests.unit.diagram.folding.ContainerFoldingTest; import org.eclipse.sirius.tests.unit.diagram.folding.FoldingPointsIdentificationTest; import org.eclipse.sirius.tests.unit.diagram.folding.FoldingQueriesTest; import org.eclipse.sirius.tests.unit.diagram.folding.NodeFoldingTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.FormatHelperImplEdgeFormatDataTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.FormatHelperImplNodeFormatData1Test; +import org.eclipse.sirius.tests.unit.diagram.format.data.FormatHelperImplNodeFormatData2Test; +import org.eclipse.sirius.tests.unit.diagram.format.data.SiriusFormatDataManagerForDDiagramElementWithSameSemanticElementsTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.SiriusFormatDataManagerForSemanticElementsApplyWithPredefinedDataTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.SiriusFormatDataManagerForSemanticElementsStoreWithPredefinedDataTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.SiriusFormatDataManagerForSemanticElementsTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.FormatDataManagerSelectionTest; import org.eclipse.sirius.tests.unit.diagram.layers.ActivateDeactivateOptionalLayersTest; import org.eclipse.sirius.tests.unit.diagram.layers.LayerEdgeOnEdgeTest; import org.eclipse.sirius.tests.unit.diagram.layers.Layers1203Tests; @@ -134,10 +137,6 @@ import org.eclipse.sirius.tests.unit.diagram.layout.data.LabelPositionOnContaine import org.eclipse.sirius.tests.unit.diagram.layout.data.LayoutHelperImplEdgeLayoutDataTest; import org.eclipse.sirius.tests.unit.diagram.layout.data.LayoutHelperImplNodeLayoutData1Test; import org.eclipse.sirius.tests.unit.diagram.layout.data.LayoutHelperImplNodeLayoutData2Test; -import org.eclipse.sirius.tests.unit.diagram.layout.data.SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTest; -import org.eclipse.sirius.tests.unit.diagram.layout.data.SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTest; -import org.eclipse.sirius.tests.unit.diagram.layout.data.SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTest; -import org.eclipse.sirius.tests.unit.diagram.layout.data.SiriusLayoutDataManagerForSemanticElementsTest; import org.eclipse.sirius.tests.unit.diagram.layout.data.manager.extension.LayoutDataManagerSelectionTest; import org.eclipse.sirius.tests.unit.diagram.layout.margin.BorderMarginTest; import org.eclipse.sirius.tests.unit.diagram.layout.pinning.PinnedElementsTest; @@ -238,6 +237,11 @@ import org.eclipse.sirius.tests.unit.perf.diagram.refresh.connections.DCompartme import org.eclipse.sirius.tests.unit.table.unit.migration.InitializeElementsToSelectExpressionForTableMigrationTest; import org.eclipse.sirius.tests.unit.table.unit.tools.SelectionInTableAfterToolExecutionTest; +import junit.framework.JUnit4TestAdapter; +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.textui.TestRunner; + public class AllDiagramPluginsTests { /** @@ -396,9 +400,13 @@ public class AllDiagramPluginsTests { suite.addTestSuite(LayoutHelperImplEdgeLayoutDataTest.class); suite.addTestSuite(LayoutHelperImplNodeLayoutData1Test.class); suite.addTestSuite(LayoutHelperImplNodeLayoutData2Test.class); + suite.addTestSuite(FormatHelperImplEdgeFormatDataTest.class); + suite.addTestSuite(FormatHelperImplNodeFormatData1Test.class); + suite.addTestSuite(FormatHelperImplNodeFormatData2Test.class); - suite.addTestSuite(SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTest.class); suite.addTestSuite(LayoutDataManagerSelectionTest.class); + suite.addTestSuite(SiriusFormatDataManagerForDDiagramElementWithSameSemanticElementsTest.class); + suite.addTestSuite(FormatDataManagerSelectionTest.class); suite.addTestSuite(LabelPositionOnContainerAndListTest.class); suite.addTestSuite(LabelVisibilityOnDragAndDropTests.class); suite.addTestSuite(LabelVisibilityOnCreationTest.class); @@ -517,8 +525,8 @@ public class AllDiagramPluginsTests { String platformVersion = Platform.getBundle("org.eclipse.core.runtime").getHeaders().get("Bundle-Version"); if (!platformVersion.startsWith("3.5")) { - suite.addTestSuite(SiriusLayoutDataManagerForSemanticElementsTest.class); - suite.addTest(new JUnit4TestAdapter(SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTest.class)); + suite.addTestSuite(SiriusFormatDataManagerForSemanticElementsTest.class); + suite.addTest(new JUnit4TestAdapter(SiriusFormatDataManagerForSemanticElementsStoreWithPredefinedDataTest.class)); } } @@ -533,7 +541,7 @@ public class AllDiagramPluginsTests { String platformVersion = Platform.getBundle("org.eclipse.core.runtime").getHeaders().get("Bundle-Version"); if (!platformVersion.startsWith("3.5") && TestsUtil.shouldRunLongTests()) { // This one is long (~9 minutes), so it is ignored when running - suite.addTest(new JUnit4TestAdapter(SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTest.class)); + suite.addTest(new JUnit4TestAdapter(SiriusFormatDataManagerForSemanticElementsApplyWithPredefinedDataTest.class)); } suite.addTestSuite(TablesAndEntitiesDirtyTest.class); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramStandaloneTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramStandaloneTests.java index 77723fb851..a89da69241 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramStandaloneTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/diagram/AllDiagramStandaloneTests.java @@ -14,6 +14,8 @@ import org.eclipse.sirius.tests.suite.diagram.sequence.AllSequenceDiagramsStanda import org.eclipse.sirius.tests.unit.api.mappings.ImportSpecClassesUnsetTests; import org.eclipse.sirius.tests.unit.common.mock.OpaquePixelFinderTest; import org.eclipse.sirius.tests.unit.diagram.DDiagramDAnnotationTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.SemanticEdgeFormatDataKeyTest; +import org.eclipse.sirius.tests.unit.diagram.format.data.SemanticNodeFormatDataKeyTest; import org.eclipse.sirius.tests.unit.diagram.layers.EdgeMappingImportTests; import org.eclipse.sirius.tests.unit.diagram.layout.data.SemanticEdgeLayoutDataKeyTest; import org.eclipse.sirius.tests.unit.diagram.layout.data.SemanticNodeLayoutDataKeyTest; @@ -74,6 +76,8 @@ public class AllDiagramStandaloneTests { suite.addTestSuite(ViewpointItemTest.class); suite.addTestSuite(SemanticNodeLayoutDataKeyTest.class); suite.addTestSuite(SemanticEdgeLayoutDataKeyTest.class); + suite.addTestSuite(SemanticNodeFormatDataKeyTest.class); + suite.addTestSuite(SemanticEdgeFormatDataKeyTest.class); suite.addTestSuite(DDiagramInternalQueryTest.class); suite.addTestSuite(DDiagramElementQueryTest.class); suite.addTestSuite(CreateInstanceOperationTest.class); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractFormatHelperImplNodeFormatDataTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractFormatHelperImplNodeFormatDataTest.java new file mode 100644 index 0000000000..93d61e666c --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractFormatHelperImplNodeFormatDataTest.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import java.util.Iterator; + +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.FormatHelper; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.ConfigurationFactory; + +import com.google.common.collect.Iterables; + +/** + * Test class. + * + * @author dlecan + */ +public abstract class AbstractFormatHelperImplNodeFormatDataTest extends AbstractFormatHelperImplTest<NodeFormatData> { + + private final class NodeFormatDataWrapper extends FormatDataWrapper { + /** + * @param formatData + */ + private NodeFormatDataWrapper(final NodeFormatData formatData) { + super(formatData); + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean doEquals(final NodeFormatData otherFormatData) { + return FormatHelper.INSTANCE.haveSameLayout(getThisFormatData(), otherFormatData, ConfigurationFactory.buildConfiguration()); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected AbstractFormatHelperImplTest<NodeFormatData>.FormatDataWrapper createWrappedInstance(final NodeFormatData from) throws Exception { + final NodeFormatData nodeFormatData = (NodeFormatData) EcoreUtil.copy(from); + return new NodeFormatDataWrapper(nodeFormatData); + } + + /** + * {@inheritDoc} + */ + @Override + protected AbstractFormatHelperImplTest<NodeFormatData>.FormatDataWrapper createWrappedNotEqualInstance() throws Exception { + final Iterator<? extends NodeFormatData> iterator = getManager().getRootNodeFormatData().values().iterator(); + iterator.next(); + return new NodeFormatDataWrapper(iterator.next()); + } + + /** + * {@inheritDoc} + */ + @Override + protected NodeFormatData getReferenceFormatData() { + return Iterables.get(getManager().getRootNodeFormatData().values(), getIndexOfReferenceFormatData()); + } + + /** + * Get position of reference format data. + * + * @return Position of reference format data. + */ + protected abstract int getIndexOfReferenceFormatData(); + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractFormatHelperImplTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractFormatHelperImplTest.java new file mode 100644 index 0000000000..b2045db6d2 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractFormatHelperImplTest.java @@ -0,0 +1,287 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.diagram.ui.tools.internal.format.AdvancedSiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; +import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.SiriusAssert; +import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; +import org.eclipse.sirius.tests.support.api.TestsUtil; +import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; +import org.junit.Assert; + +import junit.framework.AssertionFailedError; + +/** + * Common behavior for all FormatHelperImpl tests. + * + * @author dlecan + * @param <T> + * Type of format data. + */ +public abstract class AbstractFormatHelperImplTest<T extends AbstractFormatData> extends SiriusDiagramTestCase { + + /** + * Inner class to wrap format data. + * + * @author dlecan + */ + protected abstract class FormatDataWrapper { + /** + * Constructor. + * + * @param formatData + */ + protected FormatDataWrapper(final T formatData) { + this.formatData = formatData; + } + + private final T formatData; + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(final Object obj) { + boolean result = false; + if (obj instanceof AbstractFormatHelperImplTest<?>.FormatDataWrapper) { + result = doEquals(((AbstractFormatHelperImplTest<T>.FormatDataWrapper) obj).formatData); + } + return result; + } + + protected abstract boolean doEquals(T otherFormatData); + + /** + * Returns the formatData. + * + * @return The formatData. + */ + protected T getThisFormatData() { + return formatData; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return "Format data ID: " + formatData.getId(); + } + + } + + private static final int NUM_ITERATIONS = 20; + + private static final String DATA_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/layout/data/"; + + private static final String SEMANTIC_MODEL_PATH = DATA_PATH + "My.ecore"; + + private static final String MODELER_PATH = DATA_PATH + "My.odesign"; + + private static final String REPRESENTATIONS_PATH = DATA_PATH + "My.aird"; + + private static final String REPRESENTATION_DESC_NAME = "DiagType2"; + + private AdvancedSiriusFormatDataManager manager; + + private DDiagram diagram; + + private DiagramEditor editorPart; + + private T referenceFormatData; + + private Object eq1; + + private Object eq2; + + private Object eq3; + + private Object neq; + + /** + * {@inheritDoc} + */ + @Override + protected void setUp() throws Exception { + super.setUp(); + + manager = new SiriusFormatDataManagerForSemanticElements(); + genericSetUp(SEMANTIC_MODEL_PATH, MODELER_PATH, REPRESENTATIONS_PATH); + diagram = (DDiagram) getRepresentations(REPRESENTATION_DESC_NAME).toArray()[0]; + + editorPart = (DiagramEditor) DialectUIManager.INSTANCE.openEditor(session, diagram, new NullProgressMonitor()); + TestsUtil.synchronizationWithUIThread(); + + final DiagramEditPart diagramEditPart = editorPart.getDiagramEditPart(); + + manager.storeFormatData(diagramEditPart); + + referenceFormatData = getReferenceFormatData(); + + eq1 = createWrappedInstance(referenceFormatData); + eq2 = createWrappedInstance(referenceFormatData); + eq3 = createWrappedInstance(referenceFormatData); + neq = createWrappedNotEqualInstance(); + + // We want these assertions to yield errors, not failures. + try { + assertNotNull("createInstance() returned null", eq1); + assertNotNull("2nd createInstance() returned null", eq2); + assertNotNull("3rd createInstance() returned null", eq3); + assertNotNull("createNotEqualInstance() returned null", neq); + + Assert.assertNotSame(eq1, eq2); + Assert.assertNotSame(eq1, eq3); + Assert.assertNotSame(eq1, neq); + Assert.assertNotSame(eq2, eq3); + Assert.assertNotSame(eq2, neq); + Assert.assertNotSame(eq3, neq); + + assertEquals("1st and 2nd equal instances of different classes", eq1.getClass(), eq2.getClass()); + assertEquals("1st and 3rd equal instances of different classes", eq1.getClass(), eq3.getClass()); + assertEquals("1st equal instance and not-equal instance of different classes", eq1.getClass(), neq.getClass()); + } catch (final AssertionFailedError ex) { + throw new IllegalArgumentException(ex.getMessage(), ex); + } + } + + /** + * Creates and returns an instance of the class under test. + * + * @param from + * Data to use to create a new instance. + * @return a new instance of the class under test; each object returned from + * this method should compare equal to each other. + * @throws Exception + * Creation error. + */ + protected abstract AbstractFormatHelperImplTest<T>.FormatDataWrapper createWrappedInstance(T from) throws Exception; + + /** + * Creates and returns an instance of the class under test. + * + * @return a new instance of the class under test; each object returned from + * this method should compare equal to each other, but not to the + * objects returned from {@link #createInstance() createInstance}. + * @throws Exception + * Creation error. + */ + protected abstract AbstractFormatHelperImplTest<T>.FormatDataWrapper createWrappedNotEqualInstance() throws Exception; + + /** + * Get reference format data. + * + * @return + */ + protected abstract T getReferenceFormatData(); + + /** + * Tests whether <code>equals</code> holds up against a new + * <code>Object</code> (should always be <code>false</code>). + */ + public final void testHaveSameFormatAgainstNewObject() { + final Object o = new Object(); + + SiriusAssert.assertNotEquals(eq1, o); + SiriusAssert.assertNotEquals(eq2, o); + SiriusAssert.assertNotEquals(eq3, o); + SiriusAssert.assertNotEquals(neq, o); + } + + /** + * Tests whether <code>equals</code> holds up against <code>null</code>. + */ + public final void testHaveSameFormatAgainstNull() { + SiriusAssert.assertNotEquals("1st vs. null", eq1, null); + SiriusAssert.assertNotEquals("2nd vs. null", eq2, null); + SiriusAssert.assertNotEquals("3rd vs. null", eq3, null); + SiriusAssert.assertNotEquals("not-equal vs. null", neq, null); + } + + /** + * Tests whether <code>equals</code> holds up against objects that should + * not compare equal. + */ + public final void testHaveSameFormatAgainstUnequalObjects() { + SiriusAssert.assertNotEquals("1st vs. not-equal", eq1, neq); + SiriusAssert.assertNotEquals("2nd vs. not-equal", eq2, neq); + SiriusAssert.assertNotEquals("3rd vs. not-equal", eq3, neq); + + SiriusAssert.assertNotEquals("not-equal vs. 1st", neq, eq1); + SiriusAssert.assertNotEquals("not-equal vs. 2nd", neq, eq2); + SiriusAssert.assertNotEquals("not-equal vs. 3rd", neq, eq3); + } + + /** + * Tests whether <code>equals</code> is <em>consistent</em>. + */ + public final void testHaveSameFormatIsConsistentAcrossInvocations() { + for (int i = 0; i < NUM_ITERATIONS; ++i) { + testHaveSameFormatAgainstNewObject(); + testHaveSameFormatAgainstNull(); + testHaveSameFormatAgainstUnequalObjects(); + testHaveSameFormatIsReflexive(); + testHaveSameFormatIsSymmetricAndTransitive(); + } + } + + /** + * Tests whether <code>equals</code> is <em>reflexive</em>. + */ + public final void testHaveSameFormatIsReflexive() { + assertEquals("1st equal instance", eq1, eq1); + assertEquals("2nd equal instance", eq2, eq2); + assertEquals("3rd equal instance", eq3, eq3); + assertEquals("not-equal instance", neq, neq); + } + + /** + * Tests whether <code>equals</code> is <em>symmetric</em> and + * <em>transitive</em>. + */ + public final void testHaveSameFormatIsSymmetricAndTransitive() { + assertEquals("1st vs. 2nd", eq1, eq2); + assertEquals("2nd vs. 1st", eq2, eq1); + + assertEquals("1st vs. 3rd", eq1, eq3); + assertEquals("3rd vs. 1st", eq3, eq1); + + assertEquals("2nd vs. 3rd", eq2, eq3); + assertEquals("3rd vs. 2nd", eq3, eq2); + } + + /** + * Returns the manager. + * + * @return The manager. + */ + protected AdvancedSiriusFormatDataManager getManager() { + return manager; + } + + /** + * {@inheritDoc} + */ + @Override + protected void tearDown() throws Exception { + DialectUIManager.INSTANCE.closeEditor(editorPart, false); + TestsUtil.emptyEventsFromUIThread(); + super.tearDown(); + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractSemanticFormatDataKeyTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractSemanticFormatDataKeyTest.java new file mode 100644 index 0000000000..670ae102af --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractSemanticFormatDataKeyTest.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EcoreFactory; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.impl.ResourceImpl; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticNodeFormatDataKey; +import org.eclipse.sirius.tests.support.api.EqualsHashCodeTestCase; + +/** + * Comme behavior for *FormatDataKey tests. + * + * @author dlecan + */ +public abstract class AbstractSemanticFormatDataKeyTest extends EqualsHashCodeTestCase { + + /** + * {@inheritDoc} + */ + @Override + protected Object createInstance() throws Exception { + final Resource resource = new ResourceImpl(URI.createURI("urn://truc")); + final EClass createEClass = EcoreFactory.eINSTANCE.createEClass(); + + resource.getContents().add(createEClass); + resource.getContents().add(EcoreFactory.eINSTANCE.createEClass()); + + return new SemanticNodeFormatDataKey(createEClass); + } + + /** + * {@inheritDoc} + */ + @Override + protected Object createNotEqualInstance() throws Exception { + final Resource resource = new ResourceImpl(URI.createURI("http://bidule")); + final EPackage createEPackage = EcoreFactory.eINSTANCE.createEPackage(); + + resource.getContents().add(EcoreFactory.eINSTANCE.createEPackage()); + resource.getContents().add(createEPackage); + + return new SemanticNodeFormatDataKey(createEPackage); + } + + protected abstract FormatDataKey createFormatDataKey(EObject eObject); + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractSiriusFormatDataManagerForSemanticElementsTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractSiriusFormatDataManagerForSemanticElementsTest.java new file mode 100644 index 0000000000..32469a49ec --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/AbstractSiriusFormatDataManagerForSemanticElementsTest.java @@ -0,0 +1,414 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.gef.editparts.ZoomManager; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; +import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.FormatHelper; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.FormatHelper.FormatDifference; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.Configuration; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataHelper; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.AdvancedSiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; +import org.eclipse.sirius.ecore.extender.tool.api.ModelUtils; +import org.eclipse.sirius.tests.SiriusTestsPlugin; +import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; +import org.eclipse.sirius.tests.support.api.TestsUtil; +import org.eclipse.sirius.ui.business.api.dialect.DialectEditor; +import org.eclipse.sirius.ui.business.api.dialect.DialectUIManager; +import org.eclipse.sirius.ui.business.api.preferences.SiriusUIPreferencesKeys; +import org.eclipse.sirius.ui.business.api.session.SessionUIManager; +import org.eclipse.sirius.viewpoint.DRepresentation; +import org.eclipse.sirius.viewpoint.impl.DRepresentationImpl; +import org.eclipse.ui.IEditorPart; + +import com.google.common.base.Predicate; +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; + +/** + * Test class for {@link SiriusFormatDataManagerForSemanticElements}. + * + * @author dlecan + */ +public class AbstractSiriusFormatDataManagerForSemanticElementsTest extends SiriusDiagramTestCase { + + protected static final boolean REGENERATE_TEST_DATA = false; + + protected static final Comparator<DRepresentation> USING_NAME = new Comparator<DRepresentation>() { + @Override + public int compare(final DRepresentation o1, final DRepresentation o2) { + return o1.getName().compareTo(o2.getName()); + } + }; + + protected static final Predicate<Diagram> NO_RAW_DIAGRAM = new Predicate<Diagram>() { + @Override + public boolean apply(final Diagram input) { + return !input.raw; + } + }; + + protected static class Representation { + protected final String name; + + protected final List<Diagram> diagrams; + + protected Representation(final String name, final Diagram... diagrams) { + this.name = name; + this.diagrams = Arrays.asList(diagrams); + for (final Diagram diagram : diagrams) { + diagram.parent = Representation.this; + } + } + } + + protected static class Diagram { + + protected Representation parent; + + protected final String name; + + protected final int numberOfNodeFormatData; + + protected final int numberOfEdgeFormatData; + + protected boolean raw = false; + + protected DiagramEditPart diagramEditPart; + + protected DiagramEditor rawDiagramEditor; + + protected Diagram(final String name, final int numberOfNodeFormatData, final int numberOfEdgeFormatData) { + this.name = name; + this.numberOfNodeFormatData = numberOfNodeFormatData; + this.numberOfEdgeFormatData = numberOfEdgeFormatData; + } + + protected Diagram(final String name, final int numberOfNodeFormatData, final int numberOfEdgeFormatData, final boolean raw) { + this.name = name; + this.numberOfNodeFormatData = numberOfNodeFormatData; + this.numberOfEdgeFormatData = numberOfEdgeFormatData; + this.raw = raw; + } + } + + protected static final int ITERATIONS = 20; + + protected static final String XMI_PREFIX = "storedFormat-"; + + protected static final String XMI_EXTENSION = ".xmi"; + + protected static final String PLUGIN_PATH = "/" + SiriusTestsPlugin.PLUGIN_ID + "/"; + + protected static final String DATA_PATH = "data/unit/layout/data/"; + + protected static final String FULL_DATA_PATH = PLUGIN_PATH + DATA_PATH; + + protected static final String XMI_FOLDER = "xmi/"; + + protected static final String RAW_FOLDER = "raw/"; + + protected static final String SEMANTIC_MODEL_NAME = "My.ecore"; + + protected static final String SESSION_MODEL_NAME = "My.aird"; + + protected static final String MODELER_NAME = "My.odesign"; + + protected static final Diagram DIAG_TYPE1_MYPACKAGE = new Diagram("DiagType1 of MyPackage", 3, 0); + + protected static final Diagram DIAG_TYPE1_RAW = new Diagram("Type1 Raw Diagram", 7, 1, true); + + protected static final Representation REPRES_TYPE1 = new Representation("DiagType1", DIAG_TYPE1_MYPACKAGE, DIAG_TYPE1_RAW); + + // + protected static final Diagram DIAG_TYPE2_MYPACKAGE = new Diagram("DiagType2 of MyPackage", 16, 2); + + protected static final Representation REPRES_TYPE2 = new Representation("DiagType2", DIAG_TYPE2_MYPACKAGE); + + // + protected static final Diagram DIAG_TYPE3_MYPACKAGE = new Diagram("DiagType3 of MyPackage", 4, 0); + + protected static final Representation REPRES_TYPE3 = new Representation("DiagType3", DIAG_TYPE3_MYPACKAGE); + + // + protected static final Diagram DIAG_TYPE4_MYPACKAGE = new Diagram("DiagType4 of MyPackage", 4, 0); + + protected static final Representation REPRES_TYPE4 = new Representation("DiagType4", DIAG_TYPE4_MYPACKAGE); + + // + protected static final Diagram DIAG_TYPE5_MYPACKAGE = new Diagram("DiagType5 of MyPackage", 7, 0); + + protected static final Representation REPRES_TYPE5 = new Representation("DiagType5", DIAG_TYPE5_MYPACKAGE); + + protected static final Diagram DIAG_TYPE6_MYPACKAGE = new Diagram("DiagType6 of MyPackage", 7, 2); + + private static final Representation REPRES_TYPE6 = new Representation("DiagType6", DIAG_TYPE6_MYPACKAGE); + + protected static final Diagram DIAG_TYPE7_MYPACKAGE = new Diagram("DiagType7 of MyPackage", 16, 0); + + protected static final Diagram DIAG_TYPE7_RAW = new Diagram("Type7 Raw Diagram", 16, 0, true); + + protected static final Representation REPRES_TYPE7 = new Representation("DiagType7", DIAG_TYPE7_MYPACKAGE, DIAG_TYPE7_RAW); + + protected static final Diagram DIAG_TYPE8_MYPACKAGE = new Diagram("DiagType8 of MyPackage", 16, 0); + + protected static final Diagram DIAG_TYPE8_P2 = new Diagram("DiagType8 of p2", 3, 0); + + protected static final Diagram DIAG_TYPE8_RAW = new Diagram("Type8 Raw Diagram", 16, 0, true); + + protected static final Representation REPRES_TYPE8 = new Representation("DiagType8", DIAG_TYPE8_MYPACKAGE, DIAG_TYPE8_P2, DIAG_TYPE8_RAW); + + protected static final Diagram DIAG_TYPE9_MYPACKAGE = new Diagram("DiagType9 of MyPackage", 11, 0); + + protected static final Diagram DIAG_TYPE9_RAW = new Diagram("Type9 Raw Diagram", 11, 0, true); + + protected static final Representation REPRES_TYPE9 = new Representation("DiagType9", DIAG_TYPE9_MYPACKAGE, DIAG_TYPE9_RAW); + + protected static final Representation[] ALL_REPRESENTATIONS = { REPRES_TYPE1, REPRES_TYPE2, REPRES_TYPE3, REPRES_TYPE4, REPRES_TYPE5, REPRES_TYPE6, REPRES_TYPE7, REPRES_TYPE8, REPRES_TYPE9 }; + + protected static final String[][] ENCODED_CHARS = { { " ", "__" } }; + + protected final List<IEditorPart> editorParts = Lists.newArrayList(); + + protected static final double LOW_ZOOM_LEVEL = 0.50; + + // Really, shouldn't be higher than 15px + protected static final double LOW_ZOOM_DISTANCE = 15; + + protected static final double IDENTITY_ZOOM_LEVEL = 1.0; + + protected static final double IDENTITY_ZOOM_DISTANCE = 15; + + protected static final double HIGH_ZOOM_LEVEL = 40.0; + + // Really, shouldn't be higher than 15px + protected static final double HIGH_ZOOM_DISTANCE = 15; + + protected static final double[][] ALL_ZOOM_DATA = { { LOW_ZOOM_LEVEL, LOW_ZOOM_DISTANCE }, { IDENTITY_ZOOM_LEVEL, IDENTITY_ZOOM_DISTANCE }, { HIGH_ZOOM_LEVEL, HIGH_ZOOM_DISTANCE } }; + + /** + * {@inheritDoc} + */ + @Override + protected void setUp() throws Exception { + super.setUp(); + String representationsPath = PLUGIN_PATH + getPlatformRelatedDataPath() + SESSION_MODEL_NAME; + String semanticPath = PLUGIN_PATH + getPlatformRelatedDataPath() + SEMANTIC_MODEL_NAME; + String modelerPath = PLUGIN_PATH + getPlatformRelatedDataPath() + MODELER_NAME; + genericSetUp(semanticPath, modelerPath, representationsPath); + + // Disable refresh on opening + changeSiriusUIPreference(SiriusUIPreferencesKeys.PREF_REFRESH_ON_REPRESENTATION_OPENING.name(), false); + TestsUtil.emptyEventsFromUIThread(); + } + + protected void changeZoomLevel(Diagram diagram, double zoomLevel) { + ZoomManager zoomManager = ((DiagramRootEditPart) diagram.diagramEditPart.getRoot()).getZoomManager(); + if (zoomManager.getZoom() != zoomLevel) { + zoomManager.setZoom(zoomLevel); + } + } + + protected List<Diagram> openAllDiagramsInRepresentation(final Representation representation) { + return openAllDiagramsInRepresentation(representation, false); + } + + protected List<Diagram> openAllDiagramsInRepresentation(final Representation representation, boolean rawFiltered) { + + final List<Diagram> result = Lists.newArrayList(); + + final List<DRepresentation> allDDiagrams = Lists.newArrayList(getRepresentations(representation.name)); + + assertEquals("The number of expected diagrams is wrong", representation.diagrams.size(), allDDiagrams.size()); + + Collections.sort(allDDiagrams, USING_NAME); + + Iterable<Diagram> diagrams; + if (rawFiltered) { + // Raw diagram must be excluded, it is "special" + diagrams = Iterables.filter(representation.diagrams, NO_RAW_DIAGRAM); + } else { + diagrams = representation.diagrams; + } + + for (final Diagram diagram : diagrams) { + + final DRepresentation key = new DRepresentationImpl() { + + /** + * {@inheritDoc} + */ + @Override + public String getName() { + return diagram.name; + } + }; + + final int search = Collections.binarySearch(allDDiagrams, key, USING_NAME); + + assertTrue("Diagram is not found in representation", search > -1); + + final DDiagram dDiagram = (DDiagram) allDDiagrams.get(search); + + final IEditorPart editorPart = DialectUIManager.INSTANCE.openEditor(session, dDiagram, new NullProgressMonitor()); + TestsUtil.synchronizationWithUIThread(); + editorParts.add(editorPart); + + final DiagramEditPart diagramEditPart = ((DiagramEditor) editorPart).getDiagramEditPart(); + + diagram.diagramEditPart = diagramEditPart; + + result.add(diagram); + } + + return result; + } + + protected List<Diagram> getAndOpenAllDiagrams() { + return getAndOpenAllDiagrams(false); + } + + protected List<Diagram> getAndOpenAllDiagrams(boolean rawFiltered) { + final List<Diagram> result = Lists.newArrayList(); + for (final Representation representation : ALL_REPRESENTATIONS) { + result.addAll(openAllDiagramsInRepresentation(representation, rawFiltered)); + } + return result; + } + + protected String encodeDiagramName(final Diagram diagram) { + String diagramName = diagram.name; + + for (final String[] couple : ENCODED_CHARS) { + diagramName = diagramName.replaceAll(couple[0], couple[1]); + } + + return XMI_PREFIX + diagramName; + } + + protected DiagramEditPart openRawDiagram(final Diagram diagram) { + for (final DRepresentation representation : getRepresentations(diagram.parent.name)) { + final DDiagram dDiagram = (DDiagram) representation; + + if (diagram.name.equals(dDiagram.getName())) { + diagram.rawDiagramEditor = (DiagramEditor) DialectUIManager.INSTANCE.openEditor(session, dDiagram, new NullProgressMonitor()); + TestsUtil.synchronizationWithUIThread(); + break; + } + } + diagram.diagramEditPart = diagram.rawDiagramEditor.getDiagramEditPart(); + return diagram.diagramEditPart; + } + + protected void closeRawDiagram(final Diagram diagram) { + SessionUIManager.INSTANCE.getUISession(session).closeEditors(false, (DialectEditor) diagram.rawDiagramEditor); + TestsUtil.synchronizationWithUIThread(); + } + + protected FormatDifference<?> loadAndCompare(final Diagram diag, final String path, AdvancedSiriusFormatDataManager newManager, Configuration configuration) throws IOException { + // Load referenced data + final List<EObject> contents = loadReferenceData(path); + + // Data will be sorted by keys, which are comparable + final Map<FormatDataKey, EObject> expected = new TreeMap<FormatDataKey, EObject>(); + for (final EObject eObject : contents) { + final FormatDataKey key = FormatDataHelper.INSTANCE.createKey((AbstractFormatData) eObject); + expected.put(key, eObject); + } + + // Sort elements, SemanticNodeFormatDataKey are comparable + final Map<FormatDataKey, AbstractFormatData> rootNodeFormatData = new TreeMap<FormatDataKey, AbstractFormatData>(newManager.getRootNodeFormatData()); + + // Compare results + final FormatDifference<?> difference = FormatHelper.INSTANCE.computeFirstFormatDifference(expected.values(), rootNodeFormatData.values(), configuration); + return difference; + } + + // Let this "unused" method, as it can be enabled to save diagram format + // data + // Data will be saved in org.eclipse.sirius.tests project folder + protected void saveDiagram(final Diagram diagram, final Collection<? extends AbstractFormatData> formatData) throws IOException { + final String pathName = getPlatformRelatedXmiDataPath() + encodeDiagramName(diagram) + XMI_EXTENSION; + saveDiagram(formatData, pathName); + } + + protected void saveDiagram(final Collection<? extends AbstractFormatData> formatData, final String path) throws IOException { + final ResourceSet resourceSet = new ResourceSetImpl(); + final URI uri = URI.createFileURI(path); + final Resource resource = ModelUtils.createResource(uri, resourceSet); + resource.getContents().addAll(formatData); + resource.save(Collections.EMPTY_MAP); + } + + protected List<EObject> loadReferenceData(final String path) throws IOException { + final ResourceSet resourceSet = new ResourceSetImpl(); + final URI uri = URI.createPlatformPluginURI(path, true); + final Resource resource = ModelUtils.createResource(uri, resourceSet); + resource.load(Collections.EMPTY_MAP); + + return resource.getContents(); + } + + /** + * {@inheritDoc} + */ + @Override + protected void tearDown() throws Exception { + for (final IEditorPart editorPart : editorParts) { + DialectUIManager.INSTANCE.closeEditor(editorPart, false); + editorPart.getSite().getPage().closeEditor(editorPart, false); + } + super.tearDown(); + + } + + protected String getPlatformRelatedFullXmiDataPath() { + return PLUGIN_PATH + getPlatformRelatedXmiDataPath(); + } + + protected String getPlatformRelatedXmiDataPath() { + return getPlatformRelatedDataPath() + XMI_FOLDER; + } + + protected String getPlatformRelatedDataPath() { + String path = DATA_PATH; + String platformVersion = (String) Platform.getBundle("org.eclipse.core.runtime").getHeaders().get("Bundle-Version"); + if (platformVersion.startsWith("3.3") || platformVersion.startsWith("3.4") || platformVersion.startsWith("3.5")) { + path = DATA_PATH + "3.5/"; + } else if (platformVersion.startsWith("3.6")) { + path = DATA_PATH + "3.6/"; + } + return path; + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplEdgeFormatDataTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplEdgeFormatDataTest.java new file mode 100644 index 0000000000..7cc3c39a87 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplEdgeFormatDataTest.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import java.util.Iterator; + +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.diagram.formatdata.EdgeFormatData; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.FormatHelper; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.ConfigurationFactory; + +/** + * Test class. + * + * @author dlecan + */ +public class FormatHelperImplEdgeFormatDataTest extends AbstractFormatHelperImplTest<EdgeFormatData> { + + private final class EdgeFormatDataWrapper extends FormatDataWrapper { + /** + * @param formatData + */ + private EdgeFormatDataWrapper(final EdgeFormatData formatData) { + super(formatData); + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean doEquals(final EdgeFormatData otherFormatData) { + return FormatHelper.INSTANCE.haveSameLayout(getThisFormatData(), otherFormatData, ConfigurationFactory.buildConfiguration()); + } + } + + /** + * {@inheritDoc} + */ + @Override + protected AbstractFormatHelperImplTest<EdgeFormatData>.FormatDataWrapper createWrappedInstance(final EdgeFormatData from) throws Exception { + final EdgeFormatData nodeFormatData = (EdgeFormatData) EcoreUtil.copy(from); + return new EdgeFormatDataWrapper(nodeFormatData); + } + + /** + * {@inheritDoc} + */ + @Override + protected AbstractFormatHelperImplTest<EdgeFormatData>.FormatDataWrapper createWrappedNotEqualInstance() throws Exception { + final Iterator<EdgeFormatData> iterator = getManager().getEdgeFormatData().values().iterator(); + iterator.next(); + return new EdgeFormatDataWrapper(iterator.next()); + } + + /** + * {@inheritDoc} + */ + @Override + protected EdgeFormatData getReferenceFormatData() { + return getManager().getEdgeFormatData().values().iterator().next(); + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplNodeFormatData1Test.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplNodeFormatData1Test.java new file mode 100644 index 0000000000..bf7a4f3054 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplNodeFormatData1Test.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +/** + * Test class. + * + * @author dlecan + */ +public class FormatHelperImplNodeFormatData1Test extends AbstractFormatHelperImplNodeFormatDataTest { + + /** + * {@inheritDoc} + */ + @Override + protected int getIndexOfReferenceFormatData() { + return 3; + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplNodeFormatData2Test.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplNodeFormatData2Test.java new file mode 100644 index 0000000000..3931ead036 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/FormatHelperImplNodeFormatData2Test.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +/** + * Test class. + * + * @author dlecan + */ +public class FormatHelperImplNodeFormatData2Test extends AbstractFormatHelperImplNodeFormatDataTest { + + /** + * {@inheritDoc} + */ + @Override + protected int getIndexOfReferenceFormatData() { + return 2; + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SemanticEdgeFormatDataKeyTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SemanticEdgeFormatDataKeyTest.java new file mode 100644 index 0000000000..6d4e121923 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SemanticEdgeFormatDataKeyTest.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticEdgeFormatDataKey; + +/** + * Test class. + * + * @author dlecan + */ +public class SemanticEdgeFormatDataKeyTest extends AbstractSemanticFormatDataKeyTest { + + /** + * {@inheritDoc} + */ + @Override + protected FormatDataKey createFormatDataKey(final EObject eObject) { + return new SemanticEdgeFormatDataKey(eObject); + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SemanticNodeFormatDataKeyTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SemanticNodeFormatDataKeyTest.java new file mode 100644 index 0000000000..961b78c412 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SemanticNodeFormatDataKeyTest.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticNodeFormatDataKey; + +/** + * Test class. + * + * @author dlecan + */ +public class SemanticNodeFormatDataKeyTest extends AbstractSemanticFormatDataKeyTest { + + /** + * {@inheritDoc} + */ + @Override + protected FormatDataKey createFormatDataKey(final EObject eObject) { + return new SemanticNodeFormatDataKey(eObject); + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForDDiagramElementWithSameSemanticElementsTest.java index df9596d4b8..10bdb25408 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForDDiagramElementWithSameSemanticElementsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 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 @@ -8,7 +8,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.tests.unit.diagram.layout.data; +package org.eclipse.sirius.tests.unit.diagram.format.data; import java.util.Map; import java.util.Map.Entry; @@ -20,13 +20,13 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.DDiagramElement; -import org.eclipse.sirius.diagram.layoutdata.NodeLayoutData; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; import org.eclipse.sirius.diagram.ui.edit.api.part.IAbstractDiagramNodeEditPart; import org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramContainerEditPart; import org.eclipse.sirius.diagram.ui.internal.edit.parts.AbstractDNodeContainerCompartmentEditPart; import org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramEditorImpl; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SemanticNodeLayoutDataKey; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SiriusLayoutDataManagerForSemanticElements; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticNodeFormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; import org.eclipse.sirius.tests.SiriusTestsPlugin; import org.eclipse.sirius.tests.support.api.SiriusDiagramTestCase; import org.eclipse.sirius.tests.support.api.TestsUtil; @@ -38,11 +38,11 @@ import com.google.common.collect.Lists; import com.google.common.collect.UnmodifiableIterator; /** - * Test class for {@link SiriusLayoutDataManagerForSemanticElements}. + * Test class for {@link SiriusFormatDataManagerForSemanticElements}. * * @author dlecan */ -public class SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTest extends SiriusDiagramTestCase { +public class SiriusFormatDataManagerForDDiagramElementWithSameSemanticElementsTest extends SiriusDiagramTestCase { private static final int REF_SIZE = 25; @@ -77,7 +77,7 @@ public class SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTe * @throws Exception * Test error. */ - public void testHierarchyWithCommonSemanticTargetStoreLayout() throws Exception { + public void testHierarchyWithCommonSemanticTargetStoreFormat() throws Exception { DDiagram diagram = (DDiagram) getRepresentations(REPRESENTATION_DESC, semanticModel).toArray()[0]; // check that all DDiagramElements have the same semantic target. @@ -96,15 +96,15 @@ public class SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTe Iterable<IAbstractDiagramNodeEditPart> firstLevelParts = getChildren(editor.getDiagramEditPart()); assertEquals(WRONG_TESTS_DATA, 2, Iterables.size(firstLevelParts)); - // Check the SiriusLayoutDataManagerForSemanticElements's behavior + // Check the SiriusFormatDataManagerForSemanticElements's behavior // with them. One is Node with a border node, the other is a container // with a child node. for (IAbstractDiagramNodeEditPart idep : firstLevelParts) { - checkLayoutManagerBehaviorWithCommonSemanticElement(idep); + checkFormatManagerBehaviorWithCommonSemanticElement(idep); } } - private void checkLayoutManagerBehaviorWithCommonSemanticElement(IAbstractDiagramNodeEditPart idep) { + private void checkFormatManagerBehaviorWithCommonSemanticElement(IAbstractDiagramNodeEditPart idep) { Iterable<IAbstractDiagramNodeEditPart> children = getChildren(idep); // Each top level element has one child. @@ -120,26 +120,26 @@ public class SiriusLayoutDataManagerForDDiagramElementWithSameSemanticElementsTe assertTrue(WRONG_TESTS_DATA, l2Bounds.height < REF_SIZE); assertTrue(WRONG_TESTS_DATA, l2Bounds.width < REF_SIZE); - // Store the layout data (copy layout) and get the stored values. - SiriusLayoutDataManagerForSemanticElements mgr = new SiriusLayoutDataManagerForSemanticElements(); - mgr.storeLayoutData(idep); - Map<SemanticNodeLayoutDataKey, NodeLayoutData> data = mgr.getNodeLayoutData(); + // Store the format data (copy format) and get the stored values. + SiriusFormatDataManagerForSemanticElements mgr = new SiriusFormatDataManagerForSemanticElements(); + mgr.storeFormatData(idep); + Map<SemanticNodeFormatDataKey, NodeFormatData> data = mgr.getNodeFormatData(); // Check the stored data - assertEquals("There should be only one top level layout data", 1, data.size()); + assertEquals("There should be only one top level format data", 1, data.size()); - Entry<SemanticNodeLayoutDataKey, NodeLayoutData> entry = data.entrySet().iterator().next(); - assertEquals("There layout data do not corresponds to the common semantic target", EcoreUtil.getURI(idep.resolveTargetSemanticElement()).fragment(), entry.getKey().getId()); + Entry<SemanticNodeFormatDataKey, NodeFormatData> entry = data.entrySet().iterator().next(); + assertEquals("There format data do not corresponds to the common semantic target", EcoreUtil.getURI(idep.resolveTargetSemanticElement()).fragment(), entry.getKey().getId()); // With wrong behavior, the hierarchy was not respected, there was no // second level data and the recorded data was the small size. - NodeLayoutData l1Data = entry.getValue(); + NodeFormatData l1Data = entry.getValue(); assertEquals(WRONG_TESTS_DATA, l1Bounds.height, l1Data.getHeight()); assertEquals(WRONG_TESTS_DATA, l1Bounds.width, l1Data.getWidth()); - assertTrue("There should be layout data for the second level", l1Data.getChildren().size() == 1); - NodeLayoutData l2Data = l1Data.getChildren().iterator().next(); + assertTrue("There should be format data for the second level", l1Data.getChildren().size() == 1); + NodeFormatData l2Data = l1Data.getChildren().iterator().next(); assertEquals(WRONG_TESTS_DATA, l2Bounds.height, l2Data.getHeight()); assertEquals(WRONG_TESTS_DATA, l2Bounds.width, l2Data.getWidth()); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForSemanticElementsApplyWithPredefinedDataTest.java index 2263aee491..8a135fa28f 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForSemanticElementsApplyWithPredefinedDataTest.java @@ -8,7 +8,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.tests.unit.diagram.layout.data; +package org.eclipse.sirius.tests.unit.diagram.format.data; import java.util.Collection; @@ -20,11 +20,11 @@ import org.eclipse.emf.transaction.ResourceSetChangeEvent; import org.eclipse.emf.transaction.ResourceSetListenerImpl; import org.eclipse.emf.transaction.RollbackException; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.LayoutHelper.LayoutDifference; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.configuration.Configuration; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.configuration.ConfigurationFactory; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.AdvancedSiriusLayoutDataManager; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SiriusLayoutDataManagerForSemanticElements; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.FormatHelper.FormatDifference; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.Configuration; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.ConfigurationFactory; +import org.eclipse.sirius.diagram.ui.tools.internal.format.AdvancedSiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; import org.eclipse.sirius.tests.SiriusTestsPlugin; import org.eclipse.sirius.tests.support.api.TestsUtil; import org.junit.After; @@ -39,20 +39,20 @@ import com.google.common.collect.Collections2; import com.google.common.collect.Lists; /** - * Test class for {@link SiriusLayoutDataManagerForSemanticElements}. + * Test class for {@link SiriusFormatDataManagerForSemanticElements}. * * @author dlecan */ @RunWith(value = Parameterized.class) -public class SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTest extends AbstractSiriusLayoutDataManagerForSemanticElementsTest { +public class SiriusFormatDataManagerForSemanticElementsApplyWithPredefinedDataTest extends AbstractSiriusFormatDataManagerForSemanticElementsTest { - private final Representation representationToCopyLayout; + private final Representation representationToCopyFormat; - private final Representation representationToPasteLayout; + private final Representation representationToPasteFormat; - private final double[] diagramToCopyLayoutZoomData; + private final double[] diagramToCopyFormatZoomData; - private final double[] diagramToPasteLayoutZoomData; + private final double[] diagramToPasteFormatZoomData; protected static final ResourceSetListenerImpl ROLLBACK_LISTENER = new ResourceSetListenerImpl() { @Override @@ -116,23 +116,23 @@ public class SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTe /** * Constructor for parameterized test. * - * * @param representationToCopyLayout a representation description + * * @param representationToCopyFormat a representation description * - * @param representationToPasteLayout + * @param representationToPasteFormat * a representation description - * @param diagramToCopyLayoutZoomData - * the zoom data to set for layout copy in the current scenario - * @param diagramToPasteLayoutZoomData - * the zoom data to set for layout application in the current + * @param diagramToCopyFormatZoomData + * the zoom data to set for format copy in the current scenario + * @param diagramToPasteFormatZoomData + * the zoom data to set for format application in the current * scenario * @throws Exception */ - public SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTest(Representation representationToCopyLayout, double[] diagramToCopyLayoutZoomData, - Representation representationToPasteLayout, double[] diagramToPasteLayoutZoomData) throws Exception { - this.representationToCopyLayout = representationToCopyLayout; - this.representationToPasteLayout = representationToPasteLayout; - this.diagramToCopyLayoutZoomData = diagramToCopyLayoutZoomData; - this.diagramToPasteLayoutZoomData = diagramToPasteLayoutZoomData; + public SiriusFormatDataManagerForSemanticElementsApplyWithPredefinedDataTest(Representation representationToCopyFormat, double[] diagramToCopyFormatZoomData, + Representation representationToPasteFormat, double[] diagramToPasteFormatZoomData) throws Exception { + this.representationToCopyFormat = representationToCopyFormat; + this.representationToPasteFormat = representationToPasteFormat; + this.diagramToCopyFormatZoomData = diagramToCopyFormatZoomData; + this.diagramToPasteFormatZoomData = diagramToPasteFormatZoomData; } /** @@ -142,22 +142,22 @@ public class SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTe * Test error. */ @Test - public void testApplyPredefinedLayoutDataOnRawDiagramsWithZoom() throws Exception { + public void testApplyPredefinedFormatDataOnRawDiagramsWithZoom() throws Exception { if (TestsUtil.shouldSkipLongTests()) { return; } StringBuilder differences = new StringBuilder(); - for (final Diagram diagramToPasteLayout : Collections2.filter(representationToPasteLayout.diagrams, ONLY_RAW_DIAGRAM)) { - for (final Diagram diagramToCopyLayout : openAllDiagramsInRepresentation(representationToCopyLayout, true)) { + for (final Diagram diagramToPasteFormat : Collections2.filter(representationToPasteFormat.diagrams, ONLY_RAW_DIAGRAM)) { + for (final Diagram diagramToCopyFormat : openAllDiagramsInRepresentation(representationToCopyFormat, true)) { // Test only if one or the other zoom level is 1 // (IDENTITY) to reduce length of test - if (diagramToCopyLayoutZoomData[0] == IDENTITY_ZOOM_LEVEL || diagramToPasteLayoutZoomData[0] == IDENTITY_ZOOM_LEVEL) { + if (diagramToCopyFormatZoomData[0] == IDENTITY_ZOOM_LEVEL || diagramToPasteFormatZoomData[0] == IDENTITY_ZOOM_LEVEL) { Configuration configuration = ConfigurationFactory.buildConfiguration(); - configuration.getEdgeConfiguration().setDistanceAroundPointsOfEdgeBendpointsList(Math.max(diagramToCopyLayoutZoomData[1], diagramToPasteLayoutZoomData[1])); + configuration.getEdgeConfiguration().setDistanceAroundPointsOfEdgeBendpointsList(Math.max(diagramToCopyFormatZoomData[1], diagramToPasteFormatZoomData[1])); - applyPredefinedLayoutDataOnRawDiagramsWithZoom(diagramToCopyLayout, diagramToPasteLayout, diagramToCopyLayoutZoomData[0], diagramToPasteLayoutZoomData[0], configuration, + applyPredefinedFormatDataOnRawDiagramsWithZoom(diagramToCopyFormat, diagramToPasteFormat, diagramToCopyFormatZoomData[0], diagramToPasteFormatZoomData[0], configuration, differences); } } @@ -166,34 +166,34 @@ public class SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTe assertTrue("Found differences : \n" + differences, differences.length() == 0); } - protected void applyPredefinedLayoutDataOnRawDiagramsWithZoom(Diagram diagramToCopyLayout, Diagram diagramToPasteLayout, double diagramToCopyLayoutZoomLevel, double diagramToPasteLayoutZoomLevel, + protected void applyPredefinedFormatDataOnRawDiagramsWithZoom(Diagram diagramToCopyFormat, Diagram diagramToPasteFormat, double diagramToCopyFormatZoomLevel, double diagramToPasteFormatZoomLevel, Configuration configuration, StringBuilder differences) throws Exception { - final DiagramEditPart diagramEditPart = diagramToCopyLayout.diagramEditPart; + final DiagramEditPart diagramEditPart = diagramToCopyFormat.diagramEditPart; - // Store layout data from initial diagram - final AdvancedSiriusLayoutDataManager originalManager = new SiriusLayoutDataManagerForSemanticElements(); - originalManager.storeLayoutData(diagramEditPart); + // Store format data from initial diagram + final AdvancedSiriusFormatDataManager originalManager = new SiriusFormatDataManagerForSemanticElements(); + originalManager.storeFormatData(diagramEditPart); try { - openRawDiagram(diagramToPasteLayout); + openRawDiagram(diagramToPasteFormat); // Apply it on destination diagram, where all nodes and edges are // located around (0,0) (but not exactly) - final DiagramEditPart destinationDiagram = diagramToPasteLayout.diagramEditPart; + final DiagramEditPart destinationDiagram = diagramToPasteFormat.diagramEditPart; - changeZoomLevel(diagramToCopyLayout, diagramToCopyLayoutZoomLevel); - changeZoomLevel(diagramToPasteLayout, diagramToPasteLayoutZoomLevel); + changeZoomLevel(diagramToCopyFormat, diagramToCopyFormatZoomLevel); + changeZoomLevel(diagramToPasteFormat, diagramToPasteFormatZoomLevel); - final AdvancedSiriusLayoutDataManager newManager = new SiriusLayoutDataManagerForSemanticElements(); + final AdvancedSiriusFormatDataManager newManager = new SiriusFormatDataManagerForSemanticElements(); final RecordingCommand command = new RecordingCommand(destinationDiagram.getEditingDomain()) { @Override protected void doExecute() { // Update diagram, but transaction will be // rollbacked - originalManager.applyLayout(destinationDiagram); - newManager.storeLayoutData(destinationDiagram); + originalManager.applyFormat(destinationDiagram); + newManager.storeFormatData(destinationDiagram); } }; @@ -206,25 +206,25 @@ public class SiriusLayoutDataManagerForSemanticElementsApplyWithPredefinedDataTe destinationDiagram.getEditingDomain().removeResourceSetListener(ROLLBACK_LISTENER); } - final String partialPath = "from___" + encodeDiagramName(diagramToCopyLayout) + "___to___" + encodeDiagramName(diagramToPasteLayout) + XMI_EXTENSION; + final String partialPath = "from___" + encodeDiagramName(diagramToCopyFormat) + "___to___" + encodeDiagramName(diagramToPasteFormat) + XMI_EXTENSION; // Enable this if you want to generate referenced files if (REGENERATE_TEST_DATA) { final String path = getPlatformRelatedXmiDataPath() + RAW_FOLDER + partialPath; - saveDiagram(newManager.getRootNodeLayoutData().values(), path); + saveDiagram(newManager.getRootNodeFormatData().values(), path); } String fullPath = getPlatformRelatedFullXmiDataPath() + RAW_FOLDER + partialPath; String message = "between diagram "; - message += diagramToCopyLayout.name + " (zoom level: " + diagramToCopyLayoutZoomLevel + ")"; - message += " and raw diagram " + diagramToPasteLayout.name + " (zoom level: " + diagramToPasteLayoutZoomLevel + ")"; - LayoutDifference<?> foundDifference = loadAndCompare(diagramToPasteLayout, fullPath, newManager, configuration); + message += diagramToCopyFormat.name + " (zoom level: " + diagramToCopyFormatZoomLevel + ")"; + message += " and raw diagram " + diagramToPasteFormat.name + " (zoom level: " + diagramToPasteFormatZoomLevel + ")"; + FormatDifference<?> foundDifference = loadAndCompare(diagramToPasteFormat, fullPath, newManager, configuration); if (foundDifference != null) { differences.append("\n. " + message + foundDifference); } } finally { - closeRawDiagram(diagramToPasteLayout); + closeRawDiagram(diagramToPasteFormat); } } } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForSemanticElementsStoreWithPredefinedDataTest.java index 9907098d87..3a2f5802f8 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForSemanticElementsStoreWithPredefinedDataTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 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 @@ -8,16 +8,16 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.tests.unit.diagram.layout.data; +package org.eclipse.sirius.tests.unit.diagram.format.data; import java.util.Collection; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.LayoutHelper.LayoutDifference; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.configuration.Configuration; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.configuration.ConfigurationFactory; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.AdvancedSiriusLayoutDataManager; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SiriusLayoutDataManagerForSemanticElements; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.FormatHelper.FormatDifference; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.Configuration; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.ConfigurationFactory; +import org.eclipse.sirius.diagram.ui.tools.internal.format.AdvancedSiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -28,12 +28,12 @@ import org.junit.runners.Parameterized.Parameters; import com.google.common.collect.Lists; /** - * Test class for {@link SiriusLayoutDataManagerForSemanticElements}. + * Test class for {@link SiriusFormatDataManagerForSemanticElements}. * * @author dlecan */ @RunWith(value = Parameterized.class) -public class SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTest extends AbstractSiriusLayoutDataManagerForSemanticElementsTest { +public class SiriusFormatDataManagerForSemanticElementsStoreWithPredefinedDataTest extends AbstractSiriusFormatDataManagerForSemanticElementsTest { private final Representation representation; @@ -74,7 +74,7 @@ public class SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTe * the zoom data to set for the current scenario * @throws Exception */ - public SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTest(Representation representation, double[] zoomData) throws Exception { + public SiriusFormatDataManagerForSemanticElementsStoreWithPredefinedDataTest(Representation representation, double[] zoomData) throws Exception { this.representation = representation; this.zoomData = zoomData; } @@ -86,7 +86,7 @@ public class SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTe * Test error. */ @Test - public void testStoreLayoutAgainstPredefinedData() throws Exception { + public void testStoreFormatAgainstPredefinedData() throws Exception { StringBuilder differences = new StringBuilder(); double zoomLevel = zoomData[0]; double distance = zoomData[1]; @@ -96,20 +96,20 @@ public class SiriusLayoutDataManagerForSemanticElementsStoreWithPredefinedDataTe Configuration configuration = ConfigurationFactory.buildConfiguration(); configuration.getEdgeConfiguration().setDistanceAroundPointsOfEdgeBendpointsList(distance); - - // Store layout data from diagram + + // Store format data from diagram final DiagramEditPart diagramEditPart = diag.diagramEditPart; - final AdvancedSiriusLayoutDataManager manager = new SiriusLayoutDataManagerForSemanticElements(); - manager.storeLayoutData(diagramEditPart); - + final AdvancedSiriusFormatDataManager manager = new SiriusFormatDataManagerForSemanticElements(); + manager.storeFormatData(diagramEditPart); + // Enable this if you want to generate referenced files if (REGENERATE_TEST_DATA) { final String path = getPlatformRelatedXmiDataPath() + encodeDiagramName(diag) + XMI_EXTENSION; - saveDiagram(manager.getRootNodeLayoutData().values(), path); - } - + saveDiagram(manager.getRootNodeFormatData().values(), path); + } + String path = getPlatformRelatedFullXmiDataPath() + encodeDiagramName(diag) + XMI_EXTENSION; - LayoutDifference<?> foundDifference = loadAndCompare(diag, path, manager, configuration); + FormatDifference<?> foundDifference = loadAndCompare(diag, path, manager, configuration); if (foundDifference != null) { differences.append("\n. in the diagram " + diag.name + " (zoom level: " + zoomLevel + ")" + foundDifference); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForSemanticElementsTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForSemanticElementsTest.java new file mode 100644 index 0000000000..8cd22e04ea --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/SiriusFormatDataManagerForSemanticElementsTest.java @@ -0,0 +1,165 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data; + +import java.util.Collection; +import java.util.Map; + +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.sirius.diagram.formatdata.EdgeFormatData; +import org.eclipse.sirius.diagram.formatdata.NodeFormatData; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.FormatHelper; +import org.eclipse.sirius.diagram.formatdata.tools.api.util.configuration.ConfigurationFactory; +import org.eclipse.sirius.diagram.ui.tools.internal.format.AdvancedSiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.internal.format.EdgeFormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.NodeFormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticEdgeFormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SemanticNodeFormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; +import org.eclipse.sirius.viewpoint.DRepresentationElement; + +/** + * Test class for {@link SiriusFormatDataManagerForSemanticElements}. + * + * @author dlecan + */ +public class SiriusFormatDataManagerForSemanticElementsTest extends AbstractSiriusFormatDataManagerForSemanticElementsTest { + + /** + * Test method. + * + * @throws Exception + * Test error. + */ + public void testBasicStoreFormat() throws Exception { + for (final Diagram diag : getAndOpenAllDiagrams()) { + final DiagramEditPart diagram = diag.diagramEditPart; + + final AdvancedSiriusFormatDataManager manager = new SiriusFormatDataManagerForSemanticElements(); + manager.storeFormatData(diagram); + + // Enable this to save referenced data + if (REGENERATE_TEST_DATA) { + saveDiagram(diag, manager.getRootNodeFormatData().values()); + } + + assertTrue("Manager should contain data for diagram " + diag.name, manager.containsData()); + } + } + + /** + * Test method. + * + * @throws Exception + * Test error. + */ + public void testCheckNumberOfStoredFormats() throws Exception { + for (final Diagram diag : getAndOpenAllDiagrams()) { + final DiagramEditPart diagram = diag.diagramEditPart; + + final AdvancedSiriusFormatDataManager manager = new SiriusFormatDataManagerForSemanticElements(); + manager.storeFormatData(diagram); + + final Map<? extends NodeFormatDataKey, NodeFormatData> nodeFormatData = manager.getNodeFormatData(); + final Map<? extends EdgeFormatDataKey, EdgeFormatData> edgeFormatData = manager.getEdgeFormatData(); + + assertEquals("Number of expected node format data is wrong for diagram " + diag.name, diag.numberOfNodeFormatData, nodeFormatData.size()); + assertEquals("Number of expected edge format data is wrong for diagram " + diag.name, diag.numberOfEdgeFormatData, edgeFormatData.size()); + } + } + + /** + * Test method. + * + * @throws Exception + * Test error. + */ + public void testCheckConsistantStoreFormat() throws Exception { + for (final Diagram diag : getAndOpenAllDiagrams()) { + final DiagramEditPart diagramEditPart = diag.diagramEditPart; + + final AdvancedSiriusFormatDataManager manager = new SiriusFormatDataManagerForSemanticElements(); + manager.storeFormatData(diagramEditPart); + final Collection<? extends NodeFormatData> firstNodeValues = manager.getRootNodeFormatData().values(); + final Collection<EdgeFormatData> firstEdgeValues = manager.getEdgeFormatData().values(); + + for (int i = 0; i < ITERATIONS; i++) { + final AdvancedSiriusFormatDataManager otherManager = new SiriusFormatDataManagerForSemanticElements(); + otherManager.storeFormatData(diagramEditPart); + final Collection<? extends NodeFormatData> secondNodeValues = otherManager.getRootNodeFormatData().values(); + final Collection<EdgeFormatData> secondEdgeValues = otherManager.getEdgeFormatData().values(); + + final boolean haveSameFormat = FormatHelper.INSTANCE.haveSameLayout(firstNodeValues, secondNodeValues, ConfigurationFactory.buildConfiguration()); + assertTrue("All node formats should be the same for diagram " + diag.name, haveSameFormat); + + assertTrue("All edge formats should be the same for diagram " + diag.name, + FormatHelper.INSTANCE.haveSameLayout(firstEdgeValues, secondEdgeValues, ConfigurationFactory.buildConfiguration())); + } + } + } + + /** + * Test method. + * + * @throws Exception + * Test error. + */ + public void testStoreNodeFormatData() throws Exception { + openAllDiagramsInRepresentation(DIAG_TYPE2_MYPACKAGE.parent); + + final IGraphicalEditPart editPart = (IGraphicalEditPart) DIAG_TYPE2_MYPACKAGE.diagramEditPart.getChildren().get(0); + + final DRepresentationElement element = (DRepresentationElement) ((View) editPart.getModel()).getElement(); + final String name = element.getName(); + assertEquals("Wrong edit part", "Container p1", name); + + final AdvancedSiriusFormatDataManager manager = new SiriusFormatDataManagerForSemanticElements(); + manager.storeFormatData(editPart); + assertTrue("Manager should contain data for diagram " + DIAG_TYPE2_MYPACKAGE.name, manager.containsData()); + + final SemanticNodeFormatDataKey dataKey = new SemanticNodeFormatDataKey(element.getTarget()); + final NodeFormatData nodeFormatData = manager.getNodeFormatData().get(dataKey); + + assertEquals("Wrong width", 653, nodeFormatData.getWidth()); + assertEquals("Wrong height", 173, nodeFormatData.getHeight()); + + assertFalse("Node format data sould have children", nodeFormatData.getChildren().isEmpty()); + + } + + /** + * Test method. + * + * @throws Exception + * Test error. + */ + public void testStoreEdgeFormatData() throws Exception { + openAllDiagramsInRepresentation(DIAG_TYPE2_MYPACKAGE.parent); + + final IGraphicalEditPart p1EditPart = (IGraphicalEditPart) DIAG_TYPE2_MYPACKAGE.diagramEditPart.getChildren().get(0); + final IGraphicalEditPart edgeEditPart = (IGraphicalEditPart) ((IGraphicalEditPart) ((IGraphicalEditPart) p1EditPart.getChildren().get(1)).getChildren().get(0)).getSourceConnections().get(0); + + final DRepresentationElement element = (DRepresentationElement) ((View) edgeEditPart.getModel()).getElement(); + final String name = element.getName(); + assertEquals("Wrong edit part", "aC1-2", name); + + final AdvancedSiriusFormatDataManager manager = new SiriusFormatDataManagerForSemanticElements(); + manager.storeFormatData(edgeEditPart); + assertTrue("Manager should contain data for diagram " + DIAG_TYPE2_MYPACKAGE.name, manager.containsData()); + + final SemanticEdgeFormatDataKey dataKey = new SemanticEdgeFormatDataKey(element.getTarget()); + final EdgeFormatData edgeFormatData = manager.getEdgeFormatData().get(dataKey); + + assertEquals("Wrong point list", 4, edgeFormatData.getPointList().size()); + } +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/FormatDataManagerSelectionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/FormatDataManagerSelectionTest.java new file mode 100644 index 0000000000..02d122519d --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/FormatDataManagerSelectionTest.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension; + +import java.util.List; + +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EcoreFactory; +import org.eclipse.sirius.diagram.DSemanticDiagram; +import org.eclipse.sirius.diagram.DiagramFactory; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.internal.format.data.extension.FormatDataManagerRegistry; +import org.eclipse.sirius.diagram.ui.tools.internal.format.semantic.SiriusFormatDataManagerForSemanticElements; + +import junit.framework.TestCase; + +/** + * Tests manager selection. + * + * @author mporhel + * + */ +public class FormatDataManagerSelectionTest extends TestCase { + + /** + * Test sample extension presence and deployment. + */ + public void testSampleExtensionDeployment() { + assertEquals("Sample format data manager extension not found.", 2, FormatDataManagerRegistry.getRegisteredExtensions().size()); + assertEquals("Sample format data manager extension instance not found.", 3, FormatDataManagerRegistry.getAllSiriusFormatDataManagers().size()); + } + + /** + * Tests that the extension do not react for non wanted models. + */ + public void testDefaultManagerSelectionWhenNoFoundExtension() { + EPackage p = EcoreFactory.eINSTANCE.createEPackage(); + + DSemanticDiagram diagram = DiagramFactory.eINSTANCE.createDSemanticDiagram(); + diagram.setTarget(p); + + List<SiriusFormatDataManager> applicableManagers = FormatDataManagerRegistry.getSiriusFormatDataManagers(diagram); + + assertEquals("Extension should not accept the given diagram.", 1, applicableManagers.size()); + } + + /** + * Test that the extension reacts to wanted models : a specific eannotation + * should be present. + */ + public void testAvailableManagersWhenExtensionProvides() { + EPackage p = EcoreFactory.eINSTANCE.createEPackage(); + + EAnnotation eannot = EcoreFactory.eINSTANCE.createEAnnotation(); + eannot.setSource(SampleManager.SAMPLE_SOURCE); + p.getEAnnotations().add(eannot); + + DSemanticDiagram diagram = DiagramFactory.eINSTANCE.createDSemanticDiagram(); + diagram.setTarget(p); + + List<SiriusFormatDataManager> applicableManagers = FormatDataManagerRegistry.getSiriusFormatDataManagers(diagram); + + assertEquals("Extension should not accept the given diagram.", 2, applicableManagers.size()); + assertTrue("Extension should be the first manager.", applicableManagers.get(0) instanceof SampleManager); + assertTrue("Default manager should be the last one.", applicableManagers.get(1) instanceof SiriusFormatDataManagerForSemanticElements); + } +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleDataProvider.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleDataProvider.java new file mode 100644 index 0000000000..69880bda72 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleDataProvider.java @@ -0,0 +1,49 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension; + +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DSemanticDiagram; +import org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; + +/** + * Sample extension provider. + * + * @author mporhel + * + */ +public class SampleDataProvider implements IFormatDataManagerProvider { + + /** + * {@inheritDoc} + */ + @Override + public boolean provides(DDiagram diagram) { + if (diagram instanceof DSemanticDiagram) { + DSemanticDiagram dSem = (DSemanticDiagram) diagram; + EObject semanticTarget = dSem.getTarget(); + return semanticTarget instanceof EModelElement && ((EModelElement) semanticTarget).getEAnnotation(SampleManager.SAMPLE_SOURCE) != null; + } + return false; + } + + /** + * {@inheritDoc} + */ + @Override + public SiriusFormatDataManager getFormatDataManager() { + return new SampleManager(); + } + +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleManager.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleManager.java new file mode 100644 index 0000000000..2db5ae0e67 --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleManager.java @@ -0,0 +1,212 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension; + +import java.util.Map; + +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EModelElement; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.business.api.session.Session; +import org.eclipse.sirius.business.api.session.SessionListener; +import org.eclipse.sirius.business.api.session.SessionManager; +import org.eclipse.sirius.business.api.session.SessionManagerListener; +import org.eclipse.sirius.diagram.AbstractDNode; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.DEdge; +import org.eclipse.sirius.diagram.formatdata.AbstractFormatData; +import org.eclipse.sirius.diagram.ui.tools.api.format.AbstractSiriusFormatDataManager; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; +import org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.keys.AbstractSampleFormatDataKey; +import org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.keys.SampleEdgeFormatDataKey; +import org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.keys.SampleNodeFormatDataKey; +import org.eclipse.sirius.viewpoint.DSemanticDecorator; +import org.eclipse.sirius.viewpoint.description.Viewpoint; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; + +/** + * Sample {@link SiriusFormatDataManager} to able to copy/paste format regarding + * traceability/refinement links. + * + * These links are simulated by an {@link EAnnotation} with + * {@link SampleManager#SAMPLE_SOURCE} as source and a referenced + * {@link EObject}. + * + * @author mporhel + * + */ +public class SampleManager extends AbstractSiriusFormatDataManager implements SiriusFormatDataManager { + + /** + * {@link EAnnotation} source of {@link EAnnotation} simulating + * refinement/traceability links. + */ + public static final String SAMPLE_SOURCE = "refinement.link.format"; + + private final Map<AbstractSampleFormatDataKey, AbstractFormatData> formatDataMap = Maps.newHashMap(); + + private final SessionManagerListener sessionMgrListener = new SampleSessionManagerListener(); + + { + // Avoid memory leak, react to session changes to clean cache. + SessionManager.INSTANCE.addSessionsListener(sessionMgrListener); + } + + /** + * {@inheritDoc} + */ + @Override + public AbstractFormatData getFormatData(FormatDataKey key) { + if (key instanceof AbstractSampleFormatDataKey && validateKey((AbstractSampleFormatDataKey) key)) { + return getLinkedFormatData((AbstractSampleFormatDataKey) key); + } + + return null; + } + + private AbstractFormatData getLinkedFormatData(AbstractSampleFormatDataKey key) { + AbstractFormatData formatData = null; + if (formatData == null) { + // Retrieve traceability/refinement information + EObject foundSemantic = retrieveLinkedEObject(key.getSemantic()); + if (foundSemantic != null) { + if (key instanceof SampleNodeFormatDataKey) { + formatData = formatDataMap.get(new SampleNodeFormatDataKey(foundSemantic)); + } else if (key instanceof SampleEdgeFormatDataKey) { + formatData = formatDataMap.get(new SampleEdgeFormatDataKey(foundSemantic)); + } + } + } + return formatData; + } + + /** + * Look for an {@link EObject} linked to given one by a + * traceability/refinement link. + */ + private EObject retrieveLinkedEObject(EObject semantic) { + EObject source = null; + if (semantic instanceof EModelElement) { + EAnnotation annot = ((EModelElement) semantic).getEAnnotation(SAMPLE_SOURCE); + if (annot != null && !annot.getReferences().isEmpty()) { + source = annot.getReferences().iterator().next(); + } + } + return source; + } + + /** + * {@inheritDoc} + */ + @Override + public FormatDataKey createKey(DSemanticDecorator semanticDecorator) { + FormatDataKey result = null; + final EObject realSemanticElement = semanticDecorator.getTarget(); + if (semanticDecorator instanceof DEdge) { + result = new SampleEdgeFormatDataKey(realSemanticElement); + } else if (semanticDecorator instanceof AbstractDNode || semanticDecorator instanceof DDiagram) { + result = new SampleNodeFormatDataKey(realSemanticElement); + } + + return result; + } + + /** + * {@inheritDoc} + */ + @Override + public void addFormatData(FormatDataKey key, AbstractFormatData formatData) { + if (key instanceof AbstractSampleFormatDataKey && validateKey((AbstractSampleFormatDataKey) key)) { + formatDataMap.put((AbstractSampleFormatDataKey) key, formatData); + } + } + + /** + * {@inheritDoc} + */ + @Override + public boolean containsData() { + return !formatDataMap.isEmpty(); + } + + /** + * {@inheritDoc} + */ + @Override + public void clearFormatData() { + formatDataMap.clear(); + } + + /** + * Remove keys with dangling semantic {@link EObject} from cache. + */ + private void cleanCache() { + for (AbstractSampleFormatDataKey key : Lists.newArrayList(formatDataMap.keySet())) { + if (!validateKey(key)) { + formatDataMap.remove(key); + } + } + } + + private boolean validateKey(AbstractSampleFormatDataKey key) { + return key != null && key.getSemantic() != null && !key.getSemantic().eIsProxy() && key.getSemantic().eResource() != null; + } + + /** + * Specific session manager listener to avoid memory leaks when session + * changes occur. + * + * @author mporhel + */ + private class SampleSessionManagerListener implements SessionManagerListener { + + @Override + public void notifyRemoveSession(Session removedSession) { + cleanCache(); + } + + @Override + public void notify(Session updated, int notification) { + switch (notification) { + case SessionListener.CLOSED: + case SessionListener.DIRTY: + case SessionListener.SYNC: + case SessionListener.REPLACED: + case SessionListener.REPRESENTATION_CHANGE: + case SessionListener.SEMANTIC_CHANGE: + cleanCache(); + break; + + default: + break; + } + } + + @Override + public void notifyAddSession(Session newSession) { + // Nothing to do + } + + @Override + public void viewpointSelected(Viewpoint selectedSirius) { + // Nothing to do + } + + @Override + public void viewpointDeselected(Viewpoint deselectedSirius) { + // Nothing to do + + } + } +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/manager/extension/SampleNameDataProvider.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleNameDataProvider.java index cffb486c22..a560ab6284 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/manager/extension/SampleNameDataProvider.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/SampleNameDataProvider.java @@ -8,14 +8,14 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.tests.unit.diagram.layout.data.manager.extension; +package org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension; import org.eclipse.emf.ecore.EModelElement; import org.eclipse.emf.ecore.EObject; import org.eclipse.sirius.diagram.DDiagram; import org.eclipse.sirius.diagram.DSemanticDiagram; -import org.eclipse.sirius.diagram.ui.tools.api.layout.ILayoutDataManagerProvider; -import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; +import org.eclipse.sirius.diagram.ui.tools.api.format.IFormatDataManagerProvider; +import org.eclipse.sirius.diagram.ui.tools.api.format.SiriusFormatDataManager; /** * Sample extension provider. @@ -23,7 +23,7 @@ import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; * @author jmallet * */ -public class SampleNameDataProvider implements ILayoutDataManagerProvider { +public class SampleNameDataProvider implements IFormatDataManagerProvider { private static final String EXPECTED_SUFFIX = "AdaptedForCopyPasteFormatTest"; @@ -44,7 +44,7 @@ public class SampleNameDataProvider implements ILayoutDataManagerProvider { * {@inheritDoc} */ @Override - public SiriusLayoutDataManager getLayoutDataManager() { + public SiriusFormatDataManager getFormatDataManager() { return new SampleManager(); } diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/AbstractSampleFormatDataKey.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/AbstractSampleFormatDataKey.java new file mode 100644 index 0000000000..47635e26bc --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/AbstractSampleFormatDataKey.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.keys; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey; + +/** + * Specific key allowing to know the semantic {@link EObject}. + * + * @author mporhel + */ +public abstract class AbstractSampleFormatDataKey implements FormatDataKey { + + /** + * The semantic element of this FormatDataKey + */ + private EObject semantic; + + /** + * Default constructor. + * + * @param key + * The key + */ + public AbstractSampleFormatDataKey(final EObject key) { + this.semantic = key; + } + + public EObject getSemantic() { + return semantic; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.sirius.diagram.ui.tools.api.format.FormatDataKey#getId() + */ + @Override + public String getId() { + return EcoreUtil.getURI(getSemantic()).fragment(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((semantic == null) ? 0 : semantic.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AbstractSampleFormatDataKey other = (AbstractSampleFormatDataKey) obj; + if (semantic == null) { + if (other.semantic != null) + return false; + } else if (!semantic.equals(other.semantic)) + return false; + return true; + } +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/SampleEdgeFormatDataKey.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/SampleEdgeFormatDataKey.java new file mode 100644 index 0000000000..891f492c2f --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/SampleEdgeFormatDataKey.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.keys; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.DEdge; + +/** + * Specific key for {@link DEdge}. + * + * @author mporhel + */ +public class SampleEdgeFormatDataKey extends AbstractSampleFormatDataKey { + + /** + * Default constructor. + * + * @param key + * The key + */ + public SampleEdgeFormatDataKey(final EObject key) { + super(key); + } +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/SampleNodeFormatDataKey.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/SampleNodeFormatDataKey.java new file mode 100644 index 0000000000..d8b33ea24e --- /dev/null +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/format/data/manager/extension/keys/SampleNodeFormatDataKey.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.keys; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.diagram.DNode; + +/** + * Specific key for {@link DNode}. + * + * @author mporhel + */ +public class SampleNodeFormatDataKey extends AbstractSampleFormatDataKey { + + /** + * Default constructor. + * + * @param key + * The key + */ + public SampleNodeFormatDataKey(final EObject key) { + super(key); + } +} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForSemanticElementsTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForSemanticElementsTest.java deleted file mode 100644 index a99f1b7aa1..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/SiriusLayoutDataManagerForSemanticElementsTest.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2014 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.unit.diagram.layout.data; - -import java.util.Collection; -import java.util.Map; - -import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; -import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.sirius.diagram.layoutdata.EdgeLayoutData; -import org.eclipse.sirius.diagram.layoutdata.NodeLayoutData; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.LayoutHelper; -import org.eclipse.sirius.diagram.layoutdata.tools.api.util.configuration.ConfigurationFactory; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.AdvancedSiriusLayoutDataManager; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.EdgeLayoutDataKey; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.NodeLayoutDataKey; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SemanticEdgeLayoutDataKey; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SemanticNodeLayoutDataKey; -import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SiriusLayoutDataManagerForSemanticElements; -import org.eclipse.sirius.viewpoint.DRepresentationElement; - -/** - * Test class for {@link SiriusLayoutDataManagerForSemanticElements}. - * - * @author dlecan - */ -public class SiriusLayoutDataManagerForSemanticElementsTest extends AbstractSiriusLayoutDataManagerForSemanticElementsTest { - - /** - * Test method. - * - * @throws Exception - * Test error. - */ - public void testBasicStoreLayout() throws Exception { - for (final Diagram diag : getAndOpenAllDiagrams()) { - final DiagramEditPart diagram = diag.diagramEditPart; - - final AdvancedSiriusLayoutDataManager manager = new SiriusLayoutDataManagerForSemanticElements(); - manager.storeLayoutData(diagram); - - // Enable this to save referenced data - if (REGENERATE_TEST_DATA) { - saveDiagram(diag, manager.getRootNodeLayoutData().values()); - } - - assertTrue("Manager should contain data for diagram " + diag.name, manager.containsData()); - } - } - - /** - * Test method. - * - * @throws Exception - * Test error. - */ - public void testCheckNumberOfStoredLayouts() throws Exception { - for (final Diagram diag : getAndOpenAllDiagrams()) { - final DiagramEditPart diagram = diag.diagramEditPart; - - final AdvancedSiriusLayoutDataManager manager = new SiriusLayoutDataManagerForSemanticElements(); - manager.storeLayoutData(diagram); - - final Map<? extends NodeLayoutDataKey, NodeLayoutData> nodeLayoutData = manager.getNodeLayoutData(); - final Map<? extends EdgeLayoutDataKey, EdgeLayoutData> edgeLayoutData = manager.getEdgeLayoutData(); - - assertEquals("Number of expected node layout data is wrong for diagram " + diag.name, diag.numberOfNodeLayoutData, nodeLayoutData.size()); - assertEquals("Number of expected edge layout data is wrong for diagram " + diag.name, diag.numberOfEdgeLayoutData, edgeLayoutData.size()); - } - } - - /** - * Test method. - * - * @throws Exception - * Test error. - */ - public void testCheckConsistantStoreLayout() throws Exception { - for (final Diagram diag : getAndOpenAllDiagrams()) { - final DiagramEditPart diagramEditPart = diag.diagramEditPart; - - final AdvancedSiriusLayoutDataManager manager = new SiriusLayoutDataManagerForSemanticElements(); - manager.storeLayoutData(diagramEditPart); - final Collection<? extends NodeLayoutData> firstNodeValues = manager.getRootNodeLayoutData().values(); - final Collection<EdgeLayoutData> firstEdgeValues = manager.getEdgeLayoutData().values(); - - for (int i = 0; i < ITERATIONS; i++) { - final AdvancedSiriusLayoutDataManager otherManager = new SiriusLayoutDataManagerForSemanticElements(); - otherManager.storeLayoutData(diagramEditPart); - final Collection<? extends NodeLayoutData> secondNodeValues = otherManager.getRootNodeLayoutData().values(); - final Collection<EdgeLayoutData> secondEdgeValues = otherManager.getEdgeLayoutData().values(); - - final boolean haveSameLayout = LayoutHelper.INSTANCE.haveSameLayout(firstNodeValues, secondNodeValues, ConfigurationFactory.buildConfiguration()); - assertTrue("All node layouts should be the same for diagram " + diag.name, haveSameLayout); - - assertTrue("All edge layouts should be the same for diagram " + diag.name, - LayoutHelper.INSTANCE.haveSameLayout(firstEdgeValues, secondEdgeValues, ConfigurationFactory.buildConfiguration())); - } - } - } - - /** - * Test method. - * - * @throws Exception - * Test error. - */ - public void testStoreNodeLayoutData() throws Exception { - openAllDiagramsInRepresentation(DIAG_TYPE2_MYPACKAGE.parent); - - final IGraphicalEditPart editPart = (IGraphicalEditPart) DIAG_TYPE2_MYPACKAGE.diagramEditPart.getChildren().get(0); - - final DRepresentationElement element = (DRepresentationElement) ((View) editPart.getModel()).getElement(); - final String name = element.getName(); - assertEquals("Wrong edit part", "Container p1", name); - - final AdvancedSiriusLayoutDataManager manager = new SiriusLayoutDataManagerForSemanticElements(); - manager.storeLayoutData(editPart); - assertTrue("Manager should contain data for diagram " + DIAG_TYPE2_MYPACKAGE.name, manager.containsData()); - - final SemanticNodeLayoutDataKey dataKey = new SemanticNodeLayoutDataKey(element.getTarget()); - final NodeLayoutData nodeLayoutData = manager.getNodeLayoutData().get(dataKey); - - assertEquals("Wrong width", 653, nodeLayoutData.getWidth()); - assertEquals("Wrong height", 173, nodeLayoutData.getHeight()); - - assertFalse("Node layout data sould have children", nodeLayoutData.getChildren().isEmpty()); - - } - - /** - * Test method. - * - * @throws Exception - * Test error. - */ - public void testStoreEdgeLayoutData() throws Exception { - openAllDiagramsInRepresentation(DIAG_TYPE2_MYPACKAGE.parent); - - final IGraphicalEditPart p1EditPart = (IGraphicalEditPart) DIAG_TYPE2_MYPACKAGE.diagramEditPart.getChildren().get(0); - final IGraphicalEditPart edgeEditPart = (IGraphicalEditPart) ((IGraphicalEditPart) ((IGraphicalEditPart) p1EditPart.getChildren().get(1)).getChildren().get(0)).getSourceConnections().get(0); - - final DRepresentationElement element = (DRepresentationElement) ((View) edgeEditPart.getModel()).getElement(); - final String name = element.getName(); - assertEquals("Wrong edit part", "aC1-2", name); - - final AdvancedSiriusLayoutDataManager manager = new SiriusLayoutDataManagerForSemanticElements(); - manager.storeLayoutData(edgeEditPart); - assertTrue("Manager should contain data for diagram " + DIAG_TYPE2_MYPACKAGE.name, manager.containsData()); - - final SemanticEdgeLayoutDataKey dataKey = new SemanticEdgeLayoutDataKey(element.getTarget()); - final EdgeLayoutData edgeLayoutData = manager.getEdgeLayoutData().get(dataKey); - - assertEquals("Wrong point list", 4, edgeLayoutData.getPointList().size()); - } -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/manager/extension/LayoutDataManagerSelectionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/manager/extension/LayoutDataManagerSelectionTest.java index 80ce3e18cb..386cc8a590 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/manager/extension/LayoutDataManagerSelectionTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/diagram/layout/data/manager/extension/LayoutDataManagerSelectionTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 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 @@ -12,8 +12,6 @@ package org.eclipse.sirius.tests.unit.diagram.layout.data.manager.extension; import java.util.List; -import junit.framework.TestCase; - import org.eclipse.emf.ecore.EAnnotation; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EcoreFactory; @@ -23,6 +21,8 @@ import org.eclipse.sirius.diagram.ui.tools.api.layout.SiriusLayoutDataManager; import org.eclipse.sirius.diagram.ui.tools.internal.layout.data.extension.LayoutDataManagerRegistry; import org.eclipse.sirius.diagram.ui.tools.internal.layout.semantic.SiriusLayoutDataManagerForSemanticElements; +import junit.framework.TestCase; + /** * Tests manager selection. * @@ -35,8 +35,8 @@ public class LayoutDataManagerSelectionTest extends TestCase { * Test sample extension presence and deployment. */ public void testSampleExtensionDeployment() { - assertEquals("Sample layout data manager extension not found.", 2, LayoutDataManagerRegistry.getRegisteredExtensions().size()); - assertEquals("Sample layout data manager extension instance not found.", 3, LayoutDataManagerRegistry.getAllSiriusLayoutDataManagers().size()); + assertEquals("Sample layout data manager extension not found.", 1, LayoutDataManagerRegistry.getRegisteredExtensions().size()); + assertEquals("Sample layout data manager extension instance not found.", 2, LayoutDataManagerRegistry.getAllSiriusLayoutDataManagers().size()); } /** @@ -54,7 +54,8 @@ public class LayoutDataManagerSelectionTest extends TestCase { } /** - * Test that the extension reacts to wanted models : a specific eannotation should be present. + * Test that the extension reacts to wanted models : a specific eannotation + * should be present. */ public void testAvailableManagersWhenExtensionProvides() { EPackage p = EcoreFactory.eINSTANCE.createEPackage(); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/ContainerAndNodeCopyPasteFormatTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/ContainerAndNodeCopyPasteFormatTest.java index 7a5a15b019..cb061a53dc 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/ContainerAndNodeCopyPasteFormatTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/ContainerAndNodeCopyPasteFormatTest.java @@ -33,7 +33,6 @@ import org.eclipse.sirius.tests.swtbot.Activator; import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase; import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource; import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor; -import org.eclipse.sirius.tests.unit.diagram.layout.data.manager.extension.SampleNameDataProvider; import org.eclipse.swt.graphics.Color; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; @@ -118,40 +117,43 @@ public class ContainerAndNodeCopyPasteFormatTest extends AbstractSiriusSwtBotGef /** * Diagram on third representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}). + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ). */ private SWTBotSiriusDiagramEditor diagramEditor3; /** * Diagram on second representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}). + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ). */ private SWTBotSiriusDiagramEditor diagramEditor4; /** * Diagram on fifth representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}), package are represented by gray square. + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ), package are represented by gray square. */ private SWTBotSiriusDiagramEditor diagramEditor5; /** * Diagram on fifth representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}), package are represented by orange - * diamond. + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ), package are represented by orange diamond. */ private SWTBotSiriusDiagramEditor diagramEditor6; /** * Diagram on fifth representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}), package are represented by yellow - * ellipse. + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ), package are represented by yellow ellipse. */ private SWTBotSiriusDiagramEditor diagramEditor7; /** * Diagram on fifth representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}), package are represented by workspace - * image. + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ), package are represented by workspace image. */ private SWTBotSiriusDiagramEditor diagramEditor8; diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/EdgeCopyPasteFormatTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/EdgeCopyPasteFormatTest.java index a72bc876bb..c107f08a3e 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/EdgeCopyPasteFormatTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/layout/EdgeCopyPasteFormatTest.java @@ -28,7 +28,6 @@ import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCa import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource; import org.eclipse.sirius.tests.swtbot.support.api.condition.CheckSelectedCondition; import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor; -import org.eclipse.sirius.tests.unit.diagram.layout.data.manager.extension.SampleNameDataProvider; import org.eclipse.sirius.viewpoint.DRepresentationElement; import org.eclipse.sirius.viewpoint.RGBValues; import org.eclipse.swt.graphics.Color; @@ -109,13 +108,15 @@ public class EdgeCopyPasteFormatTest extends AbstractSiriusSwtBotGefTestCase { /** * Diagram on third representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}). + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ). */ private SWTBotSiriusDiagramEditor diagram3; /** * Diagram on fourth representation using a specific copy/paste extension ( - * {@link SampleNameDataProvider}). + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ). */ private SWTBotSiriusDiagramEditor diagram4; @@ -182,7 +183,8 @@ public class EdgeCopyPasteFormatTest extends AbstractSiriusSwtBotGefTestCase { /** * Test that the paste layout affect custom style for edges from and to * diagrams using a specific copy/paste extension ( - * {@link SampleNameDataProvider}). + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ). */ public void testEdgeCopyPasteLayoutUsingDiagramsWithExtension() { // Check style of the first representation : it should have custom style @@ -212,7 +214,8 @@ public class EdgeCopyPasteFormatTest extends AbstractSiriusSwtBotGefTestCase { /** * Test that the paste style affect custom style for edges from and to * diagrams using a specific copy/paste extension ( - * {@link SampleNameDataProvider}). + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ). */ public void testEdgeCopyPasteStyleUsingDiagramsWithExtension() { // Check style of the first representation : it should have custom style @@ -244,7 +247,8 @@ public class EdgeCopyPasteFormatTest extends AbstractSiriusSwtBotGefTestCase { /** * Test that the paste format affect custom style for edges from and to * diagrams using a specific copy/paste extension ( - * {@link SampleNameDataProvider}). + * {@link org.eclipse.sirius.tests.unit.diagram.format.data.manager.extension.SampleNameDataProvider} + * ). */ public void testEdgeCopyPasteFormatUsingDiagramsWithExtension() { // Check style of the first representation : it should have custom style |
