diff options
author | Camille Letavernier | 2015-09-30 08:57:28 +0000 |
---|---|---|
committer | Camille Letavernier | 2015-09-30 08:57:28 +0000 |
commit | 518cbc26c0d0f45c44a721d8882ae784d161d519 (patch) | |
tree | 8d678ef16686ae4d9769aca39eb63da3dc3072b3 /extraplugins/migration | |
parent | 5368c638375f6d07aad3352c569cbe980a3f8fea (diff) | |
download | org.eclipse.papyrus-518cbc26c0d0f45c44a721d8882ae784d161d519.tar.gz org.eclipse.papyrus-518cbc26c0d0f45c44a721d8882ae784d161d519.tar.xz org.eclipse.papyrus-518cbc26c0d0f45c44a721d8882ae784d161d519.zip |
471684: [RSA Import] Strange import result for showListStereotype
property
https://bugs.eclipse.org/bugs/show_bug.cgi?id=471684
- Workaround: Clean up invalid metadata EAnnotations at the root of each
resource
Change-Id: I0c3250ae896b106a303475bca012641c34e6134a
Signed-off-by: Camille Letavernier <camille.letavernier@cea.fr>
Diffstat (limited to 'extraplugins/migration')
-rw-r--r-- | extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java index 6c337c7d906..0cedacb6043 100644 --- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java +++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java @@ -49,6 +49,7 @@ import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.util.ExtendedMetaData; import org.eclipse.emf.ecore.xmi.XMIResource; import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl; @@ -566,6 +567,7 @@ public class ImportTransformation { for (Resource resource : resourcesToSave) { try { + cleanMetadataAnnotations(resource); ResourceAccessHelper.INSTANCE.saveResource(resource, null); } catch (Exception ex) { Activator.log.error(ex); @@ -586,6 +588,24 @@ public class ImportTransformation { return generationStatus; } + /** + * @param resource + */ + private void cleanMetadataAnnotations(Resource resource) { + // Bug 471684: UML2.x to UML2.5 creates (invalid) Ecore Metadata EAnnotations, which then cause OCL validation to fail + // Remove these EAnnotations from the model to avoid side effects + Iterator<EObject> rootElementsIterator = resource.getContents().iterator(); + while (rootElementsIterator.hasNext()) { + EObject root = rootElementsIterator.next(); + if (root instanceof EAnnotation) { + EAnnotation annotation = (EAnnotation) root; + if (ExtendedMetaData.ANNOTATION_URI.equals(annotation.getSource())) { + rootElementsIterator.remove(); + } + } + } + } + protected void handleDanglingURIs(Collection<Resource> resourcesToSave) { if (analysisHelper != null) { resourceSet.freeze(); |