I want to change the color of my messages which are added via the IMessageManager
implementation in a Eclipse RCP environment. I've tried to set the color in the corresponding control but this has no effect.
e.g.
Device device = Display.getCurrent();
Color red = new Color(device, 255, 0, 0);
control.setForeground(red);
messageManager.addMessage(MESSAGE_KEY, message, null, IMessageProvider.INFORMATION, control);
How can I achieve this, is there an existing interface which provides this functionality?
Thanks in advance
The control you pass to addMessage
is not the control that is used to display the message. The message is always shown in the FormHeading
part of the Form
.
You can set the heading foreground color using
form.getHead().setForeground(color);
where form
is your Form
.
Don't forget that you must dispose of any Color
objects that you create when they are no longer needed.