Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » performOK() return cancel, disables ok button?
performOK() return cancel, disables ok button? [message #463315] Thu, 03 November 2005 11:13 Go to next message
Eclipse User
Originally posted by: chris.alex.thomas.gmail.com

Hi,

I want to perform a dependent action based on returning false from
performOk preference page in eclipse, yet when I do this, the ok button
gets disabled and I don't know how to turn it back on again, this is
what I'm trying to perform

If the users clicks ok without testing the settings, I want to pop-up
saying you haven't tested the settings, do you want to test now, if
those settings are tested and successful, ok, close the dialog,
otherwise, ask the user to change them, if no is answered on both
occasions, the dialog just accepts the users decision and closes, but
otherwise giving them a choice to go back and correct mistakes.

so basically, I need to return cancel, if the user has decided to go
back and change those settings, cause otherwise the dialog will close.

if the user really just doesnt care, then fine, I'll close the dialog
and complain later when it fails.

anyone help? thanks
Re: performOK() return cancel, disables ok button? [message #463338 is a reply to message #463315] Thu, 03 November 2005 19:00 Go to previous messageGo to next message
Eclipse User
Originally posted by: sunil_kamath.nohotspammail.com

Christopher Thomas <chris.alex.thomas@gmail.com> wrote:
> Hi,
>
> I want to perform a dependent action based on returning false from
> performOk preference page in eclipse, yet when I do this, the ok
> button gets disabled and I don't know how to turn it back on again,
> this is what I'm trying to perform
>
IMHO it is a bug.
By examining the code, I determined that this is what happens:
a) User clicks OK button.
b) The OK button is disabled by PreferencesDialog so that it cannot be
clicked again while performOK is being run.
c) The performOK returns false.
d) PreferencesDialog returns control to user, but forgets to re-enable OK
button.

The only programmatic workaround I found is to enable it in performOK before
returning false.
Alternately, you can use the setValid() method to prevent the user from
clicking OK until all values on the page are acceptable.
I found that this is a better solution.

--
Sunil
Re: performOK() return cancel, disables ok button? [message #463340 is a reply to message #463338] Thu, 03 November 2005 19:20 Go to previous messageGo to next message
Eclipse User
Originally posted by: chris.alex.thomas.gmail.com

Sunil Kamath wrote:
> Christopher Thomas <chris.alex.thomas@gmail.com> wrote:
>> Hi,
>>
>> I want to perform a dependent action based on returning false from
>> performOk preference page in eclipse, yet when I do this, the ok
>> button gets disabled and I don't know how to turn it back on again,
>> this is what I'm trying to perform
>>
> IMHO it is a bug.
> By examining the code, I determined that this is what happens:
> a) User clicks OK button.
> b) The OK button is disabled by PreferencesDialog so that it cannot be
> clicked again while performOK is being run.
> c) The performOK returns false.
> d) PreferencesDialog returns control to user, but forgets to re-enable OK
> button.
>
> The only programmatic workaround I found is to enable it in performOK before
> returning false.
> Alternately, you can use the setValid() method to prevent the user from
> clicking OK until all values on the page are acceptable.
> I found that this is a better solution.
>
do you know, on IRC.freenode I was talknig to a guy on #eclipse who
tried his best to convince me that it was ok for eclipse to be doing
that, I said, ok, unexpected behaviour, what other platform disables the
button? lol, anyway, nice to see someone else thinking alike.

ok, you talk about enabling it again before performOk returns, is that
done through the setValid method you spoke about, or a different method?
I thought perhaps I could find teh ok button in the dialog class or
similar, but I'm not java genius and I couldnt find much, most likely
because I'm not used to java api's as you, but if you could let me know,
it would be great, or at the very least, which api calls I should be
paying attention to.

thanks sunil

chris
Re: performOK() return cancel, disables ok button? [message #463345 is a reply to message #463340] Thu, 03 November 2005 20:28 Go to previous message
Eclipse User
Originally posted by: sunil_kamath.nohotspammail.com

Christopher Thomas <chris.alex.thomas@gmail.com> wrote:
> Sunil Kamath wrote:
>> [snip]
>>
>> The only programmatic workaround I found is to enable it in
>> performOK before returning false.
>> Alternately, you can use the setValid() method to prevent the user
>> from clicking OK until all values on the page are acceptable.
>> I found that this is a better solution.
>>
> [snip]
> ok, you talk about enabling it again before performOk returns, is that
> done through the setValid method you spoke about, or a different
> method? I thought perhaps I could find teh ok button in the dialog
> class or similar, but I'm not java genius and I couldnt find much,
> most likely because I'm not used to java api's as you, but if you
> could let me know, it would be great, or at the very least, which api
> calls I should be paying attention to.
>
Assuming that you are extending the
org.eclipse.jface.preference.PreferencePage class, all you need to do is
call getContainer().updateButtons() before you return false from
performOK(). However, I still feel that using setValid() is a better
solution, since the OK button will not even be available to the user until
everything is correct on the preferences page.

--
Sunil
Previous Topic:draw arc
Next Topic:Toolbar and SWT.FLAT
Goto Forum:
  


Current Time: Wed Oct 01 12:27:46 GMT 2014

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

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