Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to validate a Preference page?
How to validate a Preference page? [message #332976] Mon, 17 November 2008 17:16 Go to next message
Joel Rosi-Schwartz is currently offline Joel Rosi-SchwartzFriend
Messages: 624
Registered: July 2009
Location: London. England
Senior Member
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 messageGo to next message
Eclipse UserFriend
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
Re: How to validate a Preference page? [message #1801966 is a reply to message #333548] Wed, 30 January 2019 04:20 Go to previous message
Vaishali Agarwal is currently offline Vaishali AgarwalFriend
Messages: 1
Registered: January 2019
Junior Member
I have overrided propertyChange method in the preference page. But still the validation is not happening. Do i need to add any listener or we have to call propertyChange method.
Previous Topic:Code folding bar color?
Next Topic:Eclipse crashing on loading workspace
Goto Forum:
  


Current Time: Fri Apr 26 19:43:18 GMT 2024

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

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

Back to the top