Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » WizardDialog default button
WizardDialog default button [message #332810] Mon, 10 November 2008 16:24 Go to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Is there any way, from my Wizard class, to remove the "default button"
designation from the WizardDialog's "Finish" button? I need to
circumvent the behavior of the wizard doing its finish work when the
Enter key is pressed.

Thanks in advance,
Eric
Re: WizardDialog default button [message #332812 is a reply to message #332810] Mon, 10 November 2008 16:44 Go to previous messageGo to next message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
Eric Rizzo wrote:
> Is there any way, from my Wizard class, to remove the "default button"
> designation from the WizardDialog's "Finish" button? I need to
> circumvent the behavior of the wizard doing its finish work when the
> Enter key is pressed.

IWizardContainer container = wizard.getContainer();
Shell shell = container.getShell();
shell.setDefaultButton(null);

Remy
Re: WizardDialog default button [message #332822 is a reply to message #332812] Mon, 10 November 2008 20:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 11/10/2008 11:44 AM, Remy Chi Jian Suen wrote:
> Eric Rizzo wrote:
>> Is there any way, from my Wizard class, to remove the "default button"
>> designation from the WizardDialog's "Finish" button? I need to
>> circumvent the behavior of the wizard doing its finish work when the
>> Enter key is pressed.
>
> IWizardContainer container = wizard.getContainer();
> Shell shell = container.getShell();
> shell.setDefaultButton(null);

Remy,
I already looked at that, but the comments for setDefaultButton() say:

* If the argument is not null, sets the receiver's default
* button to the argument, and if the argument is null, sets
* the receiver's default button to the first button which
* was set as the receiver's default button (called the
* <em>saved default button</em>).

Since the default button is set by WizardDialog, it can't be set back to
null. Worse, WizardDialog has code that explicitly sets the default
button whenever a page is re-validated - arrrrgh!

Eric
Re: WizardDialog default button [message #332844 is a reply to message #332822] Tue, 11 November 2008 07:38 Go to previous messageGo to next message
Remy Suen is currently offline Remy SuenFriend
Messages: 462
Registered: July 2009
Senior Member
Ah, sorry about that.

I guess the only way around it is to subclass WizardDialog. But I
presume your wizards are being constructed by the framework (through the
'File' menu) so that's probably a no-go.

Remy
Re: WizardDialog default button [message #334733 is a reply to message #332822] Wed, 25 February 2009 15:37 Go to previous message
Antoine Toulmé is currently offline Antoine ToulméFriend
Messages: 31
Registered: July 2009
Member
Eric, we faced the same problem today on IRC, and we looked at the code.

If set to null, it actually apparently works so the API looks wrong here
(or there is a bug in the code).

So the fix here is to subclass DialogWizard, override updateButtons in
WizardDialog and do getShell().setDefaultButton(null);

It only works if you are in control when creating the DialogWizard.


Thanks,

Antoine
Previous Topic:Eclipse Plugin - Read from file
Next Topic:String Externalization/Localization/I18N Tools
Goto Forum:
  


Current Time: Fri Apr 19 20:27:24 GMT 2024

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

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

Back to the top