EMF Adding to a collection with reflective API. [message #756172] |
Fri, 11 November 2011 06:13 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.13689 seconds