Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Unable to read profile or model file programatically
Unable to read profile or model file programatically [message #471180] Thu, 01 March 2007 08:42 Go to next message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Hi,

I'm using eclipse 3.2.1 with UML 2.0.2 and EMF 2.2.0, and have worked my
way through the tutorial 'Introduction to UML2 Profiles'
( http://dev.eclipse.org/viewcvs/indextools.cgi/uml2-home/docs /articles/Introduction_to_UML2_Profiles/article.html).
I have successfully generated a profile output file that is readable by
the eclipse profile editor, and have a model file that uses this profile
(also readable by eclipse UML editor). But as yet I am unable to read
either of these files from my test code.

Here's how I'm attempting to load the file(s):

ResourceSet RESOURCE_SET = new ResourceSetImpl();
Resource resource = RESOURCE_SET.getResource(uri, true);

package_ = (org.eclipse.uml2.uml.Package)
EcoreUtil.getObjectByType(
resource.getContents(),
UMLPackage.Literals.PACKAGE);


The return value is null for either the profile or for the model file URI.
Any help would be greatly appreciated.
Thanks
Re: Unable to read profile or model file programatically [message #471184 is a reply to message #471180] Thu, 01 March 2007 08:57 Go to previous messageGo to next message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Having looked through the source code for the UML2 plugin, I've managed to
solve this problem as follows (although I'm not convinced it's the correct
approach). The resourceSet object must be initialised in the following
manner:

EPackage.Registry ePackageRegistry = new
EPackageRegistryImpl(EPackage.Registry.INSTANCE);
ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
UMLPackage.eINSTANCE);
ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
UMLPackage.eINSTANCE);

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.setPackageRegistry(ePackageRegistry);
Re: Unable to read profile or model file programatically [message #471345 is a reply to message #471184] Fri, 02 March 2007 14:21 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Paul,

No, this code isn't correct; what you need to do, assuming you're running
stand-alone, is ensure the package, extension, and pathmaps are registered.
This source for the profiles article
( http://download.eclipse.org/modeling/mdt/uml2/downloads/arti cles/uml2.articles_200607181325.zip)
shows how to do this; alternatively, you could follow the advice in the FAQ
at
http://wiki.eclipse.org/index.php/MDT-UML2-FAQ#What.27s_requ ired_to_load_a_UML_.28.uml.29_resource_from_a_standalone_app lication.3F.

Kenn

"Paul Gribben" <paul.gribben@gmail.com> wrote in message
news:eea9d951de0b1834b2f35a0fe56db4ea$1@www.eclipse.org...
> Having looked through the source code for the UML2 plugin, I've managed to
> solve this problem as follows (although I'm not convinced it's the correct
> approach). The resourceSet object must be initialised in the following
> manner:
>
> EPackage.Registry ePackageRegistry = new
> EPackageRegistryImpl(EPackage.Registry.INSTANCE);
> ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
> UMLPackage.eINSTANCE);
> ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
> UMLPackage.eINSTANCE);
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.setPackageRegistry(ePackageRegistry);
>
>
>
Re: Unable to read profile or model file programatically [message #471351 is a reply to message #471345] Mon, 05 March 2007 08:25 Go to previous messageGo to next message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Great. Thanks for that Kenn.
I wonder if it would be worth adding a convenient ResourceSet initializer
to the UML2 codebase to perform these registration steps?
Cheers
Paul
Re: Unable to read profile or model file programatically [message #471353 is a reply to message #471351] Tue, 06 March 2007 00:49 Go to previous messageGo to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Paul,

If you open an enhancement request, we'll consider it.

Kenn

"Paul Gribben" <paul.gribben@gmail.com> wrote in message
news:60e20b022e00dbee4a4f200f5591f15a$1@www.eclipse.org...
> Great. Thanks for that Kenn.
> I wonder if it would be worth adding a convenient ResourceSet initializer
> to the UML2 codebase to perform these registration steps?
> Cheers
> Paul
>
Re: Unable to read profile or model file programatically [message #476704 is a reply to message #471345] Wed, 05 December 2007 14:41 Go to previous messageGo to next message
Bert Vanhooff is currently offline Bert VanhooffFriend
Messages: 6
Registered: July 2009
Junior Member
Hi,

When I use the technique described in the wiki (see code below) the
profile is always null.

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,UMLResource.Factory.I NSTANCE);
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI uri =
URI.createURI(" jar:file://Users/bertvh/Temp/eclipse/plugins/org.eclipse.uml 2.uml.resources_2.0.3.v200707131442.jar!/");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));
Resource resource = resourceSet.getResource(URI.createFileURI(fileName),
true);
profile = (Profile) EcoreUtil.getObjectByType(resource.getContents(),
UMLPackage.Literals.PROFILE);

When I inspect the loaded resource (and toString() it) I see the
following (AnyTypeImpl !?);

org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5a02ef (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@76b9ea (name: Profile)
(instanceClassName: null) etc...

The profile I try to load had been validated and applies to a model
succesfully. The first lines of the file are:

<?xml version="1.0" encoding="UTF-8"?>
<uml:Profile xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xmi:id="_PXi8QJK5EdybSc66Lg43Vg" name="SimpleDistribution"
metaclassReference="_8PuhYJK5EdybSc66Lg43Vg">
<eAnnotations xmi:id="_EKkUMJK-EdyRQJafRUw19Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
etc..


Any ideas on what I'm doing wrong?


Many thanks,
Bert.


Kenn Hussey wrote:
> Paul,
>
> No, this code isn't correct; what you need to do, assuming you're running
> stand-alone, is ensure the package, extension, and pathmaps are registered.
> This source for the profiles article
> ( http://download.eclipse.org/modeling/mdt/uml2/downloads/arti cles/uml2.articles_200607181325.zip)
> shows how to do this; alternatively, you could follow the advice in the FAQ
> at
> http://wiki.eclipse.org/index.php/MDT-UML2-FAQ#What.27s_requ ired_to_load_a_UML_.28.uml.29_resource_from_a_standalone_app lication.3F.
>
> Kenn
>
> "Paul Gribben" <paul.gribben@gmail.com> wrote in message
> news:eea9d951de0b1834b2f35a0fe56db4ea$1@www.eclipse.org...
>> Having looked through the source code for the UML2 plugin, I've managed to
>> solve this problem as follows (although I'm not convinced it's the correct
>> approach). The resourceSet object must be initialised in the following
>> manner:
>>
>> EPackage.Registry ePackageRegistry = new
>> EPackageRegistryImpl(EPackage.Registry.INSTANCE);
>> ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
>> UMLPackage.eINSTANCE);
>> ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
>> UMLPackage.eINSTANCE);
>>
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.setPackageRegistry(ePackageRegistry);
>>
>>
>>
>
>
Re: Unable to read profile or model file programatically [message #476727 is a reply to message #476704] Mon, 10 December 2007 16:32 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Bert,

Have a look at the code in the
following..http://www.eclipse.org/modeling/mdt/uml2/docs/gui des/UML2_2.0_Migration_Guide/guide.html
in the section entitled: 'Programmatic Migration'. That should provide all
the details.

If that still doesn't work, please ask again.

Cheers,

- James.

"Bert Vanhooff" <bert.vanhooff@cs.kuleuven.be> wrote in message
news:4756B88A.40208@cs.kuleuven.be...
> Hi,
>
> When I use the technique described in the wiki (see code below) the
> profile is always null.
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,UMLResource.Factory.I NSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI(" jar:file://Users/bertvh/Temp/eclipse/plugins/org.eclipse.uml 2.uml.resources_2.0.3.v200707131442.jar!/");
> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));
> Resource resource = resourceSet.getResource(URI.createFileURI(fileName),
> true);
> profile = (Profile) EcoreUtil.getObjectByType(resource.getContents(),
> UMLPackage.Literals.PROFILE);
>
> When I inspect the loaded resource (and toString() it) I see the following
> (AnyTypeImpl !?);
>
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5a02ef (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@76b9ea (name: Profile)
> (instanceClassName: null) etc...
>
> The profile I try to load had been validated and applies to a model
> succesfully. The first lines of the file are:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Profile xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_PXi8QJK5EdybSc66Lg43Vg" name="SimpleDistribution"
> metaclassReference="_8PuhYJK5EdybSc66Lg43Vg">
> <eAnnotations xmi:id="_EKkUMJK-EdyRQJafRUw19Q"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> etc..
>
>
> Any ideas on what I'm doing wrong?
>
>
> Many thanks,
> Bert.
>
>
> Kenn Hussey wrote:
>> Paul,
>>
>> No, this code isn't correct; what you need to do, assuming you're running
>> stand-alone, is ensure the package, extension, and pathmaps are
>> registered. This source for the profiles article
>> ( http://download.eclipse.org/modeling/mdt/uml2/downloads/arti cles/uml2.articles_200607181325.zip)
>> shows how to do this; alternatively, you could follow the advice in the
>> FAQ at
>> http://wiki.eclipse.org/index.php/MDT-UML2-FAQ#What.27s_requ ired_to_load_a_UML_.28.uml.29_resource_from_a_standalone_app lication.3F.
>>
>> Kenn
>>
>> "Paul Gribben" <paul.gribben@gmail.com> wrote in message
>> news:eea9d951de0b1834b2f35a0fe56db4ea$1@www.eclipse.org...
>>> Having looked through the source code for the UML2 plugin, I've managed
>>> to solve this problem as follows (although I'm not convinced it's the
>>> correct approach). The resourceSet object must be initialised in the
>>> following manner:
>>>
>>> EPackage.Registry ePackageRegistry = new
>>> EPackageRegistryImpl(EPackage.Registry.INSTANCE);
>>> ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
>>> UMLPackage.eINSTANCE);
>>> ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
>>> UMLPackage.eINSTANCE);
>>>
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.setPackageRegistry(ePackageRegistry);
>>>
>>>
>>>
>>
Re: Unable to read profile or model file programatically [message #594039 is a reply to message #471180] Thu, 01 March 2007 08:57 Go to previous message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Having looked through the source code for the UML2 plugin, I've managed to
solve this problem as follows (although I'm not convinced it's the correct
approach). The resourceSet object must be initialised in the following
manner:

EPackage.Registry ePackageRegistry = new
EPackageRegistryImpl(EPackage.Registry.INSTANCE);
ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
UMLPackage.eINSTANCE);
ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
UMLPackage.eINSTANCE);

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.setPackageRegistry(ePackageRegistry);
Re: Unable to read profile or model file programatically [message #594105 is a reply to message #471184] Fri, 02 March 2007 14:21 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Paul,

No, this code isn't correct; what you need to do, assuming you're running
stand-alone, is ensure the package, extension, and pathmaps are registered.
This source for the profiles article
( http://download.eclipse.org/modeling/mdt/uml2/downloads/arti cles/uml2.articles_200607181325.zip)
shows how to do this; alternatively, you could follow the advice in the FAQ
at
http://wiki.eclipse.org/index.php/MDT-UML2-FAQ#What.27s_requ ired_to_load_a_UML_.28.uml.29_resource_from_a_standalone_app lication.3F

Kenn

"Paul Gribben" <paul.gribben@gmail.com> wrote in message
news:eea9d951de0b1834b2f35a0fe56db4ea$1@www.eclipse.org...
> Having looked through the source code for the UML2 plugin, I've managed to
> solve this problem as follows (although I'm not convinced it's the correct
> approach). The resourceSet object must be initialised in the following
> manner:
>
> EPackage.Registry ePackageRegistry = new
> EPackageRegistryImpl(EPackage.Registry.INSTANCE);
> ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
> UMLPackage.eINSTANCE);
> ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
> UMLPackage.eINSTANCE);
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.setPackageRegistry(ePackageRegistry);
>
>
>
Re: Unable to read profile or model file programatically [message #598260 is a reply to message #471345] Mon, 05 March 2007 08:25 Go to previous message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Great. Thanks for that Kenn.
I wonder if it would be worth adding a convenient ResourceSet initializer
to the UML2 codebase to perform these registration steps?
Cheers
Paul
Re: Unable to read profile or model file programatically [message #598272 is a reply to message #471351] Tue, 06 March 2007 00:49 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Paul,

If you open an enhancement request, we'll consider it.

Kenn

"Paul Gribben" <paul.gribben@gmail.com> wrote in message
news:60e20b022e00dbee4a4f200f5591f15a$1@www.eclipse.org...
> Great. Thanks for that Kenn.
> I wonder if it would be worth adding a convenient ResourceSet initializer
> to the UML2 codebase to perform these registration steps?
> Cheers
> Paul
>
Re: Unable to read profile or model file programatically [message #625676 is a reply to message #471345] Wed, 05 December 2007 14:41 Go to previous message
Bert Vanhooff is currently offline Bert VanhooffFriend
Messages: 6
Registered: July 2009
Junior Member
Hi,

When I use the technique described in the wiki (see code below) the
profile is always null.

ResourceSet resourceSet = new ResourceSetImpl();
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,UMLResource.Factory.I NSTANCE);
Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
URI uri =
URI.createURI(" jar:file://Users/bertvh/Temp/eclipse/plugins/org.eclipse.uml 2.uml.resources_2.0.3.v200707131442.jar!/");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));
Resource resource = resourceSet.getResource(URI.createFileURI(fileName),
true);
profile = (Profile) EcoreUtil.getObjectByType(resource.getContents(),
UMLPackage.Literals.PROFILE);

