Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Get loaded resource from element(How do I programmatically get loaded resource from element)
Get loaded resource from element [message #1016688] Thu, 07 March 2013 11:12 Go to next message
Johan Norberg is currently offline Johan NorbergFriend
Messages: 5
Registered: April 2012
Location: Sweden
Junior Member
Hi,

If you load resource unto an element, is it then possible to get that information programmatically?
I currently have a model element that I've used "Load resource" on, and when I've loaded the model element in the code, I would like to get that information as well.

I hope this is clear enough, but if any more information is needed, I'll gladly provide that.

Thanks in advance,
Johan
Re: Get loaded resource from element [message #1016792 is a reply to message #1016688] Thu, 07 March 2013 17:21 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hello Johan,

The resources are loaded in the ModelSet (i.e. the EMF Resource Set). All resources are available in ModelSet.getResources()

There are many ways to retrieve the ModelSet/ResourceSet in Papyrus. The easiest one is: element.eResource().getResourceSet() (Provided that "element" is an EObject, which is the case for a UML Element for example)


Regards,
Camille


Camille Letavernier
Re: Get loaded resource from element [message #1017658 is a reply to message #1016792] Tue, 12 March 2013 09:27 Go to previous message
Johan Norberg is currently offline Johan NorbergFriend
Messages: 5
Registered: April 2012
Location: Sweden
Junior Member
Hi Camille,

Thanks for the help! But for some reason i can't seem to find the necessary information in the ResourceSet object...
I've tried to use getAllContents() as well as getResources() and traverse them and use GetURI() on the resources, without any luck so far.

So I'm wondering if you or someone else could help me in the correct direction.

Another thing I just though about, when I'm loading the resource unto the element, I'm not able to save the papyrus project afterwards without doing some other change as well, so could this have something to do with it, if it's not getting loaded correctly unto the element or if I'm doing something wrong.

Regards,
Johan
Previous Topic:How to create a classDiagram which which defines an Instance Specification?
Next Topic:Reverse Eng C Ansi Code with Papyrus
Goto Forum:
  


Current Time: Fri Apr 19 06:37:16 GMT 2024

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

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

Back to the top