Package org.eclipse.jdt.ui.cleanup
Interface ICleanUp
public interface ICleanUp
A clean up solves problems in a compilation unit.
The clean up is asked for its requirements through a call to getRequirements()
. The
clean up can request an AST and define how to build this AST. It can base its requirements on the
options passed through setOptions(CleanUpOptions)
.
A context containing the information requested by the requirements are passed to
createFix(CleanUpContext)
. A fix capable of fixing the problems is returned by this
function if checkPreConditions(IJavaProject, ICompilationUnit[], IProgressMonitor)
has
returned a non fatal error status.
At the end checkPostConditions(IProgressMonitor)
is called.
- Since:
- 1.21
-
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.ltk.core.refactoring.RefactoringStatus
checkPostConditions
(org.eclipse.core.runtime.IProgressMonitor monitor) Called when done cleaning up.org.eclipse.ltk.core.refactoring.RefactoringStatus
checkPreConditions
(IJavaProject project, ICompilationUnit[] compilationUnits, org.eclipse.core.runtime.IProgressMonitor monitor) After call to checkPreConditions clients will start creating fixes forcompilationUnits
inproject
unless the result of checkPreConditions contains a fatal errorcreateFix
(CleanUpContext context) Create anICleanUpFix
which fixes all problems incontext
ornull
if nothing to fix.The requirements of this clean up.String[]
Human readable description for each step this clean up will execute.void
setOptions
(CleanUpOptions options) Sets the options that will be used.
-
Method Details
-
setOptions
Sets the options that will be used.- Parameters:
options
- the options to use
-
getStepDescriptions
String[] getStepDescriptions()Human readable description for each step this clean up will execute.Note: This method must only be called after the options have been set.
- Returns:
- descriptions an array of strings or
null
-
getRequirements
CleanUpRequirements getRequirements()The requirements of this clean up.Note: This method must only be called after the options have been set.
- Returns:
- the requirements used for
createFix(CleanUpContext)
to work
-
checkPreConditions
org.eclipse.ltk.core.refactoring.RefactoringStatus checkPreConditions(IJavaProject project, ICompilationUnit[] compilationUnits, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException After call to checkPreConditions clients will start creating fixes forcompilationUnits
inproject
unless the result of checkPreConditions contains a fatal error- Parameters:
project
- the project to clean upcompilationUnits
- an array of compilation units to clean up, all member ofproject
monitor
- the monitor to show progress- Returns:
- the result of the precondition check
- Throws:
org.eclipse.core.runtime.CoreException
- if an unexpected error occurred
-
createFix
Create anICleanUpFix
which fixes all problems incontext
ornull
if nothing to fix.- Parameters:
context
- a context containing all information requested bygetRequirements()
- Returns:
- the fix for the problems or
null
if nothing to fix - Throws:
org.eclipse.core.runtime.CoreException
- if an unexpected error occurred
-
checkPostConditions
org.eclipse.ltk.core.refactoring.RefactoringStatus checkPostConditions(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException Called when done cleaning up.- Parameters:
monitor
- the monitor to show progress- Returns:
- the result of the postcondition check, not null
- Throws:
org.eclipse.core.runtime.CoreException
- if an unexpected error occurred
-