views:

202

answers:

3

Hello, I have been wondering about the parameter 'properties' in the method TreeViewer#update(Object element, String[] properties). What are they? What do they refer to? I am not sure what goes into the String[] - are there predefined constants to use? Or are these the names of my column headers? Something else?

I couldn't find any example of the usage of update() that doesn't have null passed on to it as the value for 'properties'. So what do they refer to? The JavaDoc isn't really helpful to me.

Thanks!

+1  A: 

This eclipse.org article explains in chapter 'Responding to change' what those properties are used for: You can fine tune if you want a complete update of the treeitem's label or just the label's text or the label's image. It does not go into detail on how the properties should look like. Her, I think, you have to study the source code directly, if javadocs are not sufficient.

Andreas_D
A: 

They are conveniences for the viewer's label provider to let it know what properties of the model changed. If the property that changed doesn't affect the display of the item in the view, then the provider can elect to not do anything by implementing the isLabelProperty() method to only return true when an interesting property changes.

If there are no logical properties on the item that changed to trigger the update call, then just pass null or an empty array.

Matthew Phillips
A: 

TreeViewer is a "enhanced" version of the SWT class Tree. So I guess, the property here should refer to the property stored in the TreeItem (which can be set by calling setData(String, Object).

Cheng Ye