Is there any way to refresh/update just a specific TreeColumn
in a TreeViewer
?
I currently have a feature in my TreeViewer
that cand hide/show a TreeColumn
. When a column is hidden, the values for that column can go out of sync with my Model. Thats why I need to refresh to Column when I enable it again and the operation of getting the value for cells of the column is very expensive.
I have a solution but I'm hoping that there is a better solution (maybe something out-of-the-box). I managed to define my LabelProvider
as an Inner Class in the class that contains the TreeViewer
(CustomTreeView extends ViewPart
). CustomTreeView
will have the method update(TreeColumn)
which will:
- store the
TreeColumn
in a private field of the inlineLabelProvider
class. - call
TreeViewer.refresh()
- set the
TreeColumn
field of the innerLabelProvider
to null.
The update(ViewerCell cell)
method of the LabelProvider
will check if the ViewerCell
belongs to the TreeColumn
stored in the LabelProvider
and refresh it if needed.
What do you think? Thanks in advance.