Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1
Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1 [message #478105] Tue, 06 January 2009 08:30 Go to next message
Kishore Kushwaha is currently offline Kishore KushwahaFriend
Messages: 36
Registered: July 2009
Location: Lucknow, India
Member

I have just started working on an UML project after studying the article
"Getting Started with UML2" from the following URL:

http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html

I have followed all steps given in this article, and its working except
these lines:

------------------------------------------------------------ ----------------
URI uri =
URI.createURI("file:///C:").appendSegment("Try-ExtendedPO2-Activity").appendFileExtension(UMLResource.FILE_EXTENSION);

save(model, uri);
------------------------------------------------------------ ----------------

protected static void save(org.eclipse.uml2.uml.Package package_, URI uri)
{
Resource resource = new ResourceSetImpl().createResource(uri);
resource.getContents().add(package_);
----------------
----------------
----------------
}
------------------------------------------------------------ ----------------


But the line "new ResourceSetImpl().createResource(uri);"
always returns a null object, even if the uri object is proper.

I am unable to understand the problem b'coz I have installed all required
plugins as given in article. (Also ResourceSetImpl class is also present
into workspace of eclipse 3.4.1)

Please tell me the cause of my problem.

Thanks in advance.
Kishore


Regards,
Kishore
Re: Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1 [message #478106 is a reply to message #478105] Tue, 06 January 2009 09:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Kishore,

Keep in mind that if you aren't running as an Eclipse application, which
I suppose the getting started guide assumes you are, then plugin.xml
registration of resource factories won't happen (nor any other
plugin.xml registrations). I don't really see where the required setup
for stand alone execution is documented...


kishore wrote:
> I have just started working on an UML project after studying the
> article "Getting Started with UML2" from the following URL:
>
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
>
>
> I have followed all steps given in this article, and its working
> except these lines:
>
> ------------------------------------------------------------ ----------------
>
> URI uri =
> URI.createURI("file:///C:").appendSegment("Try-ExtendedPO2-Activity").appendFileExtension(UMLResource.FILE_EXTENSION);
>
>
> save(model, uri);
> ------------------------------------------------------------ ----------------
>
>
> protected static void save(org.eclipse.uml2.uml.Package package_, URI
> uri)
> {
> Resource resource = new ResourceSetImpl().createResource(uri);
> resource.getContents().add(package_);
> ----------------
> ----------------
> ----------------
> }
> ------------------------------------------------------------ ----------------
>
>
>
> But the line "new ResourceSetImpl().createResource(uri);"
> always returns a null object, even if the uri object is proper.
>
> I am unable to understand the problem b'coz I have installed all
> required plugins as given in article. (Also ResourceSetImpl class is
> also present into workspace of eclipse 3.4.1)
>
> Please tell me the cause of my problem.
>
> Thanks in advance.
> Kishore


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1 [message #478107 is a reply to message #478106] Tue, 06 January 2009 10:14 Go to previous messageGo to next message
Kishore Kushwaha is currently offline Kishore KushwahaFriend
Messages: 36
Registered: July 2009
Location: Lucknow, India
Member

Thanks Ed Merks.

Yes I was running it as a Eclipse Application. After your reply, I
understand my silly mistake. Now its working fine.

Thanks again.

Regards
Kishore


Regards,
Kishore
Re: Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1 [message #627313 is a reply to message #478105] Tue, 06 January 2009 09:26 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Kishore,

Keep in mind that if you aren't running as an Eclipse application, which
I suppose the getting started guide assumes you are, then plugin.xml
registration of resource factories won't happen (nor any other
plugin.xml registrations). I don't really see where the required setup
for stand alone execution is documented...


kishore wrote:
> I have just started working on an UML project after studying the
> article "Getting Started with UML2" from the following URL:
>
> http://www.eclipse.org/modeling/mdt/uml2/docs/articles/Getti ng_Started_with_UML2/article.html
>
>
> I have followed all steps given in this article, and its working
> except these lines:
>
> ------------------------------------------------------------ ----------------
>
> URI uri =
> URI.createURI("file:///C:").appendSegment("Try-ExtendedPO2-Activity").appendFileExtension(UMLResource.FILE_EXTENSION);
>
>
> save(model, uri);
> ------------------------------------------------------------ ----------------
>
>
> protected static void save(org.eclipse.uml2.uml.Package package_, URI
> uri)
> {
> Resource resource = new ResourceSetImpl().createResource(uri);
> resource.getContents().add(package_);
> ----------------
> ----------------
> ----------------
> }
> ------------------------------------------------------------ ----------------
>
>
>
> But the line "new ResourceSetImpl().createResource(uri);"
> always returns a null object, even if the uri object is proper.
>
> I am unable to understand the problem b'coz I have installed all
> required plugins as given in article. (Also ResourceSetImpl class is
> also present into workspace of eclipse 3.4.1)
>
> Please tell me the cause of my problem.
>
> Thanks in advance.
> Kishore


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1 [message #627314 is a reply to message #478106] Tue, 06 January 2009 10:14 Go to previous messageGo to next message
Kishore Kushwaha is currently offline Kishore KushwahaFriend
Messages: 36
Registered: July 2009
Location: Lucknow, India
Member

Thanks Ed Merks.

Yes I was running it as a Eclipse Application. After your reply, I
understand my silly mistake. Now its working fine.

Thanks again.

Regards
Kishore


Regards,
Kishore
Re: Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1 [message #643060 is a reply to message #478105] Fri, 03 December 2010 19:21 Go to previous message
yirco  is currently offline yirco Friend
Messages: 14
Registered: October 2010
Junior Member

Try this:

		Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
		Map<String, Object> m = reg.getExtensionToFactoryMap();
		m.put(UMLResource.FILE_EXTENSION, new XMIResourceFactoryImpl());

		Resource resource = new ResourceSetImpl().createResource(uri);

Previous Topic:load correctly an UML profile
Next Topic:Problem in set property value
Goto Forum:
  


Current Time: Tue Apr 16 09:25:14 GMT 2024

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

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

Back to the top