Project: Eclipse_Platform_UI
Bug 357906 [Forms] The message's foreground color is never cleared
Reported: 2011-09-16 02:59:20 | Status: resolved fixed

If I add an error message to a form, the foreground color of the message region in the form heading is set to red (org.eclipse.ui.internal.forms.widgets.FormHeading#showMessage(String, int IMessage[] calls "updateForeground" since the new type differs from the old type (IMessageProvider.Error instead of IMessageProvider.NONE)). However, if I now clear all messages (Form.getMessageManager().removeAllMessages(), but it really happens whenever we remove the _last_ message), then we enter this condition of FormHeading.MessageRegion#showMessage() : if (newMessage == null) { // clearing of the message if (oldControl != null && oldControl.getVisible()) oldControl.setVisible(false); return; } as you can see, "messageType" here has been updated to a new type (IMessageProvider.NONE instead of IMessageProvider.ERROR)... but "updateForeground" never gets called. If we now add a new message to the form, whatever its type, its color will be red (ERROR). The "if" should be changed to if (newMessage == null) { // clearing of the message if (oldControl != null && oldControl.getVisible()) oldControl.setVisible(false); if (oldType != newType) updateForeground(); return; }

Files changed in fix:
bundles/org.eclipse.ui.forms/src/org/eclipse/ui/internal/forms/widgets/FormHeading.java