Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsCustomize refresh of the editor based on EMF.Edit
https://www.eclipse.org/forums/index.php/mv/msg/1083469/1750914/#msg_1750914
For one of my ItemProvider I override getChildren() so that it returns actual children along with "fake" children (which are EObject of the same type as real children, but are not contained in the resource). Now I want to customize my editor. I see in the tree actual children along with fake children, and that's exactly what I want.
The problem is with executing Add/Remove Commands. When I execute remove command, I want that removed item is still displayed in the tree, but as fake item. (Currently this item disappears on RemoveCommand). And for add command when it's executing for the fake item, I want it to be added to the container and displaying like actual child (no extra node should be inserted in the tree). How I can achieve this?]]>Carsten Tsara2017-01-01T16:13:38-00:00Re: Customize refresh of the editor based on EMF.Edit
https://www.eclipse.org/forums/index.php/mv/msg/1083469/1750924/#msg_1750924
The framework does support showing children of a non-containment reference, but there is quite a bit of logic associated with that. For example, org.eclipse.emf.edit.provider.ItemProviderAdapter.isWrappingNeeded(Object) will return true and then org.eclipse.emf.edit.provider.ItemProviderAdapter.createWrapper(EObject, EStructuralFeature, Object, int) will return wrappers. In this case, org.eclipse.emf.edit.provider.ItemProviderAdapter.getChildren(Object) manages a ChildStore that's updated when processed by org.eclipse.emf.edit.provider.ItemProviderAdapter.updateChildren(Notification) when processing a notification when the the referenced "children" are modified. But none of that can be directly reused because you don't have a derived non-containment reference for managing the fake children. ]]>Ed Merks2017-01-02T08:28:02-00:00Re: Customize refresh of the editor based on EMF.Edit
https://www.eclipse.org/forums/index.php/mv/msg/1083469/1750929/#msg_1750929
Currently I managed to do what I want. On delete I create remove command like this new RemoveCommand(domain, container, child) and on add new AddCommand(domain, container, fakeChild)
My fake children haven't an eContainer or an eResource. On add I just put them to the container (and resource).
As I understand, in both cases I get content refresh notification on the container, getChildren() is called and I see my tree updated. Please correct me if I'm wrong, as I'm novice in EMF.]]>Carsten Tsara2017-01-02T11:00:24-00:00Re: Customize refresh of the editor based on EMF.Edit
https://www.eclipse.org/forums/index.php/mv/msg/1083469/1751049/#msg_1751049
I added drag and drop support. To make it work I've override ItemProviderAdapter.getChildFeature(Object, Object) so that it returns the appropriate feature. So drag and drop works fine, but the editor doesn't refresh after drop operation. UPD: I fixed this problem by also overriding notifyChanged()]]>Carsten Tsara2017-01-03T21:43:15-00:00