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

Stephen Egan schrieb:
> 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.

Could you provide some (pseudo) code so that I understand this better? I
guess you are using the IObservableValue as the master for detail
bindings. You could mimic this using an ISelectionChangeListener and a
WritableValue.

One final question is why you are not using the JFace-Support for
setting up your TreeViewer instead [1] which probably makes wrapping
your EObject's unnecessary (Please note I have no idea how the EMF
generated stuff work because I've never used it so my assumption might
be wrong)

Tom


[1]http://tomsondev.bestsolution.at/2009/06/08/galileo-emf-databinding-%E2%80%93-part-3/