Graham.
Please use the newsgroup for asking questions.
Graham Jenson wrote:
I have a problem where I want to set my own custom list to
a feature in a dynamic EObject instead of using the default DynamicList.
That sounds like a bad idea.
I have come up with a hack to do this. If you just use eSet is doesn't
change the list just addALL the elements to it (very weird?).
No, because it's very important that the list behave in a certain way,
and that behavior is very hard to implement.
//The Hack
//This will work unless the dynamic object has a static EClass with
features
DynamicEObjectImpl eobject= (DynamicEObjectImpl)super.create(EClass);
//This is needed to initialize the settings inside the
DynamicObject, otherwise you get a null pointer exception later
eobject.eSet(featureID, new BasicEList<EObject>());
//Here is actually sets the List to my CustomEList
eobject.dynamicSet(featureID, new CustomEList<EObject>())
I am just wondering if there is a better way of doing this.
It would be good to understand your goal. Likely an adapter would be
better.
I delved quite deep into the EMF Core, but found no
obvious solution.
This type of approach might help:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=216701
This is not a problem I want to get bogged down on, and
also one I do not want to leave behind, as it is in the core of my
project.
Perhaps taking a step back and explaining root of the problem would be
better. Please use the newsgroup for follow-up questions/background.
Thank you for any help or suggestions
Graham
_______________________________________________
emf-dev mailing list
emf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/emf-dev
|