Class OrganizeImportsOperation
- java.lang.Object
-
- org.eclipse.jdt.core.manipulation.OrganizeImportsOperation
-
- All Implemented Interfaces:
IWorkspaceRunnable
,ICoreRunnable
public class OrganizeImportsOperation extends Object implements IWorkspaceRunnable
- Since:
- 1.10
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
OrganizeImportsOperation.IChooseImportQuery
-
Constructor Summary
Constructors Constructor Description OrganizeImportsOperation(ICompilationUnit cu, CompilationUnit astRoot, boolean ignoreLowerCaseNames, boolean save, boolean allowSyntaxErrors, OrganizeImportsOperation.IChooseImportQuery chooseImportQuery)
Creates a new OrganizeImportsOperation operation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TextEdit
createTextEdit(IProgressMonitor m)
int
getNumberOfImportsAdded()
int
getNumberOfImportsRemoved()
IProblem
getParseError()
After executing the operation, returnsnull
if the operation has been executed successfully or the range where parsing failed.ISchedulingRule
getScheduleRule()
void
run(IProgressMonitor monitor)
Runs the operation.
-
-
-
Constructor Detail
-
OrganizeImportsOperation
public OrganizeImportsOperation(ICompilationUnit cu, CompilationUnit astRoot, boolean ignoreLowerCaseNames, boolean save, boolean allowSyntaxErrors, OrganizeImportsOperation.IChooseImportQuery chooseImportQuery)
Creates a new OrganizeImportsOperation operation.- Parameters:
cu
- The compilation unitastRoot
- the compilation unit AST nodeignoreLowerCaseNames
- when true, type names starting with a lower case are ignoredsave
- If set, the result will be savedallowSyntaxErrors
- If set, the operation will only proceed when the compilation unit has no syntax errorschooseImportQuery
- Query element to be used for UI interaction ornull
to not select anything
-
-
Method Detail
-
run
public void run(IProgressMonitor monitor) throws CoreException, OperationCanceledException
Runs the operation.- Specified by:
run
in interfaceICoreRunnable
- Specified by:
run
in interfaceIWorkspaceRunnable
- Parameters:
monitor
- the progress monitor- Throws:
CoreException
- thrown when the operation failedOperationCanceledException
- Runtime error thrown when operation is canceled.
-
createTextEdit
public TextEdit createTextEdit(IProgressMonitor m) throws CoreException, OperationCanceledException
-
getParseError
public IProblem getParseError()
After executing the operation, returnsnull
if the operation has been executed successfully or the range where parsing failed.- Returns:
- returns the parse error
-
getNumberOfImportsAdded
public int getNumberOfImportsAdded()
- Returns:
- Returns the number of import statements added for this operation
-
getNumberOfImportsRemoved
public int getNumberOfImportsRemoved()
- Returns:
- Returns the number of import statements removed for this operation
-
getScheduleRule
public ISchedulingRule getScheduleRule()
- Returns:
- Returns the scheduling rule for this operation
-
-