diff options
author | Kenn Hussey | 2012-04-17 16:23:51 +0000 |
---|---|---|
committer | Kenn Hussey | 2012-04-17 16:23:51 +0000 |
commit | 852cfbaea52db1195cfa93d4191e4231c295d935 (patch) | |
tree | 92ab3ad8e95359026f0d8289896f54757faf2cc6 | |
parent | 29e5874c331453f6214650d13c2f62e729975ee0 (diff) | |
download | org.eclipse.uml2.test-852cfbaea52db1195cfa93d4191e4231c295d935.tar.gz org.eclipse.uml2.test-852cfbaea52db1195cfa93d4191e4231c295d935.tar.xz org.eclipse.uml2.test-852cfbaea52db1195cfa93d4191e4231c295d935.zip |
[364419] Adding utility for stand-alone registry initialization.
13 files changed, 354 insertions, 15 deletions
diff --git a/plugins/org.eclipse.uml2.uml.resources/.classpath b/plugins/org.eclipse.uml2.uml.resources/.classpath new file mode 100644 index 00000000..304e8618 --- /dev/null +++ b/plugins/org.eclipse.uml2.uml.resources/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/org.eclipse.uml2.uml.resources/.project b/plugins/org.eclipse.uml2.uml.resources/.project index 2ec79b8d..9d89bf79 100644 --- a/plugins/org.eclipse.uml2.uml.resources/.project +++ b/plugins/org.eclipse.uml2.uml.resources/.project @@ -6,6 +6,11 @@ </projects> <buildSpec> <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> <name>org.eclipse.pde.ManifestBuilder</name> <arguments> </arguments> @@ -17,6 +22,7 @@ </buildCommand> </buildSpec> <natures> + <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.pde.PluginNature</nature> </natures> </projectDescription> diff --git a/plugins/org.eclipse.uml2.uml.resources/META-INF/MANIFEST.MF b/plugins/org.eclipse.uml2.uml.resources/META-INF/MANIFEST.MF index 71cf9f04..0f6da851 100644 --- a/plugins/org.eclipse.uml2.uml.resources/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.uml2.uml.resources/META-INF/MANIFEST.MF @@ -3,6 +3,16 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.uml2.uml.resources; singleton:=true Bundle-Version: 4.0.0.qualifier +Bundle-ClassPath: . Bundle-Vendor: %providerName Bundle-Localization: plugin -Require-Bundle: org.eclipse.uml2.uml +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: org.eclipse.uml2.uml.resources, + org.eclipse.uml2.uml.resources.util +Require-Bundle: org.eclipse.uml2.uml, + org.eclipse.uml2.uml.profile.l2, + org.eclipse.uml2.uml.profile.l3, + org.eclipse.core.runtime +Eclipse-LazyStart: true +Bundle-ActivationPolicy: lazy +Bundle-Activator: org.eclipse.uml2.uml.resources.ResourcesPlugin$Implementation diff --git a/plugins/org.eclipse.uml2.uml.resources/build.properties b/plugins/org.eclipse.uml2.uml.resources/build.properties index b468cc25..a3ca25de 100644 --- a/plugins/org.eclipse.uml2.uml.resources/build.properties +++ b/plugins/org.eclipse.uml2.uml.resources/build.properties @@ -1,4 +1,4 @@ -# Copyright (c) 2005, 2007 IBM Corporation and others. +# Copyright (c) 2005, 2012 IBM Corporation, CEA, 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 @@ -6,17 +6,21 @@ # # Contributors: # IBM - initial API and implementation +# Kenn Hussey (CEA) - 364419 # -# $Id: build.properties,v 1.7 2007/04/04 02:20:06 khussey Exp $ # NLS_MESSAGEFORMAT_VAR +source.. = src/ +output.. = bin/ bin.includes = about.html,\ plugin.*,\ + .,\ icons/,\ libraries/,\ metamodels/,\ profiles/,\ META-INF/ src.includes = about.html +exclude.. = **/doc-files/** javacSource = 1.5 javacTarget = 1.5 diff --git a/plugins/org.eclipse.uml2.uml.resources/src/org/eclipse/uml2/uml/resources/ResourcesPlugin.java b/plugins/org.eclipse.uml2.uml.resources/src/org/eclipse/uml2/uml/resources/ResourcesPlugin.java new file mode 100644 index 00000000..5f0dc3e8 --- /dev/null +++ b/plugins/org.eclipse.uml2.uml.resources/src/org/eclipse/uml2/uml/resources/ResourcesPlugin.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2012 CEA 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: + * CEA - initial API and implementation + * + */ +package org.eclipse.uml2.uml.resources; + +import org.eclipse.emf.common.EMFPlugin; +import org.eclipse.emf.common.util.ResourceLocator; + +/** + * @since 4.0 + */ +public class ResourcesPlugin + extends EMFPlugin { + + /** + * The singleton instance of the plugin. + */ + public static final ResourcesPlugin INSTANCE = new ResourcesPlugin(); + + /** + * The one instance of this class. + */ + private static Implementation plugin; + + /** + * Creates the singleton instance. + */ + private ResourcesPlugin() { + super(new ResourceLocator[]{}); + } + + /** + * Returns the singleton instance of the plugin. + * + * @return the singleton instance. + */ + @Override + public ResourceLocator getPluginResourceLocator() { + return plugin; + } + + /** + * The actual implementation of the <b>Plugin</b>. + */ + public static class Implementation + extends EclipsePlugin { + + public Implementation() { + super(); + + plugin = this; + } + } + +} diff --git a/plugins/org.eclipse.uml2.uml.resources/src/org/eclipse/uml2/uml/resources/util/ResourcesUtil.java b/plugins/org.eclipse.uml2.uml.resources/src/org/eclipse/uml2/uml/resources/util/ResourcesUtil.java new file mode 100644 index 00000000..8e40de4b --- /dev/null +++ b/plugins/org.eclipse.uml2.uml.resources/src/org/eclipse/uml2/uml/resources/util/ResourcesUtil.java @@ -0,0 +1,198 @@ +/* + * Copyright (c) 2012 CEA 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: + * CEA - initial API and implementation + * + */ +package org.eclipse.uml2.uml.resources.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EcorePackage; +import org.eclipse.emf.ecore.resource.ContentHandler; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.URIConverter; +import org.eclipse.emf.ecore.xmi.impl.RootXMLContentHandlerImpl; +import org.eclipse.uml2.types.TypesPackage; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.UMLPlugin; +import org.eclipse.uml2.uml.profile.l2.L2Package; +import org.eclipse.uml2.uml.profile.l3.L3Package; +import org.eclipse.uml2.uml.resource.CMOF2UMLResource; +import org.eclipse.uml2.uml.resource.UML212UMLResource; +import org.eclipse.uml2.uml.resource.UML22UMLResource; +import org.eclipse.uml2.uml.resource.UML302UMLResource; +import org.eclipse.uml2.uml.resource.UMLResource; +import org.eclipse.uml2.uml.resource.XMI2UMLResource; +import org.eclipse.uml2.uml.util.UMLUtil; + +/** + * @since 4.0 + */ +public class ResourcesUtil + extends UMLUtil { + + /** + * Initializes the registries for the specified resource set (or the global + * registries if <code>null</code>) with the registrations needed to work + * with UML2 resources in stand-alone mode (i.e., without Eclipse). + * + * @param resourceSet + * The resource set whose registries to initialize, or + * <code>null</code>. + * @return The resource set (or <code>null</code>). + * + * @since 4.0 + */ + public static ResourceSet init(ResourceSet resourceSet) { + EPackage.Registry packageRegistry = resourceSet == null + ? EPackage.Registry.INSTANCE + : resourceSet.getPackageRegistry(); + + packageRegistry.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE); + + packageRegistry.put(TypesPackage.eNS_URI, TypesPackage.eINSTANCE); + + packageRegistry.put( + "http://www.eclipse.org/uml2/2.0.0/UML", UMLPackage.eINSTANCE); //$NON-NLS-1$ + + packageRegistry.put(UML212UMLResource.UML_METAMODEL_NS_URI, + UMLPackage.eINSTANCE); + packageRegistry.put(UML302UMLResource.UML_METAMODEL_NS_URI, + UMLPackage.eINSTANCE); + + packageRegistry.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); + + packageRegistry.put(UML302UMLResource.STANDARD_PROFILE_NS_URI, + L2Package.eINSTANCE); + + packageRegistry.put(L2Package.eNS_URI, L2Package.eINSTANCE); + packageRegistry.put(L3Package.eNS_URI, L3Package.eINSTANCE); + + Map<String, URI> ePackageNsURIToProfileLocationMap = UMLPlugin + .getEPackageNsURIToProfileLocationMap(); + + ePackageNsURIToProfileLocationMap.put(L2Package.eNS_URI, + URI.createURI("pathmap://UML_PROFILES/StandardL2.profile.uml#_0")); //$NON-NLS-1$ + ePackageNsURIToProfileLocationMap.put(L3Package.eNS_URI, + URI.createURI("pathmap://UML_PROFILES/StandardL3.profile.uml#_0")); //$NON-NLS-1$ + + ePackageNsURIToProfileLocationMap.put(UMLResource.ECORE_PROFILE_NS_URI, + URI.createURI("pathmap://UML_PROFILES/Ecore.profile.uml#_0")); //$NON-NLS-1$ + + Map<URI, URI> uriMap = resourceSet == null + ? URIConverter.URI_MAP + : resourceSet.getURIConverter().getURIMap(); + + uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), URI + .createPlatformPluginURI( + "/org.eclipse.uml2.uml.resources/libraries/", true)); //$NON-NLS-1$ + uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), URI + .createPlatformPluginURI( + "/org.eclipse.uml2.uml.resources/metamodels/", true)); //$NON-NLS-1$ + uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), URI + .createPlatformPluginURI( + "/org.eclipse.uml2.uml.resources/profiles/", true)); //$NON-NLS-1$ + + List<ContentHandler> contentHandlers; + + if (resourceSet == null) { + contentHandlers = ContentHandler.Registry.INSTANCE + .get(ContentHandler.Registry.NORMAL_PRIORITY); + + if (contentHandlers == null) { + ContentHandler.Registry.INSTANCE.put( + ContentHandler.Registry.NORMAL_PRIORITY, + contentHandlers = new ArrayList<ContentHandler>()); + } + } else { + contentHandlers = resourceSet.getURIConverter() + .getContentHandlers(); + } + + String[] extensions = new String[]{"uml2"}; //$NON-NLS-1$ + + contentHandlers.add(new RootXMLContentHandlerImpl( + UML22UMLResource.UML2_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + UML22UMLResource.UML2_METAMODEL_NS_URI, null)); + + extensions = new String[]{"uml"}; //$NON-NLS-1$ + + contentHandlers.add(new RootXMLContentHandlerImpl( + UMLResource.UML_2_0_0_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + "http://www.eclipse.org/uml2/2.0.0/UML", null)); //$NON-NLS-1$ + contentHandlers.add(new RootXMLContentHandlerImpl( + UMLResource.UML_2_1_0_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + UML212UMLResource.UML_METAMODEL_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + UMLResource.UML_3_0_0_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + UML302UMLResource.UML_METAMODEL_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + UMLResource.UML_4_0_0_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, UMLPackage.eNS_URI, null)); + + extensions = new String[]{"xmi"}; //$NON-NLS-1$ + + contentHandlers.add(new RootXMLContentHandlerImpl( + XMI2UMLResource.UML_2_1_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + XMI2UMLResource.UML_METAMODEL_2_1_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + XMI2UMLResource.UML_2_1_1_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + XMI2UMLResource.UML_METAMODEL_2_1_1_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + XMI2UMLResource.UML_2_2_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + XMI2UMLResource.UML_METAMODEL_2_2_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + XMI2UMLResource.UML_2_4_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + XMI2UMLResource.UML_METAMODEL_2_4_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + XMI2UMLResource.UML_2_4_1_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + XMI2UMLResource.UML_METAMODEL_2_4_1_NS_URI, null)); + + extensions = new String[]{"cmof", "xmi"}; //$NON-NLS-1$ + + contentHandlers.add(new RootXMLContentHandlerImpl( + CMOF2UMLResource.CMOF_2_0_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + CMOF2UMLResource.CMOF_2_0_METAMODEL_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + CMOF2UMLResource.CMOF_2_4_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + CMOF2UMLResource.CMOF_2_4_METAMODEL_NS_URI, null)); + contentHandlers.add(new RootXMLContentHandlerImpl( + CMOF2UMLResource.CMOF_2_4_1_CONTENT_TYPE_IDENTIFIER, extensions, + RootXMLContentHandlerImpl.XMI_KIND, + CMOF2UMLResource.CMOF_2_4_1_METAMODEL_NS_URI, null)); + + (resourceSet == null + ? Resource.Factory.Registry.INSTANCE + : resourceSet.getResourceFactoryRegistry()) + .getContentTypeToFactoryMap().put( + UMLResource.UML_4_0_0_CONTENT_TYPE_IDENTIFIER, + UMLResource.Factory.INSTANCE); + + UMLUtil.init(resourceSet); + + return resourceSet; + } + +} diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF202UMLResourceFactoryImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF202UMLResourceFactoryImpl.java index d4225d7a..7ce21b92 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF202UMLResourceFactoryImpl.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF202UMLResourceFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011 IBM Corporation, Embarcadero Technologies, CEA, and others. + * Copyright (c) 2007, 2012 IBM Corporation, Embarcadero Technologies, CEA, 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 @@ -7,7 +7,7 @@ * * Contributors: * Kenn Hussey (IBM Corporation, Embarcadero Technologies) - initial API and implementation - * Kenn Hussey (CEA) - 327039 + * Kenn Hussey (CEA) - 327039, 364419 * */ package org.eclipse.uml2.uml.internal.resource; @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry; import org.eclipse.emf.mapping.ecore2xml.impl.Ecore2XMLRegistryImpl; +import org.eclipse.emf.mapping.ecore2xml.util.Ecore2XMLResource; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.resource.CMOF202UMLResource; import org.eclipse.uml2.uml.resource.CMOF2UMLExtendedMetaData; @@ -66,6 +67,12 @@ public class CMOF202UMLResourceFactoryImpl ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.setPackageRegistry(ePackageRegistry); + resourceSet + .getResourceFactoryRegistry() + .getExtensionToFactoryMap() + .put(Ecore2XMLResource.FILE_EXTENSION, + Ecore2XMLResource.Factory.INSTANCE); + Ecore2XMLRegistry ecore2xmlRegistry = new Ecore2XMLRegistryImpl( Ecore2XMLRegistry.INSTANCE); ecore2xmlRegistry diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF2UMLResourceFactoryImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF2UMLResourceFactoryImpl.java index a7cfdacd..898756f8 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF2UMLResourceFactoryImpl.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/CMOF2UMLResourceFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2011 IBM Corporation, Embarcadero Technologies, CEA, and others. + * Copyright (c) 2007, 2012 IBM Corporation, Embarcadero Technologies, CEA, 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 @@ -7,7 +7,7 @@ * * Contributors: * Kenn Hussey (IBM Corporation, Embarcadero Technologies) - initial API and implementation - * Kenn Hussey (CEA) - 351774 + * Kenn Hussey (CEA) - 351774, 364419 * */ package org.eclipse.uml2.uml.internal.resource; @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry; import org.eclipse.emf.mapping.ecore2xml.impl.Ecore2XMLRegistryImpl; +import org.eclipse.emf.mapping.ecore2xml.util.Ecore2XMLResource; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.resource.CMOF2UMLExtendedMetaData; import org.eclipse.uml2.uml.resource.CMOF2UMLResource; @@ -69,6 +70,12 @@ public class CMOF2UMLResourceFactoryImpl ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.setPackageRegistry(ePackageRegistry); + resourceSet + .getResourceFactoryRegistry() + .getExtensionToFactoryMap() + .put(Ecore2XMLResource.FILE_EXTENSION, + Ecore2XMLResource.Factory.INSTANCE); + Ecore2XMLRegistry ecore2xmlRegistry = new Ecore2XMLRegistryImpl( Ecore2XMLRegistry.INSTANCE); diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLResourceFactoryImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLResourceFactoryImpl.java index cc0f0062..b8b3f022 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLResourceFactoryImpl.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML212UMLResourceFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011 IBM Corporation, CEA, and others. + * Copyright (c) 2008, 2012 IBM Corporation, CEA, 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 @@ -7,7 +7,7 @@ * * Contributors: * IBM - initial API and implementation - * Kenn Hussey (CEA) - 327039 + * Kenn Hussey (CEA) - 327039, 364419 * */ package org.eclipse.uml2.uml.internal.resource; @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry; import org.eclipse.emf.mapping.ecore2xml.impl.Ecore2XMLRegistryImpl; +import org.eclipse.emf.mapping.ecore2xml.util.Ecore2XMLResource; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.resource.UML212UMLResourceHandler; import org.eclipse.uml2.uml.resource.UML212UMLExtendedMetaData; @@ -75,6 +76,12 @@ public class UML212UMLResourceFactoryImpl ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.setPackageRegistry(ePackageRegistry); + resourceSet + .getResourceFactoryRegistry() + .getExtensionToFactoryMap() + .put(Ecore2XMLResource.FILE_EXTENSION, + Ecore2XMLResource.Factory.INSTANCE); + Ecore2XMLRegistry ecore2xmlRegistry = new Ecore2XMLRegistryImpl( Ecore2XMLRegistry.INSTANCE); ecore2xmlRegistry diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML22UMLResourceFactoryImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML22UMLResourceFactoryImpl.java index 3b91cc5c..2fc38cb9 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML22UMLResourceFactoryImpl.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML22UMLResourceFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2012 IBM Corporation, CEA, 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 @@ -7,8 +7,8 @@ * * Contributors: * IBM - initial API and implementation + * Kenn Hussey (CEA) - 364419 * - * $Id: UML22UMLResourceFactoryImpl.java,v 1.7 2006/12/14 15:49:34 khussey Exp $ */ package org.eclipse.uml2.uml.internal.resource; @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry; import org.eclipse.emf.mapping.ecore2xml.impl.Ecore2XMLRegistryImpl; +import org.eclipse.emf.mapping.ecore2xml.util.Ecore2XMLResource; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.resource.UML22UMLExtendedMetaData; import org.eclipse.uml2.uml.resource.UML22UMLResource; @@ -65,6 +66,12 @@ public class UML22UMLResourceFactoryImpl ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.setPackageRegistry(ePackageRegistry); + resourceSet + .getResourceFactoryRegistry() + .getExtensionToFactoryMap() + .put(Ecore2XMLResource.FILE_EXTENSION, + Ecore2XMLResource.Factory.INSTANCE); + Ecore2XMLRegistry ecore2xmlRegistry = new Ecore2XMLRegistryImpl( Ecore2XMLRegistry.INSTANCE); ecore2xmlRegistry diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML302UMLResourceFactoryImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML302UMLResourceFactoryImpl.java index 3e825e65..427af9a9 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML302UMLResourceFactoryImpl.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/UML302UMLResourceFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 CEA and others. + * Copyright (c) 2011, 2012 CEA 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 @@ -7,6 +7,7 @@ * * Contributors: * CEA - initial API and implementation + * Kenn Hussey (CEA) - 364419 * */ package org.eclipse.uml2.uml.internal.resource; @@ -31,6 +32,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry; import org.eclipse.emf.mapping.ecore2xml.impl.Ecore2XMLRegistryImpl; +import org.eclipse.emf.mapping.ecore2xml.util.Ecore2XMLResource; /** * Resource factory that converts .uml models. @@ -73,6 +75,12 @@ public class UML302UMLResourceFactoryImpl ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.setPackageRegistry(ePackageRegistry); + resourceSet + .getResourceFactoryRegistry() + .getExtensionToFactoryMap() + .put(Ecore2XMLResource.FILE_EXTENSION, + Ecore2XMLResource.Factory.INSTANCE); + Ecore2XMLRegistry ecore2xmlRegistry = new Ecore2XMLRegistryImpl( Ecore2XMLRegistry.INSTANCE); ecore2xmlRegistry diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI212UMLResourceFactoryImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI212UMLResourceFactoryImpl.java index 0b12a38e..5ca538b0 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI212UMLResourceFactoryImpl.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI212UMLResourceFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2011 IBM Corporation, CEA, and others. + * Copyright (c) 2008, 2012 IBM Corporation, CEA, 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 @@ -7,7 +7,7 @@ * * Contributors: * IBM - initial API and implementation - * Kenn Hussey (CEA) - 327039 + * Kenn Hussey (CEA) - 327039, 364419 * */ package org.eclipse.uml2.uml.internal.resource; @@ -26,6 +26,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry; import org.eclipse.emf.mapping.ecore2xml.impl.Ecore2XMLRegistryImpl; +import org.eclipse.emf.mapping.ecore2xml.util.Ecore2XMLResource; import org.eclipse.uml2.uml.UMLPackage; import org.eclipse.uml2.uml.resource.CMOF2UMLResourceHandler; import org.eclipse.uml2.uml.resource.UML212UMLResourceHandler; @@ -89,6 +90,12 @@ public class XMI212UMLResourceFactoryImpl ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.setPackageRegistry(ePackageRegistry); + resourceSet + .getResourceFactoryRegistry() + .getExtensionToFactoryMap() + .put(Ecore2XMLResource.FILE_EXTENSION, + Ecore2XMLResource.Factory.INSTANCE); + Ecore2XMLRegistry ecore2xmlRegistry = new Ecore2XMLRegistryImpl( Ecore2XMLRegistry.INSTANCE); ecore2xmlRegistry diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI222UMLResourceFactoryImpl.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI222UMLResourceFactoryImpl.java index df5279f4..e2171873 100644 --- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI222UMLResourceFactoryImpl.java +++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/resource/XMI222UMLResourceFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011 CEA and others. + * Copyright (c) 2011, 2012 CEA 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 @@ -7,6 +7,7 @@ * * Contributors: * CEA - initial API and implementation + * Kenn Hussey (CEA) - 364419 * */ package org.eclipse.uml2.uml.internal.resource; @@ -34,6 +35,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLPackage; import org.eclipse.emf.mapping.ecore2xml.Ecore2XMLRegistry; import org.eclipse.emf.mapping.ecore2xml.impl.Ecore2XMLRegistryImpl; +import org.eclipse.emf.mapping.ecore2xml.util.Ecore2XMLResource; /** * Resource factory that converts .xmi models. @@ -86,6 +88,12 @@ public class XMI222UMLResourceFactoryImpl ResourceSet resourceSet = new ResourceSetImpl(); resourceSet.setPackageRegistry(ePackageRegistry); + resourceSet + .getResourceFactoryRegistry() + .getExtensionToFactoryMap() + .put(Ecore2XMLResource.FILE_EXTENSION, + Ecore2XMLResource.Factory.INSTANCE); + Ecore2XMLRegistry ecore2xmlRegistry = new Ecore2XMLRegistryImpl( Ecore2XMLRegistry.INSTANCE); ecore2xmlRegistry |