StringFieldEditor & conditional errorMessages [message #490147] |
Wed, 07 October 2009 10:23 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.06194 seconds