|
Eclipse Platform Release 3.4 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.core.runtime.PlatformObject
org.eclipse.ltk.core.refactoring.Refactoring
org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring
An base implementation for refactorings that are split into one refactoring processor and 0..n participants.
This class can be subclassed by clients wishing to provide a special refactoring which uses a processor/participant architecture.
Since 3.4, this class is non abstract and can be instantiated. getProcessor()
will
return the processor passed in ProcessorBasedRefactoring(RefactoringProcessor)
or
the processor set by setProcessor(RefactoringProcessor)
.
Constructor Summary | |
protected |
ProcessorBasedRefactoring()
Deprecated. use ProcessorBasedRefactoring(RefactoringProcessor) instead |
|
ProcessorBasedRefactoring(RefactoringProcessor processor)
Creates a new processor based refactoring. |
Method Summary | |
RefactoringStatus |
checkFinalConditions(IProgressMonitor pm)
After checkInitialConditions has been performed and the user has
provided all input necessary to perform the refactoring this method is called
to check the remaining preconditions.
The refactoring has to be considered as not being executable if the returned status
has the severity of This method can be called more than once. |
RefactoringStatus |
checkInitialConditions(IProgressMonitor pm)
Checks some initial conditions based on the element to be refactored. The method is typically called by the UI to perform an initial checks after an action has been executed.
The refactoring has to be considered as not being executable if the returned status
has the severity of This method can be called more than once. |
Change |
createChange(IProgressMonitor pm)
Creates a Change object that performs the actual workspace
transformation. |
Object |
getAdapter(Class clazz)
Adapts the refactoring to the given type. |
String |
getName()
Returns the refactoring's name. |
RefactoringProcessor |
getProcessor()
Return the processor associated with this refactoring. |
TextChange |
getTextChange(Object element)
Returns the text change for the given element or null
if a text change doesn't exist. |
boolean |
isApplicable()
Checks whether the refactoring is applicable to the elements to be refactored or not. |
void |
setProcessor(RefactoringProcessor processor)
Sets the processor associated with this refactoring. |
String |
toString()
|
Methods inherited from class org.eclipse.ltk.core.refactoring.Refactoring |
checkAllConditions, doGetRefactoringTickProvider, getRefactoringTickProvider, getValidationContext, setValidationContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected ProcessorBasedRefactoring()
ProcessorBasedRefactoring(RefactoringProcessor)
instead
getProcessor()
to return a processor or set the
processor with setProcessor(RefactoringProcessor)
.
public ProcessorBasedRefactoring(RefactoringProcessor processor)
processor
- the refactoring's main processorMethod Detail |
public RefactoringProcessor getProcessor()
null
. Implementors can override this method
to return the processor to be used by this refactoring. Since 3.4, this method returns the processor passed in
ProcessorBasedRefactoring(RefactoringProcessor)
or by setProcessor(RefactoringProcessor)
.
public void setProcessor(RefactoringProcessor processor)
null
.
processor
- the processor associated with this refactoringpublic final boolean isApplicable() throws CoreException
This default implementation forwards the call to the refactoring processor.
true
if the refactoring is applicable to the
elements; otherwise false
is returned.
CoreException
- if the test failspublic String getName()
getName
in class Refactoring
null
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException
The refactoring has to be considered as not being executable if the returned status
has the severity of RefactoringStatus#FATAL
.
This method can be called more than once.
checkInitialConditions
in class Refactoring
pm
- a progress monitor to report progress. Although initial 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 has to be considered as not being executable.
CoreException
- if an exception occurred during initial condition checking.
If this happens then the initial condition checking has to be interpreted as failedRefactoring.checkFinalConditions(IProgressMonitor)
,
RefactoringStatus.FATAL
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException
checkInitialConditions
has been performed and the user has
provided all input necessary to perform the refactoring this method is called
to check the remaining preconditions.
The refactoring has to be considered as not being executable if the returned status
has the severity of RefactoringStatus#FATAL
.
This method can be called more than once.
checkFinalConditions
in class Refactoring
pm
- a progress monitor to report progress
RefactoringStatus#FATAL
the refactoring is considered as not being executable.
CoreException
- if an exception occurred during final condition checking
If this happens then the final condition checking is interpreted as failedRefactoring.checkInitialConditions(IProgressMonitor)
,
RefactoringStatus.FATAL
public Change createChange(IProgressMonitor pm) throws CoreException
Change
object that performs the actual workspace
transformation.
createChange
in class Refactoring
pm
- a progress monitor to report progress
CoreException
- if an error occurred while creating the changepublic TextChange getTextChange(Object element)
null
if a text change doesn't exist. This method only returns a valid
result during change creation. Outside of change creation always
null
is returned.
element
- the element to be modified for which a text change
is requested
null
if no text change exists
for the elementpublic Object getAdapter(Class clazz)
getAdapter
in interface IAdaptable
getAdapter
in class Refactoring
clazz
- the adapter class to look up
null
if no adapter
exists.public String toString()
toString
in class Refactoring
|
Eclipse Platform Release 3.4 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.