Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » StringFieldEditor & conditional errorMessages(Problem with fieldEditor - page interaction.)
StringFieldEditor & conditional errorMessages [message #490147] Wed, 07 October 2009 14:23
Johan Van Noten is currently offline Johan Van NotenFriend
Messages: 28
Registered: July 2009
Junior Member
Suppose a preference page with simple content:
* B: a BooleanFieldEditor
* S: a StringFieldEditor
* Page validation constraint: If B is checked, S should not be empty.

Usual solution:
The page overrides its checkState() and does the required validation.
Make sure that checkState() is called in the propertyChange().

Problem scenario:
* Put a value in S
* Check B
* Make S empty
--> ErrorMessage appears as expected
* Enter and leave S
--> ErrorMessage gets cleared while state is still invalid.

Debugging shows:
S doesn't fire a propertyChange just for focus changes,
but it does refresh its validity at such focus change.
In this particular case, it discovers that it is not invalid,
since it has no validity constraints set.
That's why it calls clearErrorMessage(), erasing the form's error message.
The fact that the form remains invalid is not taken into consideration.

Question:
There are several work-arounds, but none gives me a good feeling.
Is there a common practice for this kind of problem?
Potentially I'm missing something in the normal PreferencePage behaviour...

Thanks,
Johan
Previous Topic:Need to change font size in ContentAssistant.
Next Topic:Editor with JFace Text
Goto Forum:
  


Current Time: Fri Dec 19 16:36:47 GMT 2014

Powered by FUDForum. Page generated in 0.05916 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software