Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 2723

Summary: [Wizards] Cannot set initial default button on wizard page (1GIKE93)
Product: [Eclipse Project] Platform Reporter: Kevin Haaland <Kevin_Haaland>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 Keywords: investigate
Version: 2.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Kevin Haaland CLA 2001-10-10 22:42:14 EDT
API is availble for a wizard page to specify the default button:
( (Wizard)getWizard() ).getShell().setDefaultButton(button);

Authors of wizards may wish to specify a default button other than next/finish when they
are both disabled.  This can be done easily on an event that occurs on the page, but the
initial default button (the button that will be the default when the page appears)
cannot be set.  The only signal the wizard page recieves that it becomes visible is
setVisble(boolean), but the wizard dialog will update the button bar after the setVisible call:

WizardDialog::showPage():
	currentPage.setVisible(true);
	oldPage.setVisible(false);

	// update the dialog controls
	update();

We have an inconsistency here that we should fix.

Currently:
(1) you can set the Default Button on a page event, even if Finish/Next are enabled
	(page is complete).
(2) you cannot set the inital Default Button

We should change this behaviour to:
(3) you can only set the Default button if the page is incomplete
(4) you can set the initial default button if the page is incomplete

-OR-
(5) do not allow the wizardPage to set the default button.

#4 is an easy fix, the old behaviour would set Finish as default if both Next/Finish were disabled,
this version won't change the default if both Finish/Next are disabled.
WizardDialog::updateButtons():
	if (canFinish)
		getShell().setDefaultButton(finishButton);
	else if (canFlipToNextPage)
		getShell().setDefaultButton(nextButton);

#3 and #5 would be hard to regulate, because it would require cutting off access to the
wizard shell.

A safe way to do #3 would be to add API to WizardDialog: setDefaultButton(Button).  This would
set the default button only if next AND finish are disabled which would provide a safe means
to set the default button.

NOTES:
Comment 1 DJ Houghton CLA 2001-10-29 19:12:04 EST
PRODUCT VERSION:
130

Comment 2 Randy Giffen CLA 2002-05-27 23:13:37 EDT
Defer
Comment 3 Randy Giffen CLA 2002-08-08 15:23:41 EDT
Reopen for investigation
Comment 4 Tod Creasey CLA 2005-08-04 07:56:05 EDT
There is no plan towork on this