Package org.eclipse.ltk.core.refactoring
Class PerformRefactoringHistoryOperation
java.lang.Object
org.eclipse.ltk.core.refactoring.PerformRefactoringHistoryOperation
- All Implemented Interfaces:
IWorkspaceRunnable
,ICoreRunnable
Operation that, when run, executes a series of refactoring sequentially.
Refactorings are executed using
PerformRefactoringOperation
.
The operation should be executed via the run method offered by
IWorkspace
to achieve proper delta batching.
Note: this class is not intended to be instantiated or extended outside of the refactoring framework.
- Since:
- 3.2
- See Also:
-
IWorkspace
PerformRefactoringOperation
RefactoringHistory
RefactoringHistoryService
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
Constructor Summary
ConstructorDescriptionCreates a new perform refactoring history operation. -
Method Summary
Modifier and TypeMethodDescriptionprotected RefactoringStatus
aboutToPerformRefactoring
(Refactoring refactoring, RefactoringDescriptor descriptor, IProgressMonitor monitor) Hook method which is called when the specified refactoring is going to be executed.protected Refactoring
createRefactoring
(RefactoringDescriptor descriptor, RefactoringStatus status) Deprecated.since 3.4.protected Refactoring
createRefactoring
(RefactoringDescriptor descriptor, RefactoringStatus status, IProgressMonitor monitor) Deprecated.since 3.6.protected RefactoringContext
createRefactoringContext
(RefactoringDescriptor descriptor, RefactoringStatus status, IProgressMonitor monitor) Method which is called to create a refactoring context from a refactoring descriptor.final RefactoringStatus
Returns the execution status.protected void
refactoringPerformed
(Refactoring refactoring, IProgressMonitor monitor) Hook method which is called when the specified refactoring has been performed.void
run
(IProgressMonitor monitor) Executes this runnable.
-
Constructor Details
-
PerformRefactoringHistoryOperation
Creates a new perform refactoring history operation.- Parameters:
history
- the refactoring history
-
-
Method Details
-
aboutToPerformRefactoring
protected RefactoringStatus aboutToPerformRefactoring(Refactoring refactoring, RefactoringDescriptor descriptor, IProgressMonitor monitor) Hook method which is called when the specified refactoring is going to be executed.- Parameters:
refactoring
- the refactoring about to be executeddescriptor
- the refactoring descriptormonitor
- the progress monitor to use- Returns:
- a status describing the outcome of the initialization
-
createRefactoring
@Deprecated protected Refactoring createRefactoring(RefactoringDescriptor descriptor, RefactoringStatus status) throws CoreException Deprecated.since 3.4. OverridecreateRefactoring(RefactoringDescriptor, RefactoringStatus, IProgressMonitor)
insteadMethod which is called to create a refactoring instance from a refactoring descriptor. The refactoring must be in an initialized state at the return of the method call. The default implementation delegates the task to the refactoring descriptor.- Parameters:
descriptor
- the refactoring descriptorstatus
- a refactoring status to describe the outcome of the initialization- Returns:
- the refactoring, or
null
if this refactoring descriptor represents the unknown refactoring, or if no refactoring contribution is available for this refactoring descriptor - Throws:
CoreException
- if an error occurs while creating the refactoring instance
-
createRefactoring
@Deprecated protected Refactoring createRefactoring(RefactoringDescriptor descriptor, RefactoringStatus status, IProgressMonitor monitor) throws CoreException Deprecated.since 3.6. OverridecreateRefactoringContext(RefactoringDescriptor, RefactoringStatus, IProgressMonitor)
insteadMethod which is called to create a refactoring instance from a refactoring descriptor. The refactoring must be in an initialized state at the return of the method call. The default implementation delegates the task to the refactoring descriptor.- Parameters:
descriptor
- the refactoring descriptorstatus
- a refactoring status to describe the outcome of the initializationmonitor
- the progress monitor to use- Returns:
- the refactoring, or
null
if this refactoring descriptor represents the unknown refactoring, or if no refactoring contribution is available for this refactoring descriptor - Throws:
CoreException
- if an error occurs while creating the refactoring instance- Since:
- 3.4
-
createRefactoringContext
protected RefactoringContext createRefactoringContext(RefactoringDescriptor descriptor, RefactoringStatus status, IProgressMonitor monitor) throws CoreException Method which is called to create a refactoring context from a refactoring descriptor. The refactoring context must contain a refactoring in an initialized state at the return of the method call.A caller of this method must ensure that
RefactoringContext.dispose()
is eventually called.The default implementation delegates the task to the refactoring descriptor.
- Parameters:
descriptor
- the refactoring descriptorstatus
- a refactoring status to describe the outcome of the initializationmonitor
- the progress monitor to use- Returns:
- the refactoring context, or
null
if this refactoring descriptor represents the unknown refactoring, or if no refactoring contribution is available for this refactoring descriptor - Throws:
CoreException
- if an error occurs while creating the refactoring context- Since:
- 3.6
-
getExecutionStatus
Returns the execution status. Guaranteed not to benull
.- Returns:
- the status of the session
-
refactoringPerformed
Hook method which is called when the specified refactoring has been performed.- Parameters:
refactoring
- the refactoring which has been performedmonitor
- the progress monitor to use
-
run
Description copied from interface:ICoreRunnable
Executes this runnable.The provided monitor can be used to report progress and respond to cancellation. If the progress monitor has been canceled, the runnable should finish its execution at the earliest convenience and throw an
OperationCanceledException
. ACoreException
with a status of severityIStatus.CANCEL
has the same effect as anOperationCanceledException
.- Specified by:
run
in interfaceICoreRunnable
- Specified by:
run
in interfaceIWorkspaceRunnable
- Parameters:
monitor
- a progress monitor, ornull
if progress reporting and cancellation are not desired. The monitor is only valid for the duration of the invocation of this method. Callers may callIProgressMonitor.done()
after this method returns or throws an exception, but this is not strictly required.- Throws:
CoreException
- if this operation fails
-