Skip to main content



      Home
Home » Eclipse Projects » JFace » EMF Adding to a collection with reflective API.
EMF Adding to a collection with reflective API. [message #756172] Fri, 11 November 2011 06:13
Eclipse UserFriend
Hi,

Is there a way to add objects to a many EReference without using copy?
When doing this, my objects are not added to the containment.


EList<EObject> manyReferenceCollection = (EList<EObject>)
target.eGet(eReference);

manyReferenceCollection.add(objectToSet);

target.eSet(eReference, manyReferenceCollection);


When creating a copy first , it works but my objects are copies, not the
original objects.

EList<EObject> manyReferenceCollection = (EList<EObject>)
target.eGet(eReference);


Collection<EObject> copyAll =
EcoreUtil.copyAll(manyReferenceCollection);

copyAll.add(objectToSet);

target.eSet(eReference, copyAll);


I need the orginal objects to be set back into the reference, as
elsewhere I keep an index of these objects. The index breaks if a copy
of the original list is stored back in the reference.

Thank You
Christophe
Previous Topic:ComboViewer dropdown list not updated with new data
Next Topic:How to have Tree View inside a Table
Goto Forum:
  


Current Time: Wed Jul 02 18:31:15 EDT 2025

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

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

Back to the top