public abstract class RefactoringProcessor extends PlatformObject
Refactoring
. Implementors of
this class should therefore study the interface of the refactoring class
as well.
A refactoring processor is responsible for:
A refactoring processor can not assume that all resources are saved before any methods are called on it. Therefore a processor must be able to deal with unsaved resources.
This class should be subclassed by clients wishing to provide special refactoring processors.
Constructor and Description |
---|
RefactoringProcessor() |
Modifier and Type | Method and Description |
---|---|
abstract RefactoringStatus |
checkFinalConditions(IProgressMonitor pm,
CheckConditionsContext context)
Checks the final conditions based on the element to be refactored.
|
abstract RefactoringStatus |
checkInitialConditions(IProgressMonitor pm)
Checks some initial conditions based on the element to be refactored.
|
abstract Change |
createChange(IProgressMonitor pm)
Creates a
Change object describing the workspace modifications
the processor contributes to the overall refactoring. |
abstract Object[] |
getElements()
Returns an array containing the elements to be refactored.
|
abstract String |
getIdentifier()
Returns the unique identifier of the refactoring processor.
|
abstract String |
getProcessorName()
Returns a human readable name.
|
ProcessorBasedRefactoring |
getRefactoring()
Returns the associated refactoring.
|
abstract boolean |
isApplicable()
Checks whether the processor is applicable to the elements to be
refactored or not.
|
abstract RefactoringParticipant[] |
loadParticipants(RefactoringStatus status,
SharableParticipants sharedParticipants)
Returns the array of participants.
|
Change |
postCreateChange(Change[] participantChanges,
IProgressMonitor pm)
Additional hook allowing processors to add changes to the set of workspace
modifications after all participant changes have been created.
|
getAdapter
public ProcessorBasedRefactoring getRefactoring()
null
if the
processor isn't associated with a refactoring yet.public abstract Object[] getElements()
public abstract String getIdentifier()
null
.public abstract String getProcessorName()
null
.public abstract boolean isApplicable() throws CoreException
false
is returned the processor is
interpreted to be unusable.true
if the processor is applicable to the
elements; otherwise false
is returned.CoreException
- is the test fails. The processor is treated as
unusable if this method throws an exceptionpublic abstract RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException
The refactoring using this processor is considered as not being
executable if the returned status has the severity of
RefactoringStatus#FATAL
.
This method can be called more than once.
pm
- a progress monitor to report progress. Although availability
checks are supposed to execute fast, there can be certain
situations where progress reporting is necessary. For example
rebuilding a corrupted index may report progress.RefactoringStatus#FATAL
the refactoring is considered as not being executable.CoreException
- if an exception occurred during initial condition
checking. If this happens, the initial condition checking is
interpreted as failed.OperationCanceledException
- if the condition checking got canceledRefactoring.checkInitialConditions(IProgressMonitor)
,
RefactoringStatus.FATAL
public abstract RefactoringStatus checkFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException, OperationCanceledException
The refactoring using this processor is considered as not being
executable if the returned status has the severity of
RefactoringStatus#FATAL
.
This method can be called more than once.
pm
- a progress monitor to report progresscontext
- a condition checking context to collect shared condition checksRefactoringStatus#FATAL
the refactoring is considered as not being executable.CoreException
- if an exception occurred during final condition
checking. If this happens, the final condition checking is interpreted as failed.OperationCanceledException
- if the condition checking got canceledRefactoring.checkFinalConditions(IProgressMonitor)
,
RefactoringStatus.FATAL
public abstract Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException
Change
object describing the workspace modifications
the processor contributes to the overall refactoring.pm
- a progress monitor to report progressCoreException
- if an error occurred while creating the changeOperationCanceledException
- if the condition checking got canceledRefactoring.createChange(IProgressMonitor)
public Change postCreateChange(Change[] participantChanges, IProgressMonitor pm) throws CoreException, OperationCanceledException
participantChanges
- an array containing the changes created by the
participantspm
- a progress monitor to report progressnull
CoreException
- if an error occurred while creating the post changeOperationCanceledException
- if the condition checking got canceledcreateChange(IProgressMonitor)
public abstract RefactoringParticipant[] loadParticipants(RefactoringStatus status, SharableParticipants sharedParticipants) throws CoreException
Implementors are responsible to initialize the created participants with
the right arguments. The method is called after
checkFinalConditions(IProgressMonitor, CheckConditionsContext)
has
been called on the processor itself.
status
- a refactoring status to report status if problems occur while
loading the participantssharedParticipants
- a list of sharable participants. Implementors of
this method can simply pass this instance to the corresponding participant
loading methods defined in ParticipantManager
.null
or an empty array
if no participants are loadedCoreException
- if creating or loading of the participants failedISharableParticipant
Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.