Search code examples
javaformseclipse-rcp

Eclipse Form Head disappears


I have a strange problem: There is a form with sections inside. There are also some widgets which values I validate against some rules and if the rule is not fulfilled I show an error in the Form Head, using MessageManager#addMessage, which I get from ManagedForm. When error is added, the Form Head looks like this:

form head with an error message

When I make my widget pass validation and thus remove error message, using MessageManager#removeMessage for some reason (in only some case) not only the error but the whole Form Head disappears:

no head

After that, no matter what I do it does not appear again, so if I add message again, using MessageManager only control decoration is shown and not the error.

I've debugged it and found out that at some point my getForm().getHead().getBounds().height returns 0.

Have somebody faced something similar or have any clue, what it might be? Any help would be greatly appreciated.

I am using org.eclipse.ui.forms_3.5.2.r36_v20100702.jar


Solution

  • I have found out how to fix this: when the last error is removed by MessageManager Form Header gets removed (or hidden). I am not sure why, but it's how it works. So, to always have Header just add some empty message during form initialization. Something like that:

    managedForm.getMessageManager().addMessage(
                  "empty_message_key",
                  "",
                  null,
                  IMessageProvider.NONE);