Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » eContainer in other resource(eContainer in other resource)
eContainer in other resource [message #1708161] Mon, 14 September 2015 10:07 Go to next message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi all,

I have a model A.xmi that contains a model B.xmi throught a containment reference that is a proxy. Both resources (A.xmi and B.xmi) are load and inside a ResourceSet. The thing is that I want to obtain the eContainer from an EObject y (the first element of B.xmi), but the y.eContainer is null and taking into account the definition of eContainer would be right thing. I've tried some things but without result, so I would like to know, how to obtain the eContainer in this case?

Thanks for any help.

Cheers,
Anthony
Re: eContainer in other resource [message #1708225 is a reply to message #1708161] Mon, 14 September 2015 18:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Anthony,

If you want the container reference to be serialized (the only way it
will be not null until the containment reference to it is resolved), you
have to define an actual feature for it (an opposite for the containment
reference) and make it non-transient.


On 14/09/2015 12:07 PM, Anthony Garmendia wrote:
> Hi all,
>
> I have a model A.xmi that contains a model B.xmi throught a
> containment reference that is a proxy. Both resources (A.xmi and
> B.xmi) are load and inside a ResourceSet. The thing is that I want to
> obtain the eContainer from an EObject y (the first element of B.xmi),
> but the y.eContainer is null and taking into account the definition of
> eContainer would be right thing. I've tried some things but without
> result, so I would like to know, how to obtain the eContainer in this
> case?
> Thanks for any help.
>
> Cheers,
> Anthony


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: eContainer in other resource [message #1708242 is a reply to message #1708225] Mon, 14 September 2015 21:48 Go to previous messageGo to next message
Antonio Garmendia is currently offline Antonio GarmendiaFriend
Messages: 93
Registered: May 2014
Member
Hi Ed,

Thank you very much for the reply. The thing is that I don't want to force that the Ecore Metamodel need to define an opposite for the containment
reference. I would like to get the eContainer when the opposite is not defined.
There is any way to get the eContainer without define this opposite containment reference?

Cheers,
Anthony
Re: eContainer in other resource [message #1708274 is a reply to message #1708242] Tue, 15 September 2015 07:14 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Anthony,

Unless there is a serialized reference to the container, the object
being contained has no knowledge of its container until the container
resolves the proxy to the child. On a modeled container reference can
be serialized...

On 14/09/2015 11:48 PM, Anthony Garmendia wrote:
> Hi Ed,
>
> Thank you very much for the reply. The thing is that I don't want to
> force that the Ecore Metamodel need to define an opposite for the
> containment reference. I would like to get the eContainer when the
> opposite is not defined.
> There is any way to get the eContainer without define this opposite
> containment reference?
> Cheers,
> Anthony


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:best practice displaying EMF-elements in tables
Next Topic:How to add ChildDescriptors for EObjects which are in a different Plugins
Goto Forum:
  


Current Time: Thu Apr 25 12:50:33 GMT 2024

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

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

Back to the top