How to validate a Preference page? [message #332976] |
Mon, 17 November 2008 17:16 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Hi,
I am trying to validate a Preference page (FieldEditorPreferencePage) that
contains a FileFieldEditor. I have not been able to work out where to
perform the validation after the value has been changed.
I have tried overriding FileFieldEditor.checkState() to no avail. It does
not seem to be called after an update.
I have also tried overriding StringFieldEditor.doCheckState() and again it
does not seem to be called during a field change.
As I final resort I have tried to extend FileFieldEditor and to override
doCheckState() there. Yet another disappointment.
I am out of bright ideas for the moment, so I figured I would shout out for
help. Any ideas?
Many thanks,
Joel
--
Joel Rosi-Schwartz
Etish Limited [http://www.etish.org]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^...^
/ o,o \ The proud parents of Useme & ORMF
|) ::: (| Open Requirements Management Framework
====w=w==== [http://www.eclipse.org/ormf/]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
Re: How to validate a Preference page? [message #333548 is a reply to message #332976] |
Wed, 17 December 2008 06:21 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: automatic.javalobby.org
Hi,
Override the method "propertyChange" in the preference page as shown below:
public void propertyChange(PropertyChangeEvent event) {
if(event.getProperty().equals("field_editor_value")){
//field for which validation is required
if(event.getSource()==fieldName){
//validation is successful
if(doValidation(...)){
setValid(true);
setErrorMessage(null); super.performApply();
super.propertyChange(event);
}
//validation fails
else{
setValid(false);
setErrorMessage("Error message");
}
}
}
}
~Prasanna
|
|
|
|
Powered by
FUDForum. Page generated in 0.02791 seconds