|
Eclipse Platform Release 3.1 |
|||||||||||
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.participants.RefactoringParticipant
A refactoring participant can participate in the condition checking and change creation of a refactoring processor.
If the severity of the condition checking result is RefactoringStatus.FATAL
then the whole refactoring will not be carried out.
The change created from a participant MUST not conflict with any changes
provided by other participants or the refactoring itself. To ensure this a participant
is only allowed to manipulate resources belonging to its domain. As of 3.1 this got
relaxed for textual resources. A participant can now change a textual resource already
manipulated by the processor as long as both are manipulating different regions in the
file (see createChange(IProgressMonitor)
and getTextChange(Object)
).
For example a rename type participant updating launch configuration is only allowed to
update launch configurations or shared textual resources. If a change conflicts with
another change during execution then the participant who created the change will be
disabled for the rest of the eclipse session.
A refactoring participant can not assume that all resources are saved before any methods are called on it. Therefore a participant must be able to deal with unsaved resources.
This class should be subclassed by clients wishing to provide special refactoring participants extension points.
RefactoringProcessor
Constructor Summary | |
---|---|
RefactoringParticipant()
|
Method Summary | |
---|---|
abstract RefactoringStatus |
checkConditions(IProgressMonitor pm,
CheckConditionsContext context)
Checks the conditions of the refactoring participant. |
abstract Change |
createChange(IProgressMonitor pm)
Creates a Change object that contains the workspace modifications
of this participant. |
abstract String |
getName()
Returns a human readable name of this participant. |
RefactoringProcessor |
getProcessor()
Returns the processor that is associated with this participant. |
TextChange |
getTextChange(Object element)
Returns the text change for the given element or null
if a text change doesn't exist. |
protected abstract boolean |
initialize(Object element)
Initializes the participant with the element to be refactored. |
protected abstract void |
initialize(RefactoringArguments arguments)
Initializes the participant with the refactoring arguments |
boolean |
initialize(RefactoringProcessor processor,
Object element,
RefactoringArguments arguments)
Initializes the participant. |
Methods inherited from class org.eclipse.core.runtime.PlatformObject |
---|
getAdapter |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RefactoringParticipant()
Method Detail |
public RefactoringProcessor getProcessor()
public boolean initialize(RefactoringProcessor processor, Object element, RefactoringArguments arguments)
This method isn't intended to be extended or reimplemented by clients.
processor
- the processor this participant is associated withelement
- the element to be refactoredarguments
- the refactoring arguments
true
if the participant could be initialized;
otherwise false
is returned. If false
is
returned then the participant will not be added to the refactoring.initialize(Object)
protected abstract boolean initialize(Object element)
false
then the framework
will consider the participant as not being initialized and the
participant will be dropped by the framework.
element
- the element to be refactored
true
if the participant could be initialized;
otherwise false
is returned.protected abstract void initialize(RefactoringArguments arguments)
arguments
- the refactoring argumentspublic abstract String getName()
public abstract RefactoringStatus checkConditions(IProgressMonitor pm, CheckConditionsContext context) throws OperationCanceledException
The refactoring 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 checks
RefactoringStatus#FATAL
the refactoring is considered as not being executable.
OperationCanceledException
- if the condition checking got canceledRefactoring.checkInitialConditions(IProgressMonitor)
,
RefactoringStatus.FATAL
public abstract Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException
Change
object that contains the workspace modifications
of this participant. The changes provided by a participant must
not conflict with any change provided by other participants or by the
refactoring itself.
If the change conflicts with any change provided by other participants or by the refactoring itself then change execution will fail and the participant will be disabled for the rest of the eclipse session.
If an exception occurs while creating the change the refactoring can not be carried out and the participant will be disabled for the rest of the eclipse session.
As of 3.1 a participant can manipulate text resource already manipulated by
the processor as long as the textual manipulations don't conflict (e.g.
the participant manipulates a different region of the text resource).
The method must not return those changes in its change tree since the change
is already part of another change tree. If the participant only manipulates
shared changes then it can return null
to indicate that it didn't
create own changes. A shared text change can be access via the method
getTextChange(Object)
.
pm
- a progress monitor to report progress
null
if no changes are made
CoreException
- if an error occurred while creating the change
OperationCanceledException
- if the condition checking got canceledpublic 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 element
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.