In my Eclipse RCP View, I use JFace databinding to bind model data to a org.eclipse.jface.viewers.TreeViewer
. I use ViewerSupport.bind()
to bind the data as shown in the snippets, and it works just fine.
ViewerSupport.bind(viewer, model, BeanProperties.list("children",
ModelObject.class), BeanProperties.value(ModelObject.class, "name"));
Now I'd really like to display an image along with the text on the nodes. Without databinding, I'd just override a LabelProvider
's getImage(Object element)
method, but the content + label provider method and the use of ViewerSupport
don't work together. I haven't found a solution to my problem in the ViewerSupport
API. Is there a solution, perhaps using org.eclipse.core.databinding.property.value.IValueProperty
s?
ViewerSupport
usesObservableMapLabelProvider
as the label provider. Unfortunately thegetImage
method for this just returnsnull
.You could perhaps uses a sub-class of
ObservableMapLabelProvider
to provide the images. You can't useViewerSupport
to do that so you would have to duplicate some of the code.This is how
ViewerSupport.bind
sets up the tree: