[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] IWrapperItemProvider & databinding

Hi,

I'm having trouble with my databinding code when using EObject wrappers. Briefly, I am binding a custom composite with different widgits for relevant EStrucuturalFeatures of a selected EObject instance (selection coming from TreeViewer). One of the EObject types in the TreeViewer is wrapped in a DelegatingWrapperItemProvider instance. This is because an instance of that object will be referenced from two other non-containment EReferences of two parent objects. The DelegatingWrapperItemProvider getColumnText() method is overridden to return a different value depending on which EReference returned the instance from a parent object. (E.g. a single "FloorCeiling" EObject should be labeled "Floor XXX" or "Ceiling XXX" depending on whether the the reference was returned from a "floors" or "ceilings" EReference in the parent object).

The trouble I am having is with my IObservableValue that is tracking the selection. If I adjust that to look for and unwrap IWrappingItemProviders, the databinding code works ok, but the selection is lost as a result of the wrapped value being included in a Command's affectedObjects list, rather than the wrapper. If I do not adjust the IObservableValue, the databinding code doesn't seem to work, resulting in empty widgits.

How can I ensure that the correct object gets added to the Command's affectedObjects list so that selections are correct when values change, or undo or redo are used?

Thanks,

Stephen