Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Iteration of non-containment references
Iteration of non-containment references [message #425290] Fri, 21 November 2008 19:15 Go to next message
Jason Henriksen is currently offline Jason HenriksenFriend
Messages: 231
Registered: July 2009
Senior Member
Hi All,

I've got a model something like this

Lens:
IDREF -> LensMaterial
IDREF -> LenOption

LensMaterial:
IDREF -> LensColor


I've got a few thousand Lenses that I'm putting into an XML document. I
only want to include the LenColor, LensMaterial and LensOption objects
that are used by the selected list of Lens objects. I thought I could
use EcoreUtil.getAllContents() to find a list of all the objects
associated with a given Lens, but it seems that using a non-containment
reference is preventing that from working.

Is there any other method that will give me an Iterator of the objects
associated to the Lens?

Thanks for any suggestions,

Jason Henriksen
Re: Iteration of non-containment references [message #425294 is a reply to message #425290] Fri, 21 November 2008 23:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30907
Registered: July 2009
Senior Member
Jason,

Is LensColor the eOpposite of LensMaterial? Note that calling
eCrossReferences visits the non-containment references of the given EObject.


jason henriksen wrote:
> Hi All,
>
> I've got a model something like this
>
> Lens:
> IDREF -> LensMaterial
> IDREF -> LenOption
>
> LensMaterial:
> IDREF -> LensColor
>
>
> I've got a few thousand Lenses that I'm putting into an XML document.
> I only want to include the LenColor, LensMaterial and LensOption
> objects that are used by the selected list of Lens objects. I thought
> I could use EcoreUtil.getAllContents() to find a list of all the
> objects associated with a given Lens, but it seems that using a
> non-containment reference is preventing that from working.
>
> Is there any other method that will give me an Iterator of the objects
> associated to the Lens?
>
> Thanks for any suggestions,
>
> Jason Henriksen
Previous Topic:Controlling XML serialization
Next Topic:Problems caused by the call to the factory as part of the collectNewChildDescriptors in the Edit Plu
Goto Forum:
  


Current Time: Wed Feb 26 07:38:42 GMT 2020

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

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

Back to the top