Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[emf-dev] Setting a Dynamic Objects List

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.

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?).

//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. I delved quite deep into the EMF Core, but found no obvious solution.
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.

Thank you for any help or suggestions
Graham

Back to the top