When I inspect the loaded resource (and toString() it) I see the
following (AnyTypeImpl !?);

org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5a02ef (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@76b9ea (name: Profile)
(instanceClassName: null) etc...

The profile I try to load had been validated and applies to a model
succesfully. The first lines of the file are:

<?xml version="1.0" encoding="UTF-8"?>
<uml:Profile xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xmi:id="_PXi8QJK5EdybSc66Lg43Vg" name="SimpleDistribution"
metaclassReference="_8PuhYJK5EdybSc66Lg43Vg">
<eAnnotations xmi:id="_EKkUMJK-EdyRQJafRUw19Q"
source="http://www.eclipse.org/uml2/2.0.0/UML">
etc..


Any ideas on what I'm doing wrong?


Many thanks,
Bert.


Kenn Hussey wrote:
> Paul,
>
> No, this code isn't correct; what you need to do, assuming you're running
> stand-alone, is ensure the package, extension, and pathmaps are registered.
> This source for the profiles article
> ( http://download.eclipse.org/modeling/mdt/uml2/downloads/arti cles/uml2.articles_200607181325.zip)
> shows how to do this; alternatively, you could follow the advice in the FAQ
> at
> http://wiki.eclipse.org/index.php/MDT-UML2-FAQ#What.27s_requ ired_to_load_a_UML_.28.uml.29_resource_from_a_standalone_app lication.3F
>
> Kenn
>
> "Paul Gribben" <paul.gribben@gmail.com> wrote in message
> news:eea9d951de0b1834b2f35a0fe56db4ea$1@www.eclipse.org...
>> Having looked through the source code for the UML2 plugin, I've managed to
>> solve this problem as follows (although I'm not convinced it's the correct
>> approach). The resourceSet object must be initialised in the following
>> manner:
>>
>> EPackage.Registry ePackageRegistry = new
>> EPackageRegistryImpl(EPackage.Registry.INSTANCE);
>> ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
>> UMLPackage.eINSTANCE);
>> ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
>> UMLPackage.eINSTANCE);
>>
>> ResourceSet resourceSet = new ResourceSetImpl();
>> resourceSet.setPackageRegistry(ePackageRegistry);
>>
>>
>>
>
>
Re: Unable to read profile or model file programatically [message #625700 is a reply to message #476704] Mon, 10 December 2007 16:32 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Bert,

Have a look at the code in the
following..http://www.eclipse.org/modeling/mdt/uml2/docs/gui des/UML2_2.0_Migration_Guide/guide.html
in the section entitled: 'Programmatic Migration'. That should provide all
the details.

If that still doesn't work, please ask again.

Cheers,

- James.

"Bert Vanhooff" <bert.vanhooff@cs.kuleuven.be> wrote in message
news:4756B88A.40208@cs.kuleuven.be...
> Hi,
>
> When I use the technique described in the wiki (see code below) the
> profile is always null.
>
> ResourceSet resourceSet = new ResourceSetImpl();
> resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
> UMLPackage.eINSTANCE);
> resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION,UMLResource.Factory.I NSTANCE);
> Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();
> URI uri =
> URI.createURI(" jar:file://Users/bertvh/Temp/eclipse/plugins/org.eclipse.uml 2.uml.resources_2.0.3.v200707131442.jar!/");
> uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP),
> uri.appendSegment("libraries").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
> uri.appendSegment("metamodels").appendSegment(""));
> uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
> uri.appendSegment("profiles").appendSegment(""));
> Resource resource = resourceSet.getResource(URI.createFileURI(fileName),
> true);
> profile = (Profile) EcoreUtil.getObjectByType(resource.getContents(),
> UMLPackage.Literals.PROFILE);
>
> When I inspect the loaded resource (and toString() it) I see the following
> (AnyTypeImpl !?);
>
> org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5a02ef (eClass:
> org.eclipse.emf.ecore.impl.EClassImpl@76b9ea (name: Profile)
> (instanceClassName: null) etc...
>
> The profile I try to load had been validated and applies to a model
> succesfully. The first lines of the file are:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Profile xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_PXi8QJK5EdybSc66Lg43Vg" name="SimpleDistribution"
> metaclassReference="_8PuhYJK5EdybSc66Lg43Vg">
> <eAnnotations xmi:id="_EKkUMJK-EdyRQJafRUw19Q"
> source="http://www.eclipse.org/uml2/2.0.0/UML">
> etc..
>
>
> Any ideas on what I'm doing wrong?
>
>
> Many thanks,
> Bert.
>
>
> Kenn Hussey wrote:
>> Paul,
>>
>> No, this code isn't correct; what you need to do, assuming you're running
>> stand-alone, is ensure the package, extension, and pathmaps are
>> registered. This source for the profiles article
>> ( http://download.eclipse.org/modeling/mdt/uml2/downloads/arti cles/uml2.articles_200607181325.zip)
>> shows how to do this; alternatively, you could follow the advice in the
>> FAQ at
>> http://wiki.eclipse.org/index.php/MDT-UML2-FAQ#What.27s_requ ired_to_load_a_UML_.28.uml.29_resource_from_a_standalone_app lication.3F
>>
>> Kenn
>>
>> "Paul Gribben" <paul.gribben@gmail.com> wrote in message
>> news:eea9d951de0b1834b2f35a0fe56db4ea$1@www.eclipse.org...
>>> Having looked through the source code for the UML2 plugin, I've managed
>>> to solve this problem as follows (although I'm not convinced it's the
>>> correct approach). The resourceSet object must be initialised in the
>>> following manner:
>>>
>>> EPackage.Registry ePackageRegistry = new
>>> EPackageRegistryImpl(EPackage.Registry.INSTANCE);
>>> ePackageRegistry.put(UML22UMLResource.UML2_METAMODEL_NS_URI,
>>> UMLPackage.eINSTANCE);
>>> ePackageRegistry.put("platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore ",
>>> UMLPackage.eINSTANCE);
>>>
>>> ResourceSet resourceSet = new ResourceSetImpl();
>>> resourceSet.setPackageRegistry(ePackageRegistry);
>>>
>>>
>>>
>>
Previous Topic:Re: Ecore2UMLProfile
Next Topic:Making a UML profile available to users using ???
Goto Forum:
  


Current Time: Thu Apr 25 16:46:59 GMT 2024

Powered by FUDForum. Page generated in 0.03644 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top