Skip to main content



      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 06:12 Go to next message
Eclipse UserFriend
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 12:21 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Get loaded resource from element [message #1017658 is a reply to message #1016792] Tue, 12 March 2013 05:27 Go to previous message
Eclipse UserFriend
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: Thu Jul 24 18:15:41 EDT 2025

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

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

Back to the top