Class RefactoringWizard
- All Implemented Interfaces:
IShellProvider,IWizard
- Direct Known Subclasses:
DeleteResourcesWizard,MoveResourcesWizard,RenameResourceWizard
- only pages of type
RefactoringWizardPagecan be added to a refactoring wizard. Trying to add a different kind of page results in an exception. - a refactoring wizard consists of 0 .. n user input pages, one error page to present the outcome of the refactoring's condition checking and one preview page to present a preview of the workspace changes.
A refactoring wizard is best opened using the RefactoringWizardOpenOperation.
Clients may extend this class.
- Since:
- 3.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intFlag (value 1) indicating that the initial condition checking of the refactoring is done when the wizard opens.static final intDeprecated.static final intFlag (value 4) indicating that a lightweight dialog based user interface should be used to present this refactoring wizard.static final intFlag (value 64) indicating that the dialog representing the refactoring status to the user will not contain a back button.static final intFlag (value 16) indicating that the wizard should not show a preview page.static final intFlag (value 0) indicating that no special flags are provided.static final intFlag (value 32) indicating that the first change node presented in the preview page should be fully expanded.static final intFlag (value 128) indicating that a help control should be shown.static final intFlag (value 2) indicating that a normal wizard based user interface consisting of a back, next, finish and cancel button should be used to present this refactoring wizard.static final intFlag (value 8) indicating that the finish and cancel button should be named yes and no.Fields inherited from class org.eclipse.jface.wizard.Wizard
DEFAULT_IMAGE -
Constructor Summary
ConstructorsConstructorDescriptionRefactoringWizard(RefactoringContext refactoringContext, int flags) Creates a new refactoring wizard for the given refactoring context.RefactoringWizard(Refactoring refactoring, int flags) Creates a new refactoring wizard for the given refactoring. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddPage(IWizardPage page) Adds a new page to this wizard.final voidaddPages()TheWizardimplementation of thisIWizardmethod does nothing.protected abstract voidHook method to add user input pages to this refactoring wizard.booleanReturns whether this wizard could be finished without further user interaction.final ChangeReturns the refactoring's change object ornullif no change object has been created yet.final StringReturns the default page title used for pages that don't provide their own page title.intReturns the width in characters to be used for the message line embedded into the refactoring wizard dialog.getPreviousPage(IWizardPage page) Returns the predecessor of the given page.final RefactoringReturns the refactoring this wizard is associated with.final RefactoringContextReturns the refactoring context this wizard is associated with, ornullif none.Returns the first page to be shown in this wizard.final intReturns the refactoring wizard flags that have been set for this wizard.final ChangeinternalCreateChange(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, CreateChangeOperation operation, boolean updateStatus) Note: This method is for internal use only.final booleaninternalGetExpandFirstNode(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only.final booleaninternalHasPreviewPage(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only.final booleaninternalIsYesNoStyle(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only.final org.eclipse.ltk.internal.ui.refactoring.FinishResultinternalPerformFinish(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, PerformChangeOperation op) Note: This method is for internal use only.final voidinternalSetChange(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, Change change) Note: This method is for internal use only.final voidinternalSetPreviewShown(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, boolean shown) Note: This method is for internal use only.final booleaninternalShowBackButtonOnStatusDialog(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only.booleanTheWizardimplementation of thisIWizardmethod does nothing and returnstrue.booleanCallsRefactoringWizardPage.performFinish()on the currently active wizard page.final voidsetChangeCreationCancelable(boolean isChangeCreationCancelable) If set totruethe change creation is cancelable by the user.final voidsetDefaultPageTitle(String defaultPageTitle) Sets the default page title to the given value.final voidsetForcePreviewReview(boolean forcePreviewReview) If set totruethe Finish or OK button, respectively will be disabled until the user has visited the preview page.voidsetHelpAvailable(boolean b) Deprecated.WIZARD_BASED_USER_INTERFACEalways shows a '?'voidSets the runnable context that will be used to computing refactoring conditions and change while the refactoring dialog is not yet shown.final voidSets the initial condition checking status computed by the refactoring.Methods inherited from class org.eclipse.jface.wizard.Wizard
createPageControls, dispose, getContainer, getDefaultPageImage, getDialogSettings, getMinimumWizardSize, getNextPage, getPage, getPageCount, getPages, getShell, getTitleBarColor, getWindowTitle, isHelpAvailable, needsPreviousAndNextButtons, needsProgressMonitor, setContainer, setDefaultPageImageDescriptor, setDialogSettings, setForcePreviousAndNextButtons, setNeedsProgressMonitor, setTitleBarColor, setWindowTitle
-
Field Details
-
NONE
public static final int NONEFlag (value 0) indicating that no special flags are provided.- See Also:
-
CHECK_INITIAL_CONDITIONS_ON_OPEN
public static final int CHECK_INITIAL_CONDITIONS_ON_OPENFlag (value 1) indicating that the initial condition checking of the refactoring is done when the wizard opens. If not specified it is assumed that the initial condition checking has been done by the client before opening the wizard dialog.- See Also:
-
WIZARD_BASED_USER_INTERFACE
public static final int WIZARD_BASED_USER_INTERFACEFlag (value 2) indicating that a normal wizard based user interface consisting of a back, next, finish and cancel button should be used to present this refactoring wizard. This flag can't be specified together with the flagDIALOG_BASED_USER_INTERFACE.- See Also:
-
DIALOG_BASED_USER_INTERFACE
public static final int DIALOG_BASED_USER_INTERFACEFlag (value 4) indicating that a lightweight dialog based user interface should be used to present this refactoring wizard. This user interface consists of a preview, finish and cancel button and the initial size of dialog is based on the first user input page. This flag is only valid if only one user input page is present. Specifying this flag together with more than one input page will result in an exception when adding the user input pages. This flag can't be specified together with the flagWIZARD_BASED_USER_INTERFACE.- Since:
- 3.1
- See Also:
-
DIALOG_BASED_UESR_INTERFACE
Deprecated.UseDIALOG_BASED_USER_INTERFACEinstead.- See Also:
-
YES_NO_BUTTON_STYLE
public static final int YES_NO_BUTTON_STYLEFlag (value 8) indicating that the finish and cancel button should be named yes and no. The flag is ignored if the flagWIZARD_BASED_USER_INTERFACEis specified.- See Also:
-
NO_PREVIEW_PAGE
public static final int NO_PREVIEW_PAGEFlag (value 16) indicating that the wizard should not show a preview page. The flag is ignored if the flagWIZARD_BASED_USER_INTERFACEis specified.- See Also:
-
PREVIEW_EXPAND_FIRST_NODE
public static final int PREVIEW_EXPAND_FIRST_NODEFlag (value 32) indicating that the first change node presented in the preview page should be fully expanded.- See Also:
-
NO_BACK_BUTTON_ON_STATUS_DIALOG
public static final int NO_BACK_BUTTON_ON_STATUS_DIALOGFlag (value 64) indicating that the dialog representing the refactoring status to the user will not contain a back button. The flag is ignored if the flagWIZARD_BASED_USER_INTERFACEis specified.- See Also:
-
SHOW_HELP_CONTROL
public static final int SHOW_HELP_CONTROLFlag (value 128) indicating that a help control should be shown. The flag is ignored if the flagWIZARD_BASED_USER_INTERFACEis specified (the '?' button is always shown there).- Since:
- 3.6
- See Also:
-
-
Constructor Details
-
RefactoringWizard
Creates a new refactoring wizard for the given refactoring.- Parameters:
refactoring- the refactoring the wizard is presentingflags- flags specifying the behavior of the wizard. If neitherWIZARD_BASED_USER_INTERFACEnorDIALOG_BASED_USER_INTERFACEis specified thenWIZARD_BASED_USER_INTERFACEwill be taken as a default.
-
RefactoringWizard
Creates a new refactoring wizard for the given refactoring context.- Parameters:
refactoringContext- the refactoringContext the wizard is presentingflags- flags specifying the behavior of the wizard. If neitherWIZARD_BASED_USER_INTERFACEnorDIALOG_BASED_USER_INTERFACEis specified thenWIZARD_BASED_USER_INTERFACEwill be taken as a default.- Since:
- 3.7
-
-
Method Details
-
getRefactoring
Returns the refactoring this wizard is associated with.- Returns:
- the wizard's refactoring
-
getRefactoringContext
Returns the refactoring context this wizard is associated with, ornullif none.- Returns:
- the wizard's refactoring context or
null - Since:
- 3.7
-
getWizardFlags
public final int getWizardFlags()Returns the refactoring wizard flags that have been set for this wizard. Note that the set of valid flags may grow in the future.- Returns:
- the wizard's flags
- Since:
- 3.6
-
setDefaultPageTitle
Sets the default page title to the given value. This value is used as a page title for wizard pages which don't provide their own page title. Setting this value has only an effect as long as the user interface hasn't been created yet.- Parameters:
defaultPageTitle- the default page title.- See Also:
-
getDefaultPageTitle
Returns the default page title used for pages that don't provide their own page title.- Returns:
- the default page title or
nullif non has been set - See Also:
-
setForcePreviewReview
public final void setForcePreviewReview(boolean forcePreviewReview) If set totruethe Finish or OK button, respectively will be disabled until the user has visited the preview page. If set tofalsethe refactoring can be performed before the preview page has been visited.- Parameters:
forcePreviewReview- iftrueto user must confirm the preview
-
getMessageLineWidthInChars
public int getMessageLineWidthInChars()Returns the width in characters to be used for the message line embedded into the refactoring wizard dialog.Subclasses may override this method and return a different value.
- Returns:
- the message lines width in characters
-
setChangeCreationCancelable
public final void setChangeCreationCancelable(boolean isChangeCreationCancelable) If set totruethe change creation is cancelable by the user.By default, change creation is cancelable.
- Parameters:
isChangeCreationCancelable- determines whether the change creation is cancelable by the user or not.- See Also:
-
setInitialConditionCheckingStatus
Sets the initial condition checking status computed by the refactoring. Clients should uses this method if the initial condition checking status has been computed outside of this refactoring wizard.- Parameters:
status- the initial condition checking status.- See Also:
-
getChange
Returns the refactoring's change object ornullif no change object has been created yet.- Returns:
- the refactoring's change object or
null - See Also:
-
setHelpAvailable
Deprecated.WIZARD_BASED_USER_INTERFACEalways shows a '?' button. To show the button withDIALOG_BASED_USER_INTERFACE, add theSHOW_HELP_CONTROLflag.Description copied from class:WizardSets whether help is available for this wizard.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
TrayDialogwhich provides its own help support that is independent of this property.Note 2: In the default
WizardDialogimplementation, the "Help" button only works whenIDialogPage.performHelp()is implemented.- Overrides:
setHelpAvailablein classWizard- Parameters:
b-trueif help is available,falseotherwise- See Also:
-
addPages
public final void addPages()TheWizardimplementation of thisIWizardmethod does nothing. Subclasses should extend if extra pages need to be added before the wizard opens. New pages should be added by callingaddPage. This method calls the hook methodaddUserInputPages()to allow subclasses to add specific user input pages. -
addPage
Adds a new page to this wizard. The page is inserted at the end of the page list. This method asserts that the pages added to the refactoring wizard are instances of typeRefactoringWizardPage. -
addUserInputPages
protected abstract void addUserInputPages()Hook method to add user input pages to this refactoring wizard. Pages added via this call have to be instances of the typeUserInputWizardPage. Adding pages of a different kind is not permitted and will result in unexpected behavior. -
getStartingPage
Description copied from interface:IWizardReturns the first page to be shown in this wizard.- Specified by:
getStartingPagein interfaceIWizard- Overrides:
getStartingPagein classWizard- Returns:
- the first wizard page
-
setInitialComputationContext
Sets the runnable context that will be used to computing refactoring conditions and change while the refactoring dialog is not yet shown. The default is to use the active workbench window.- Parameters:
context- a runnable context, ornullto re-set the default- Since:
- 3.5
-
getPreviousPage
Description copied from interface:IWizardReturns the predecessor of the given page.This method is typically called by a wizard page
- Specified by:
getPreviousPagein interfaceIWizard- Overrides:
getPreviousPagein classWizard- Parameters:
page- the page- Returns:
- the previous page, or
nullif none
-
canFinish
public boolean canFinish()Description copied from interface:IWizardReturns whether this wizard could be finished without further user interaction.The result of this method is typically used by the wizard container to enable or disable the Finish button.
-
internalCreateChange
public final Change internalCreateChange(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, CreateChangeOperation operation, boolean updateStatus) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clientsoperation- the create change operationupdateStatus- flag indicating if status updating is requested- Returns:
- the created change
- Restriction:
- This method is not intended to be referenced by clients.
-
internalPerformFinish
public final org.eclipse.ltk.internal.ui.refactoring.FinishResult internalPerformFinish(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, PerformChangeOperation op) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clientsop- the perform change operation- Returns:
- whether the finish ended OK or not
- Restriction:
- This method is not intended to be referenced by clients.
-
performFinish
public boolean performFinish()CallsRefactoringWizardPage.performFinish()on the currently active wizard page. Clients are not expected to extend this method to do lengthy processing (theRefactoringclass should implement analysis andChangecreation).- Specified by:
performFinishin interfaceIWizard- Specified by:
performFinishin classWizard- Returns:
trueto indicate the finish request was accepted, andfalseto indicate that the finish request was refused
-
performCancel
public boolean performCancel()Description copied from class:WizardTheWizardimplementation of thisIWizardmethod does nothing and returnstrue. Subclasses should reimplement this method if they need to perform any special cancel processing for their wizard.- Specified by:
performCancelin interfaceIWizard- Overrides:
performCancelin classWizard- Returns:
trueto indicate the cancel request was accepted, andfalseto indicate that the cancel request was refused
-
internalHasPreviewPage
public final boolean internalHasPreviewPage(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clients- Returns:
- whether the wizard has a preview page or not.
- Restriction:
- This method is not intended to be referenced by clients.
-
internalIsYesNoStyle
public final boolean internalIsYesNoStyle(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clients- Returns:
- whether yes no button style is requested
- Restriction:
- This method is not intended to be referenced by clients.
-
internalGetExpandFirstNode
public final boolean internalGetExpandFirstNode(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clients- Returns:
- whether the first node of the preview is supposed to be expanded
- Restriction:
- This method is not intended to be referenced by clients.
-
internalSetChange
public final void internalSetChange(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, Change change) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clientschange- the change to set- Restriction:
- This method is not intended to be referenced by clients.
-
internalSetPreviewShown
public final void internalSetPreviewShown(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api, boolean shown) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clientsshown- a boolean indicating if the preview page has been shown or not- Restriction:
- This method is not intended to be referenced by clients.
-
internalShowBackButtonOnStatusDialog
public final boolean internalShowBackButtonOnStatusDialog(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api) Note: This method is for internal use only. Clients are not allowed to call this method.- Parameters:
api- internal instance to avoid access from external clients- Returns:
- whether to show a back button or not
- Restriction:
- This method is not intended to be referenced by clients.
-
DIALOG_BASED_USER_INTERFACEinstead.