diff options
| author | Belqassim Djafer | 2014-11-04 15:42:25 +0000 |
|---|---|---|
| committer | Laurent Redor | 2014-11-07 16:41:54 +0000 |
| commit | 6476822c3e7a5c79dc242823ef627bb1024731de (patch) | |
| tree | 8ff0a4dc4a473110381ede2ff8278d3b0dfc8a56 | |
| parent | 59fa392fad179ef1d128b9989d906c6f6fc6fe1e (diff) | |
| download | org.eclipse.sirius-6476822c3e7a5c79dc242823ef627bb1024731de.tar.gz org.eclipse.sirius-6476822c3e7a5c79dc242823ef627bb1024731de.tar.xz org.eclipse.sirius-6476822c3e7a5c79dc242823ef627bb1024731de.zip | |
[449167] Fix regression caused by Removing A3 references in Sirius MM
Add a migration participant to update object values in VSM before
loading this objects from XML file.
By using this added migration, attributes that use the default value of
sizeComputationExpression of EdgeStyleDescription and
colorValueComputationExpression of InterpolatedColor in VSM ("1") were
replaced by the Acceleo expression ("[eContents()->size()/]").
Bug: 449167
Change-Id: Id1001924abc2b3942fc98d9e98463e9bd57a650d
Signed-off-by: Belqassim Djafer <belqassim.djafer@obeo.fr>
8 files changed, 141 insertions, 13 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml index 7b099d206a..be9fe5e92b 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.xml +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.xml @@ -1818,6 +1818,10 @@ kind="VSM"> </participant> <participant + class="org.eclipse.sirius.diagram.ui.business.internal.migration.description.AcceleoExpressionsMigrationParticipant" + kind="VSM"> + </participant> + <participant class="org.eclipse.sirius.diagram.ui.business.internal.migration.DiagramSplitMigrationParticipant" kind="RepresentationsFile"> </participant> diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/description/AcceleoExpressionsMigrationParticipant.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/description/AcceleoExpressionsMigrationParticipant.java new file mode 100644 index 0000000000..d35da2e711 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/migration/description/AcceleoExpressionsMigrationParticipant.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 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.diagram.ui.business.internal.migration.description; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.sirius.business.api.migration.AbstractVSMMigrationParticipant; +import org.eclipse.sirius.diagram.description.style.EdgeStyleDescription; +import org.eclipse.sirius.viewpoint.description.InterpolatedColor; +import org.osgi.framework.Version; + +/** + * All Acceleo 3 references have been removed in Sirius Metamodels to avoid a + * dependency to Acceleo 3. This migration contribution goal is to replace each + * default value in VSMs by the old default value expression to avoid a change + * of behavior. + * + * @author <a href="mailto:belqassim.djafer@obeo.fr">Belqassim Djafer</a> + * + */ +public class AcceleoExpressionsMigrationParticipant extends AbstractVSMMigrationParticipant { + + private static final String OLD_EXPRESSION_DEFAULT_VALUE = "[eContents()->size()/]"; + + /** + * The Sirius version for which this migration is added. + */ + private static final Version MIGRATION_VERSION = new Version("10.0.0.201411061000"); + + @Override + public Version getMigrationVersion() { + return MIGRATION_VERSION; + } + + @Override + public EObject updateCreatedObject(EObject newObject, String loadedVersion) { + if (Version.parseVersion(loadedVersion).compareTo(MIGRATION_VERSION) < 0) { + if (newObject instanceof EdgeStyleDescription) { + ((EdgeStyleDescription) newObject).setSizeComputationExpression(OLD_EXPRESSION_DEFAULT_VALUE); + } else if (newObject instanceof InterpolatedColor) { + ((InterpolatedColor) newObject).setColorValueComputationExpression(OLD_EXPRESSION_DEFAULT_VALUE); + } + } + return newObject; + } +} diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html index 952eadfd9e..1e456c42bc 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.html @@ -13,6 +13,9 @@ <a href="#ReleaseNotesforSirius">Release Notes for Sirius</a> <ol style="list-style: disc;"> <li> + <a href="#sirius3.0.0">Changes in Sirius 3.0.0 (from Sirius 2.0.0)</a> + </li> + <li> <a href="#sirius2.0.0">Changes in Sirius 2.0.0 (from Sirius 1.0.0)</a> </li> <li> @@ -37,6 +40,20 @@ </li> </ol> <p>This document contains the release notes for all major releases of Sirius.</p> + <h2 id="sirius3.0.0">Changes in Sirius 3.0.0 (from Sirius 2.0.0)</h2> + <h3 id="ChangesAPI">Changes API</h3> + <h4 id="Changesinorg.eclipse.sirius">Changes in + <code>org.eclipse.sirius</code> + </h4> + <ul> + <li>The method + <code>org.eclipse.sirius.business.api.migration.IMigrationParticipant.updateCreatedObject(EObject newObject, String loadedVersion)</code> have been added to update explicitly the default value of sizeComputationExpression in VSM («1») by the expression («[eContents()->size()/]»). This method can be used to update also default values in VSM. + </li> + </ul> + <h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3> + <ul> + <li>All Acceleo 3 references have been removed in Sirius Metamodels to avoid a dependence to Acceleo 3 but a migration have been added explicitly in VSM to avoid a change of behavior. Customers who want to completly remove this dependency must remove the A3 expressions from there VSM after the migration.</li> + </ul> <h2 id="sirius2.0.0">Changes in Sirius 2.0.0 (from Sirius 1.0.0)</h2> <h3 id="UserVisibleChanges">User-Visible Changes</h3> <ul> @@ -89,7 +106,7 @@ <li>Reconnection of an edge will only now move the minimum necessary bendpoints instead of reseting it to default.</li> <li>A new action has been added to reset the diagram (or container) origin: the diagram (or container) bounds (the rectangle formed by the highest, the leftmost, the lowest and the rightmost children elements) can have a negative origin or can be shifted toward the bottom-right with a blank zone at the top-left. This action aims to move all diagram (or container) elements so that the it retrieves its origin while keeping elements layout.</li> </ul> - <h3 id="SpecifierVisibleChanges">Specifier-Visible Changes</h3> + <h3 id="SpecifierVisibleChanges2">Specifier-Visible Changes</h3> <ul> <li>The specifier can now choose to hold the edge ends toward the center of the source, target or both. New fields within the «advance» tab of EdgeStyle description have been added to choose for which source or target mappings an edge should be centered. See <a href="specifier/diagrams/Diagrams.html#edges_styles">Edges Styles > Edge Centering</a> in the specifier manual for more details. @@ -99,7 +116,7 @@ </li> </ul> <h3 id="APIChanges">API Changes</h3> - <h4 id="Changesinorg.eclipse.sirius">Changes in + <h4 id="Changesinorg.eclipse.sirius2">Changes in <code>org.eclipse.sirius</code> </h4> <ul> @@ -461,7 +478,7 @@ <ul> <li>The ability to print table representations has been disabled for the 1.0.0 release due to an external dependency issue (see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=435204" target="_blank">bug #435204</a> for the details).</li> </ul> - <h3 id="SpecifierVisibleChanges2">Specifier-Visible Changes</h3> + <h3 id="SpecifierVisibleChanges3">Specifier-Visible Changes</h3> <ul> <li> <em>Node</em>, @@ -476,7 +493,7 @@ </li> </ul> <h3 id="APIChanges2">API Changes</h3> - <h4 id="Changesinorg.eclipse.sirius2">Changes in + <h4 id="Changesinorg.eclipse.sirius3">Changes in <code>org.eclipse.sirius</code> </h4> <ul> @@ -521,7 +538,7 @@ </li> </ul> <h2 id="sirius1.0M7">Changes in Sirius 1.0.0M7 (from Sirius 1.0M6)</h2> - <h3 id="SpecifierVisibleChanges3">Specifier-Visible Changes</h3> + <h3 id="SpecifierVisibleChanges4">Specifier-Visible Changes</h3> <ul> <li>The default value of the <em>Semantic Candidates Expression</em> for Tree Items has changed from an empty string (meaning «any compatible element in the session») to @@ -752,7 +769,7 @@ <code>Predicate</code> tested on the key. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius3">Changes in + <h4 id="Changesinorg.eclipse.sirius4">Changes in <code>org.eclipse.sirius</code> </h4> <ul> @@ -1138,7 +1155,7 @@ if (rootPackage != null && rootPackage.getNsURI().equals(DiagramPackage. <p>if <code>element</code> is a Diagram concept. </p> - <h4 id="Changesinorg.eclipse.sirius4">Changes in + <h4 id="Changesinorg.eclipse.sirius5">Changes in <code>org.eclipse.sirius</code> </h4> <ul> @@ -1302,7 +1319,7 @@ if (rootPackage != null && rootPackage.getNsURI().equals(DiagramPackage. <code>viewpoint/diagram/description/concern</code> </li> </ul> - <h4 id="Changesinorg.eclipse.sirius5">Changes in + <h4 id="Changesinorg.eclipse.sirius6">Changes in <code>org.eclipse.sirius</code> </h4> <ul> @@ -1394,7 +1411,7 @@ if (rootPackage != null && rootPackage.getNsURI().equals(DiagramPackage. <code>org.eclipse.sirius.table.tools.api.interpreter.IInterpreterSiriusTableVariables</code> instead. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius6">Changes in + <h4 id="Changesinorg.eclipse.sirius7">Changes in <code>org.eclipse.sirius</code> </h4> <ul> @@ -1938,7 +1955,7 @@ void addSelectedView(DView view) throws IllegalArgumentException; void removeSelectedView(DView view); </pre> - <h3 id="SpecifierVisibleChanges4">Specifier-Visible Changes</h3> + <h3 id="SpecifierVisibleChanges5">Specifier-Visible Changes</h3> <p>New variables are available for <code>sizeComputationExpression</code> to compute the size of edges on <code>EdgeStyleDescription</code> and diff --git a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile index fc63af56df..4f78881b01 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release Notes.textile @@ -4,6 +4,18 @@ h1. Release Notes for Sirius This document contains the release notes for all major releases of Sirius. +h2(#sirius3.0.0). Changes in Sirius 3.0.0 (from Sirius 2.0.0) + +h3. Changes API + +h4. Changes in @org.eclipse.sirius@ + +* The method @org.eclipse.sirius.business.api.migration.IMigrationParticipant.updateCreatedObject(EObject newObject, String loadedVersion)@ have been added to update object values in VSM before loading this objects from XML file. + +h3. Specifier-Visible Changes + +* All Acceleo 3 references have been removed in Sirius Metamodels to avoid a dependency to Acceleo 3 but an automatic migration have been added during the loading of the VSM to avoid a change of behavior. This migration adds explicitly the old default value (@[eContents()->size()/]@) in the VSM, that was implicit before. Customers who want to completely remove this dependency must remove the A3 expressions from there VSM after the migration. + h2(#sirius2.0.0). Changes in Sirius 2.0.0 (from Sirius 1.0.0) h3. User-Visible Changes diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/AbstractMigrationParticipant.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/AbstractMigrationParticipant.java index 4ee96e43f6..fa03aa09fc 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/AbstractMigrationParticipant.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/AbstractMigrationParticipant.java @@ -149,4 +149,10 @@ public abstract class AbstractMigrationParticipant implements IMigrationParticip handleFeature(owner, entry.getEStructuralFeature(), entry.getValue()); } } + + @Override + public EObject updateCreatedObject(EObject newObject, String loadedVersion) { + return newObject; + } + } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/IMigrationParticipant.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/IMigrationParticipant.java index 49b16dfdc7..db80974ccf 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/IMigrationParticipant.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/migration/IMigrationParticipant.java @@ -148,4 +148,17 @@ public interface IMigrationParticipant { * @return an EPackage if some mapping exists, null otherwise. */ EPackage getPackage(String namespace, String loadedVersion); + + /** + * Allows to update the created object just after its creation (the + * attribute values are not yet loaded from XML file). + * + * @param newObject + * the new created object + * @param loadedVersion + * the version of current loading model + * @return An EObject with updated values or the EObject itself if this + * migration has nothing to do. + */ + EObject updateCreatedObject(EObject newObject, String loadedVersion); } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/AbstractSiriusMigrationService.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/AbstractSiriusMigrationService.java index cd7412dbdd..3f3127e8d2 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/AbstractSiriusMigrationService.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/AbstractSiriusMigrationService.java @@ -276,4 +276,23 @@ public abstract class AbstractSiriusMigrationService { } return returnedValue; } + + /** + * Allows to update the created object just after its creation (the + * attribute values are not yet loaded from XML file). + * + * @param newObject + * the new created object + * @param loadedVersion + * the version of current loading model + * @return An EObject with updated values or the EObject itself if this + * migration has nothing to do. + */ + public EObject updateCreatedObject(EObject newObject, String loadedVersion) { + EObject returnedValue = newObject; + for (IMigrationParticipant contribution : delegatesParticipants) { + returnedValue = contribution.updateCreatedObject(returnedValue, loadedVersion); + } + return returnedValue; + } } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/description/VSMXMIHelper.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/description/VSMXMIHelper.java index 906c660edc..2d66db7bfe 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/description/VSMXMIHelper.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/migration/description/VSMXMIHelper.java @@ -26,7 +26,7 @@ import org.osgi.framework.Version; * */ public class VSMXMIHelper extends XMIHelperImpl { - + private String version; private boolean migrationNeeded; @@ -39,7 +39,7 @@ public class VSMXMIHelper extends XMIHelperImpl { */ public VSMXMIHelper(XMLResource resource) { super(resource); - + VSMVersionSAXParser parser = new VSMVersionSAXParser(resource.getURI()); this.version = parser.getVersion(new NullProgressMonitor()); this.migrationNeeded = VSMMigrationService.getInstance().isMigrationNeeded(Version.parseVersion(version)); @@ -77,6 +77,10 @@ public class VSMXMIHelper extends XMIHelperImpl { factory = type.getEPackage().getEFactoryInstance(); } } - return super.createObject(factory, type); + EObject newObject = super.createObject(factory, type); + if (migrationNeeded) { + newObject = VSMMigrationService.getInstance().updateCreatedObject(newObject, version); + } + return newObject; } } |
