Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » leave preference page with invalid values
leave preference page with invalid values [message #313564] Mon, 19 March 2007 11:57 Go to next message
Eclipse UserFriend
Hi all

I've a preference page and I fill in some invalid value. Then I want to
switch to a second preference page with an implicit 'cancel' of the invalid
value.

Currently, I've to cancel the page explicitly with the button and then
reopen the preference dialog and start again navigating to the page I want
to change.

How is it possible to switch to a second page with implicit cancel?

Thanks,

Martin
Re: leave preference page with invalid values [message #313570 is a reply to message #313564] Mon, 19 March 2007 14:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: vb.prismtech.com

The PreferencePage class has a method called
public boolean okToLeave() {
return isValid();
}
which validates your page when you switch.
Overriding this might help. ie; If the values are invalid, you could clear
them out and return true.




"Martin Skorsky" <Martin.Skorsky@softwareag.com> wrote in message
news:etmbtn$qlh$1@utils.eclipse.org...
> Hi all
>
> I've a preference page and I fill in some invalid value. Then I want to
> switch to a second preference page with an implicit 'cancel' of the
> invalid value.
>
> Currently, I've to cancel the page explicitly with the button and then
> reopen the preference dialog and start again navigating to the page I want
> to change.
>
> How is it possible to switch to a second page with implicit cancel?
>
> Thanks,
>
> Martin
>
>
>
Re: leave preference page with invalid values [message #313614 is a reply to message #313570] Tue, 20 March 2007 12:56 Go to previous messageGo to next message
Eclipse UserFriend
My first guess: great, that's exactly what I want. Thanks!

second guess (after debugging and experimenting):
isValid() is called before okToLeave().
And if isValid() returns false, obToLeave() is not called.
Are these methods blocking each other?
AFAIK isValid should be set to false whenever invalid values are detected.
But then I don't have a chance to ignore the invalid values in okToLeave()
and cancel the input.

"Vikram" <vb@prismtech.com> wrote in message
news:etmlrd$s2i$1@utils.eclipse.org...
> The PreferencePage class has a method called
> public boolean okToLeave() {
> return isValid();
> }
> which validates your page when you switch.
> Overriding this might help. ie; If the values are invalid, you could clear
> them out and return true.
>
>
>
>
> "Martin Skorsky" <Martin.Skorsky@softwareag.com> wrote in message
> news:etmbtn$qlh$1@utils.eclipse.org...
>> Hi all
>>
>> I've a preference page and I fill in some invalid value. Then I want to
>> switch to a second preference page with an implicit 'cancel' of the
>> invalid value.
>>
>> Currently, I've to cancel the page explicitly with the button and then
>> reopen the preference dialog and start again navigating to the page I
>> want to change.
>>
>> How is it possible to switch to a second page with implicit cancel?
>>
>> Thanks,
>>
>> Martin
>>
>>
>>
>
>
Re: leave preference page with invalid values [message #313624 is a reply to message #313614] Tue, 20 March 2007 14:31 Go to previous message
Eclipse UserFriend
Originally posted by: vb.prismtech.com

I guess you are right. isValid() does get called before okToLeave();

What if you overrode the isValid() to validate , fix and always return true.
eg
Let's say you had a StringFieldEditor sc.
You would have something like this:

public boolean isValid() {
if( notValid (sc.getStringValue() )
sc.setStringValue(validValue);
return true;
}

I havent tested this and seems a bit crude :) . If you find something, do
post it.
Thanks

"Martin Skorsky" <Martin.Skorsky@softwareag.com> wrote in message
news:etp3o4$41o$1@utils.eclipse.org...
> My first guess: great, that's exactly what I want. Thanks!
>
> second guess (after debugging and experimenting):
> isValid() is called before okToLeave().
> And if isValid() returns false, obToLeave() is not called.
> Are these methods blocking each other?
> AFAIK isValid should be set to false whenever invalid values are detected.
> But then I don't have a chance to ignore the invalid values in okToLeave()
> and cancel the input.
>
> "Vikram" <vb@prismtech.com> wrote in message
> news:etmlrd$s2i$1@utils.eclipse.org...
>> The PreferencePage class has a method called
>> public boolean okToLeave() {
>> return isValid();
>> }
>> which validates your page when you switch.
>> Overriding this might help. ie; If the values are invalid, you could
>> clear them out and return true.
>>
>>
>>
>>
>> "Martin Skorsky" <Martin.Skorsky@softwareag.com> wrote in message
>> news:etmbtn$qlh$1@utils.eclipse.org...
>>> Hi all
>>>
>>> I've a preference page and I fill in some invalid value. Then I want to
>>> switch to a second preference page with an implicit 'cancel' of the
>>> invalid value.
>>>
>>> Currently, I've to cancel the page explicitly with the button and then
>>> reopen the preference dialog and start again navigating to the page I
>>> want to change.
>>>
>>> How is it possible to switch to a second page with implicit cancel?
>>>
>>> Thanks,
>>>
>>> Martin
>>>
>>>
>>>
>>
>>
>
>
Previous Topic:[Help Indexing] - Question about Help indxing and 'extradir'
Next Topic:Experimental APIs - CellLabelProvider, ViewerRow, ViewerCell
Goto Forum:
  


Current Time: Wed Apr 16 06:48:05 EDT 2025

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

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

Back to the top