I want to use Label Decorator for my eclipse (e4) application.
ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator("MyPlug-In-Id");
TableDecoratingLabelProvider lp = new TableDecoratingLabelProvider(new LabelProvider(), decorator);
structuredViewer.setLabelProvider(new DecoratingLabelProvider(lp, decorator));
Unfortunately, PlatformUI.getWorkbench()
throws an IllegalStateException: Workbench has not been created yet.
on e4. As I understand, this is intended as this method is only valid in e3. But then, how to display item decorations in e4?
Any help is really appreciated, thank you in advance!
You can't do this in an e4 application. The 3.x workbench is not available in an e4 application and the org.eclipse.ui.decorators
label decorator extension point is not supported.
You can JFace decorator classes such as DecoratingLabelProvider
and DecoratingStyledCellLabelProvider
but you will have to rework the decorators to use ILabelDecorator
.