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:Problems during startup. Check the ".log" file in the ".metadata" directory of y
Next Topic:Plug-in cache issues in RCP
Goto Forum:
  


Current Time: Thu Jul 16 16:38:47 GMT 2020

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

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

Back to the top