org.eclipse.ltk.ui.refactoring
Class RefactoringWizard
java.lang.Object
org.eclipse.jface.wizard.Wizard
org.eclipse.ltk.ui.refactoring.RefactoringWizard
-
All Implemented Interfaces:
-
IWizard
-
Direct Known Subclasses:
-
DeleteResourcesWizard,
MoveResourcesWizard,
RenameResourceWizard
-
public abstract class RefactoringWizard
- extends
Wizard
An abstract base implementation of a refactoring wizard. A refactoring
wizard differs from a normal wizard in the following characteristics:
- only pages of type
RefactoringWizardPage
can 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:
-
Refactoring
Field Summary
|
static int
|
CHECK_INITIAL_CONDITIONS_ON_OPEN
Flag (value 1) indicating that the initial condition checking of the refactoring is done when
the wizard opens. |
static int
|
DIALOG_BASED_UESR_INTERFACE
Deprecated. Use
DIALOG_BASED_USER_INTERFACE instead.
|
static int
|
DIALOG_BASED_USER_INTERFACE
Flag (value 4) indicating that a lightweight dialog based user interface should
be used to present this refactoring wizard. |
static int
|
NO_BACK_BUTTON_ON_STATUS_DIALOG
Flag (value 64) indicating that the dialog representing the refactoring
status to the user will not contain a back button. |
static int
|
NO_PREVIEW_PAGE
Flag (value 16) indicating that the wizard should not show a preview page. |
static int
|
NONE
Flag (value 0) indicating that no special flags are provided. |
static int
|
PREVIEW_EXPAND_FIRST_NODE
Flag (value 32) indicating that the first change node presented in the
preview page should be fully expanded. |
static int
|
WIZARD_BASED_USER_INTERFACE
Flag (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 int
|
YES_NO_BUTTON_STYLE
Flag (value 8) indicating that the finish and cancel button should be named
yes and no. |
Method Summary
|
void
|
addPage
(
IWizardPage page)
Adds a new page to this wizard. |
void
|
addPages
()
The Wizard implementation of this IWizard
method does nothing. |
protected abstract void
|
addUserInputPages
()
Hook method to add user input pages to this refactoring wizard. |
boolean
|
canFinish
()
Returns whether this wizard could be finished without further user
interaction. |
Change
|
getChange
()
Returns the refactoring's change object or null if no change
object has been created yet. |
String
|
getDefaultPageTitle
()
Returns the default page title used for pages that don't provide their
own page title. |
int
|
getMessageLineWidthInChars
()
Returns the width in characters to be used for the message line embedded into
the refactoring wizard dialog. |
IWizardPage
|
getPreviousPage
(
IWizardPage page)
Returns the predecessor of the given page. |
Refactoring
|
getRefactoring
()
Returns the refactoring this wizard is associated with. |
IWizardPage
|
getStartingPage
()
Returns the first page to be shown in this wizard. |
Change
|
internalCreateChange
(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api,
CreateChangeOperation operation,
boolean updateStatus)
Note: This method is for internal use only. |
boolean
|
internalGetExpandFirstNode
(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api)
Note: This method is for internal use only. |
boolean
|
internalHasPreviewPage
(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api)
Note: This method is for internal use only. |
boolean
|
internalIsYesNoStyle
(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api)
Note: This method is for internal use only. |
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. |
void
|
internalSetChange
(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api,
Change change)
Note: This method is for internal use only. |
void
|
internalSetPreviewShown
(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api,
boolean shown)
Note: This method is for internal use only. |
boolean
|
internalShowBackButtonOnStatusDialog
(org.eclipse.ltk.internal.ui.refactoring.InternalAPI api)
Note: This method is for internal use only. |
boolean
|
performCancel
()
The Wizard implementation of this IWizard
method does nothing and returns true . |
boolean
|
performFinish
()
Subclasses must implement this IWizard method to perform
any special finish processing for their wizard. |
void
|
setChangeCreationCancelable
(boolean isChangeCreationCancelable)
If set to true the change creation is cancelable by the user. |
void
|
setDefaultPageTitle
(
String defaultPageTitle)
Sets the default page title to the given value. |
void
|
setForcePreviewReview
(boolean forcePreviewReview)
If set to true the Finish or OK button, respectively will
be disabled until the user has visited the preview page. |
void
|
setInitialConditionCheckingStatus
(
RefactoringStatus status)
Sets the initial condition checking status computed by the refactoring. |
Methods inherited from class org.eclipse.jface.wizard.
Wizard
|
createPageControls,
dispose,
getContainer,
getDefaultPageImage,
getDialogSettings,
getNextPage,
getPage,
getPageCount,
getPages,
getShell,
getTitleBarColor,
getWindowTitle,
isHelpAvailable,
needsPreviousAndNextButtons,
needsProgressMonitor,
setContainer,
setDefaultPageImageDescriptor,
setDialogSettings,
setForcePreviousAndNextButtons,
setHelpAvailable,
setNeedsProgressMonitor,
setTitleBarColor,
setWindowTitle
|
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
NONE
public static final int NONE
- Flag (value 0) indicating that no special flags are provided.
-
See Also:
-
Constant Field Values
CHECK_INITIAL_CONDITIONS_ON_OPEN
public static final int CHECK_INITIAL_CONDITIONS_ON_OPEN
- Flag (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:
-
Constant Field Values
WIZARD_BASED_USER_INTERFACE
public static final int WIZARD_BASED_USER_INTERFACE
- Flag (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 flag
DIALOG_BASED_USER_INTERFACE
.
-
See Also:
-
Constant Field Values
DIALOG_BASED_USER_INTERFACE
public static final int DIALOG_BASED_USER_INTERFACE
- Flag (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 flag
WIZARD_BASED_USER_INTERFACE
.
-
Since:
- 3.1
-
See Also:
-
Constant Field Values
DIALOG_BASED_UESR_INTERFACE
public static final int DIALOG_BASED_UESR_INTERFACE
-
Deprecated. Use
DIALOG_BASED_USER_INTERFACE
instead.
-
See Also:
-
Constant Field Values
YES_NO_BUTTON_STYLE
public static final int YES_NO_BUTTON_STYLE
- Flag (value 8) indicating that the finish and cancel button should be named
yes and no. The flag is ignored if the flag
WIZARD_BASED_USER_INTERFACE
is specified.
-
See Also:
-
Constant Field Values
NO_PREVIEW_PAGE
public static final int NO_PREVIEW_PAGE
- Flag (value 16) indicating that the wizard should not show a preview page.
The flag is ignored if the flag
WIZARD_BASED_USER_INTERFACE
is specified.
-
See Also:
-
Constant Field Values
PREVIEW_EXPAND_FIRST_NODE
public static final int PREVIEW_EXPAND_FIRST_NODE
- Flag (value 32) indicating that the first change node presented in the
preview page should be fully expanded.
-
See Also:
-
Constant Field Values
NO_BACK_BUTTON_ON_STATUS_DIALOG
public static final int NO_BACK_BUTTON_ON_STATUS_DIALOG
- Flag (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 flag (@link #WIZARD_BASED_USER_INTERFACE}
is specified.
-
See Also:
-
Constant Field Values
RefactoringWizard
public RefactoringWizard(
Refactoring refactoring,
int flags)
- Creates a new refactoring wizard for the given refactoring.
-
Parameters:
-
refactoring
- the refactoring the wizard is presenting -
flags
- flags specifying the behavior of the wizard. If neither
WIZARD_BASED_USER_INTERFACE
nor DIALOG_BASED_UESR_INTERFACE
is specified then WIZARD_BASED_USER_INTERFACE
will be
taken as a default.
getRefactoring
public final
Refactoring getRefactoring()
- Returns the refactoring this wizard is associated with.
-
-
Returns:
- the wizard's refactoring
setDefaultPageTitle
public final void setDefaultPageTitle(
String defaultPageTitle)
- 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:
-
Wizard.setDefaultPageImageDescriptor(org.eclipse.jface.resource.ImageDescriptor)
getDefaultPageTitle
public final
String getDefaultPageTitle()
- Returns the default page title used for pages that don't provide their
own page title.
-
-
Returns:
- the default page title or
null
if non has been set -
See Also:
-
setDefaultPageTitle(String)
setForcePreviewReview
public final void setForcePreviewReview(boolean forcePreviewReview)
- If set to
true
the Finish or OK button, respectively will
be disabled until the user has visited the preview page. If set to
false
the refactoring can be performed before the preview
page has been visited.
-
-
Parameters:
-
forcePreviewReview
- if true
to 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 to
true
the 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:
-
Refactoring.createChange(IProgressMonitor)
setInitialConditionCheckingStatus
public final void setInitialConditionCheckingStatus(
RefactoringStatus status)
- 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:
-
Refactoring.checkInitialConditions(IProgressMonitor)
,
CHECK_INITIAL_CONDITIONS_ON_OPEN
getChange
public final
Change getChange()
- Returns the refactoring's change object or
null
if no change
object has been created yet.
-
-
Returns:
- the refactoring's change object or
null
-
See Also:
-
Refactoring.createChange(IProgressMonitor)
addPages
public final void addPages()
- The
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
.
This method calls the hook method
addUserInputPages()
to allow
subclasses to add specific user input pages.
-
-
Specified by:
-
addPages
in interface
IWizard
-
Overrides:
-
addPages
in class
Wizard
-
addPage
public final void addPage(
IWizardPage page)
- 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 type
RefactoringWizardPage
.
-
-
Overrides:
-
addPage
in class
Wizard
-
-
Parameters:
-
page
- the new page
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 type
UserInputWizardPage
.
Adding pages of a different kind is not permitted and will result
in unexpected behavior.
-
getStartingPage
public
IWizardPage getStartingPage()
- Returns the first page to be shown in this wizard.
-
-
Specified by:
-
getStartingPage
in interface
IWizard
-
Overrides:
-
getStartingPage
in class
Wizard
-
-
Returns:
- the first wizard page
getPreviousPage
public
IWizardPage getPreviousPage(
IWizardPage page)
- Returns the predecessor of the given page.
This method is typically called by a wizard page
-
-
Specified by:
-
getPreviousPage
in interface
IWizard
-
Overrides:
-
getPreviousPage
in class
Wizard
-
-
Parameters:
-
page
- the page
-
Returns:
- the previous page, or
null
if none
canFinish
public boolean canFinish()
- Returns 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.
-
-
Specified by:
-
canFinish
in interface
IWizard
-
Overrides:
-
canFinish
in class
Wizard
-
-
Returns:
-
true
if the wizard could be finished,
and false
otherwise
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 clients -
operation
- the create change operation -
updateStatus
- 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 clients -
op
- 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()
-
Description copied from class:
Wizard
- Subclasses must implement this
IWizard
method to perform
any special finish processing for their wizard.
-
-
Specified by:
-
performFinish
in interface
IWizard
-
Specified by:
-
performFinish
in class
Wizard
-
-
Returns:
-
true
to indicate the finish request
was accepted, and false
to indicate
that the finish request was refused
performCancel
public boolean performCancel()
-
Description copied from class:
Wizard
- The
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.
-
-
Specified by:
-
performCancel
in interface
IWizard
-
Overrides:
-
performCancel
in class
Wizard
-
-
Returns:
-
true
to indicate the cancel request
was accepted, and false
to 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 clients -
change
- 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 clients -
shown
- 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.
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.