Decorating icons with status indicators

I tend to use IStatus whenever I can to indicate the status of some object. This have two severity states which are worth extra attention; ERROR and WARNING. Usually this object also have a graphical presentation, an icon. So would it not be nice to decorate this icon with an overlay image representing the severity of the status?

JFace‘s DecorationOverlayIcon comes to help. I usually use it like this:

Since images are system resources we must take care to release these when we no longer need them. So I’m using the image registry of the base image to store the decorated image. This will make the process a little bit faster when the same decorated image is needed again and it will also make sure that the resources are released when then system shuts down.


  1. May be simpler:

    DecorationOverlayIcon decoratedImage = new DecorationOverlayIcon(baseImage, overlay, Decoration.BOTTOM_RIGHT);

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.