1

This is a followup to Items decorations in a TreeViewer: I have a TreeView with my own Objects. I already have a LabelProvider that supplies Icons and Texts. Now I want to decorate the images with other images depending on some conditions. How can I do this? The referenced question uses ComposedImage, which I suppose is org.eclipse.emf.edit.provider.

Is there a way to do this with SWT/JFace in Eclipse 4.3?

I already tried using a ILightweightLabelDecorator (using the idea from the FAQ), but gave up wrapping that round my LabelProvider.

Community
  • 1
  • 1
Martin Schröder
  • 4,176
  • 7
  • 47
  • 81

2 Answers2

1

ILightweightLabelDecorator is really the best way to do this. Wrap your label provider with a DecoratingLabelProvider as described in this answer: Using a ILightweightLabelDecorator decorator Use the org.eclipse.ui.decorators extension point to declare your lightweight decorator.

Community
  • 1
  • 1
greg-449
  • 109,219
  • 232
  • 102
  • 145
  • So although `PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())` returns an `ILabelDecorator` I can use an `ILightweightLabelDecorator` in the extension point? – Martin Schröder Sep 16 '13 at 13:39
  • Yes the decorator manager returns a label decorator which manages the lightweight decorators (you can have several if you wish). – greg-449 Sep 16 '13 at 13:40
1

you may want to look at org.eclipse.jface.viewers.DecorationOverlayIcon which is basically used by decoration providers.

sambi reddy
  • 3,065
  • 1
  • 13
  • 10