Class RefactoringContext
- java.lang.Object
-
- org.eclipse.ltk.core.refactoring.RefactoringContext
-
public class RefactoringContext extends Object
Refactoring context is a disposable object that can be used by a refactoring to hold resources that have to be explicitly released. The refactoring context is guaranteed to receive a
dispose()
call after the associated refactoring has finished or produced an error. At this point, the refactoring context must release all resources and detach all listeners. A refactoring context can only be disposed once; it cannot be reused.This class is intended to be subclassed by clients wishing to implement new refactorings that depend on resources that have to be explicitly released.
- Since:
- 3.6
-
-
Constructor Summary
Constructors Constructor Description RefactoringContext(Refactoring refactoring)
Creates a context for the given refactoring.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Disposes of the context.Refactoring
getRefactoring()
Returns the refactoring associated with the context.
-
-
-
Constructor Detail
-
RefactoringContext
public RefactoringContext(Refactoring refactoring)
Creates a context for the given refactoring.- Parameters:
refactoring
- The refactoring associated with the context. Cannot benull
.- Throws:
NullPointerException
- if refactoring isnull
.
-
-
Method Detail
-
getRefactoring
public Refactoring getRefactoring()
Returns the refactoring associated with the context.The returned refactoring must be in an initialized state, i.e. ready to be executed via
PerformRefactoringOperation
.- Returns:
- The refactoring associated with the context.
- Restriction:
- This method is not intended to be re-implemented or extended by clients.
-
dispose
public void dispose()
Disposes of the context. This method will be called exactly once during the life cycle of the context after the associated refactoring has finished or produced an error.Subclasses may extend this method (must call super).
-
-