Package org.eclipse.ltk.core.refactoring
Class PerformRefactoringOperation
java.lang.Object
org.eclipse.ltk.core.refactoring.PerformRefactoringOperation
- All Implemented Interfaces:
IWorkspaceRunnable
,ICoreRunnable
Operation that, when run, executes a refactoring. This includes
condition checking, change creation, change execution and remembering
of the undo change on the refactoring's undo stack.
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 extended by clients.
- Since:
- 3.0
- See Also:
- Restriction:
- This class is not intended to be subclassed by clients.
-
Constructor Summary
ConstructorDescriptionPerformRefactoringOperation
(RefactoringContext refactoringContext, int style) Create a new perform refactoring operation.PerformRefactoringOperation
(Refactoring refactoring, int style) Create a new perform refactoring operation. -
Method Summary
Modifier and TypeMethodDescriptionReturn the refactoring status of the condition checking.The undo object ornull
if no undo exists.Returns the refactoring status of the change's validation checking ornull
if a change couldn't be created or the operation hasn't been performed yet.void
run
(IProgressMonitor monitor) Executes this runnable.
-
Constructor Details
-
PerformRefactoringOperation
Create a new perform refactoring operation. The operation will not perform the refactoring if the refactoring's condition checking returns an error of severityRefactoringStatus.FATAL
.- Parameters:
refactoring
- the refactoring to performstyle
- the condition checking style as defined byCheckConditionsOperation
- See Also:
-
PerformRefactoringOperation
Create a new perform refactoring operation. The operation will not perform the refactoring if the refactoring's condition checking returns an error of severityRefactoringStatus.FATAL
.The caller must ensure that the operation is run exactly once. The implementation of
run(IProgressMonitor)
will callRefactoringContext.dispose()
.- Parameters:
refactoringContext
- the refactoring context to performstyle
- the condition checking style as defined byCheckConditionsOperation
- Since:
- 3.6
-
-
Method Details
-
getConditionStatus
Return the refactoring status of the condition checking.- Returns:
- the refactoring status of the condition checking or
null
if the operation hasn't been performed yet
-
getValidationStatus
Returns the refactoring status of the change's validation checking ornull
if a change couldn't be created or the operation hasn't been performed yet.- Returns:
- the refactoring status of the change's validation checking
-
getUndoChange
The undo object ornull
if no undo exists. The undo object is initialize via the callChange.initializeValidationData(IProgressMonitor)
- Returns:
- the undo object or
null
-
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
-