izhar
izhar

Reputation: 91

How to apply decorators to the label provider in RCP eclipse environment?

I wanted to apply decorators (that is images) to my custom label provider which is of tree viewer form displaying the list of some folder names. I googled it out but unfortunately only i got the information of how to create decorators.

For example : i have a label provider by name "ViewLabelProvider" which is able to display list of folders. I want to differentiate these folders by applying some icons through decorators, but I am not able to establish a relationship between the custom decorators to the above label provider mentioned.

Please let me know, how to achieve this.

Thanks in advance...

Upvotes: 0

Views: 992

Answers (1)

greg-449
greg-449

Reputation: 111142

The tree label provider needs to be DecoratingLabelProvider to pick up the decorators:

treeViewer.setLabelProvider(
      new DecoratingLabelProvider(your label provider,
                PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));

you pass your label provider as a parameter to DecoratingLabelProvider.

Upvotes: 2

Related Questions