public abstract class Wizard extends Object implements IWizard
Wizard
to implement a particular wizard.
Subclasses may call the following methods to configure the wizard:
addPage
setHelpAvailable
setDefaultPageImageDescriptor
setDialogSettings
setNeedsProgressMonitor
setTitleBarColor
setWindowTitle
Subclasses may override these methods if required:
createPageControls
performCancel
addPages
performFinish
dispose
Note that clients are free to implement IWizard
from scratch
instead of subclassing Wizard
. Correct implementations of
IWizard
will work with any correct implementation of
IWizardPage
.
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_IMAGE
Image registry key of the default image for wizard pages (value
"org.eclipse.jface.wizard.Wizard.pageImage" ). |
Modifier | Constructor and Description |
---|---|
protected |
Wizard()
Creates a new empty wizard.
|
Modifier and Type | Method and Description |
---|---|
void |
addPage(IWizardPage page)
Adds a new page to this wizard.
|
void |
addPages()
The
Wizard implementation of this IWizard
method does nothing. |
boolean |
canFinish()
Returns whether this wizard could be finished without further user
interaction.
|
void |
createPageControls(Composite pageContainer)
The
Wizard implementation of this IWizard
method creates all the pages controls using
IDialogPage.createControl . |
void |
dispose()
The
Wizard implementation of this IWizard
method disposes all the pages controls using
DialogPage.dispose . |
IWizardContainer |
getContainer()
Returns the container of this wizard.
|
Image |
getDefaultPageImage()
Returns the default page image for this wizard.
|
IDialogSettings |
getDialogSettings()
Returns the dialog settings for this wizard.
|
IWizardPage |
getNextPage(IWizardPage page)
Returns the successor of the given page.
|
IWizardPage |
getPage(String name)
Returns the wizard page with the given name belonging to this wizard.
|
int |
getPageCount()
Returns the number of pages in this wizard.
|
IWizardPage[] |
getPages()
Returns all the pages in this wizard.
|
IWizardPage |
getPreviousPage(IWizardPage page)
Returns the predecessor of the given page.
|
Shell |
getShell()
Returns the wizard's shell if the wizard is visible.
|
IWizardPage |
getStartingPage()
Returns the first page to be shown in this wizard.
|
RGB |
getTitleBarColor()
Returns the title bar color for this wizard.
|
String |
getWindowTitle()
Returns the window title string for this wizard.
|
boolean |
isHelpAvailable()
Returns whether help is available for this wizard.
|
boolean |
needsPreviousAndNextButtons()
Returns whether this wizard needs Previous and Next buttons.
|
boolean |
needsProgressMonitor()
Returns whether this wizard needs a progress monitor.
|
boolean |
performCancel()
The
Wizard implementation of this IWizard
method does nothing and returns true . |
abstract boolean |
performFinish()
Subclasses must implement this
IWizard method to perform
any special finish processing for their wizard. |
void |
setContainer(IWizardContainer wizardContainer)
Sets or clears the container of this wizard.
|
void |
setDefaultPageImageDescriptor(ImageDescriptor imageDescriptor)
Sets the default page image descriptor for this wizard.
|
void |
setDialogSettings(IDialogSettings settings)
Sets the dialog settings for this wizard.
|
void |
setForcePreviousAndNextButtons(boolean b)
Controls whether the wizard needs Previous and Next buttons even if it
currently contains only one page.
|
void |
setHelpAvailable(boolean b)
Sets whether help is available for this wizard.
|
void |
setNeedsProgressMonitor(boolean b)
Sets whether this wizard needs a progress monitor.
|
void |
setTitleBarColor(RGB color)
Sets the title bar color for this wizard.
|
void |
setWindowTitle(String newTitle)
Sets the window title for the container that hosts this page to the given
string.
|
public static final String DEFAULT_IMAGE
"org.eclipse.jface.wizard.Wizard.pageImage"
).public void addPage(IWizardPage page)
page
- the new pagepublic void addPages()
Wizard
implementation of this IWizard
method does nothing. Subclasses should extend if extra pages need to be
added before the wizard opens. New pages should be added by calling
addPage
.public boolean canFinish()
IWizard
The result of this method is typically used by the wizard container to enable or disable the Finish button.
public void createPageControls(Composite pageContainer)
Wizard
implementation of this IWizard
method creates all the pages controls using
IDialogPage.createControl
. Subclasses should reimplement
this method if they want to delay creating one or more of the pages
lazily. The framework ensures that the contents of a page will be created
before attempting to show it.createPageControls
in interface IWizard
pageContainer
- the parent controlpublic void dispose()
Wizard
implementation of this IWizard
method disposes all the pages controls using
DialogPage.dispose
. Subclasses should extend this method
if the wizard instance maintains addition SWT resource that need to be
disposed.public IWizardContainer getContainer()
IWizard
getContainer
in interface IWizard
null
if this
wizard has yet to be added to a containerpublic Image getDefaultPageImage()
IWizard
This image can be used for pages which do not supply their own image.
getDefaultPageImage
in interface IWizard
public IDialogSettings getDialogSettings()
IWizard
The dialog store is used to record state between wizard invocations (for example, radio button selections, last directory, etc.).
getDialogSettings
in interface IWizard
null
if nonepublic IWizardPage getNextPage(IWizardPage page)
IWizard
This method is typically called by a wizard page
getNextPage
in interface IWizard
page
- the pagenull
if nonepublic IWizardPage getPage(String name)
IWizard
public int getPageCount()
IWizard
getPageCount
in interface IWizard
public IWizardPage[] getPages()
IWizard
public IWizardPage getPreviousPage(IWizardPage page)
IWizard
This method is typically called by a wizard page
getPreviousPage
in interface IWizard
page
- the pagenull
if nonepublic Shell getShell()
null
is returned.public IWizardPage getStartingPage()
IWizard
getStartingPage
in interface IWizard
public RGB getTitleBarColor()
IWizard
getTitleBarColor
in interface IWizard
public String getWindowTitle()
IWizard
getWindowTitle
in interface IWizard
null
for no titlepublic boolean isHelpAvailable()
IWizard
The result of this method is typically used by the container to show or hide a button labeled "Help".
Note: This wizard's container might be a TrayDialog
which provides
its own help support that is independent of this property.
Note 2: In the default WizardDialog
implementation, the "Help"
button only works when IDialogPage.performHelp()
is implemented.
isHelpAvailable
in interface IWizard
true
if help is available, false
otherwiseTrayDialog.isHelpAvailable()
,
TrayDialog.setHelpAvailable(boolean)
public boolean needsPreviousAndNextButtons()
IWizard
The result of this method is typically used by the container.
needsPreviousAndNextButtons
in interface IWizard
true
if Previous and Next buttons are required,
and false
if none are neededpublic boolean needsProgressMonitor()
IWizard
The result of this method is typically used by the container.
needsProgressMonitor
in interface IWizard
true
if a progress monitor is required,
and false
if none is neededpublic boolean performCancel()
Wizard
implementation of this IWizard
method does nothing and returns true
. Subclasses should
reimplement this method if they need to perform any special cancel
processing for their wizard.performCancel
in interface IWizard
true
to indicate the cancel request
was accepted, and false
to indicate
that the cancel request was refusedpublic abstract boolean performFinish()
IWizard
method to perform
any special finish processing for their wizard.performFinish
in interface IWizard
true
to indicate the finish request
was accepted, and false
to indicate
that the finish request was refusedpublic void setContainer(IWizardContainer wizardContainer)
IWizard
setContainer
in interface IWizard
wizardContainer
- the wizard container, or null
public void setDefaultPageImageDescriptor(ImageDescriptor imageDescriptor)
This image descriptor will be used to generate an image for a page with no image of its own; the image will be computed once and cached.
imageDescriptor
- the default page image descriptorpublic void setDialogSettings(IDialogSettings settings)
The dialog settings is used to record state between wizard invocations (for example, radio button selection, last import directory, etc.)
settings
- the dialog settings, or null
if nonegetDialogSettings()
public void setForcePreviousAndNextButtons(boolean b)
This flag should be set on wizards where the first wizard page adds follow-on wizard pages based on user input.
b
- true
to always show Next and Previous buttons,
and false
to suppress Next and Previous buttons
for single page wizardspublic void setHelpAvailable(boolean b)
The result of this method is typically used by the container to show or hide the button labeled "Help".
Note: This wizard's container might be a TrayDialog
which provides
its own help support that is independent of this property.
Note 2: In the default WizardDialog
implementation, the "Help"
button only works when IDialogPage.performHelp()
is implemented.
b
- true
if help is available, false
otherwiseisHelpAvailable()
,
TrayDialog.isHelpAvailable()
,
TrayDialog.setHelpAvailable(boolean)
public void setNeedsProgressMonitor(boolean b)
b
- true
if a progress monitor is required, and
false
if none is neededneedsProgressMonitor()
public void setTitleBarColor(RGB color)
color
- the title bar colorpublic void setWindowTitle(String newTitle)
newTitle
- the window title for the container
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.