Reputation: 103
I have seen in Eclipse IDE while programming, when there is a compile error in a java file, Eclipse displays error icon on the tab. (Please refer image). Similarly, I have created my custom form editor and I want to display same error icon on the editor tab when there is a validation error.
Upvotes: 0
Views: 298
Reputation: 111217
You set the editor image by calling the WorkbenchPart
protected void setTitleImage(Image titleImage)
method. Your main editor part should be able to do this (editor parts extend EditorPart
which extends WorkbenchPart
).
It is up to you to determine when to display the error indicator and to construct the image.
JFace provides the DecorationOverlayIcon
class which helps to overlay error indicators on a base image. For example:
Image image = ... base image
ImageDescriptor overlay = ... image descriptor for overlay
DecorationOverlayIcon decoratedImageDesc = new DecorationOverlayIcon(image, overlay, IDecoration.BOTTOM_LEFT);
Image overlayedImage = decoratedImageDesc.createImage();
Upvotes: 1