Class OrganizeImportsOperation
java.lang.Object
org.eclipse.jdt.core.manipulation.OrganizeImportsOperation
- All Implemented Interfaces:
IWorkspaceRunnable
,ICoreRunnable
- Since:
- 1.10
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionOrganizeImportsOperation
(ICompilationUnit cu, CompilationUnit astRoot, boolean ignoreLowerCaseNames, boolean save, boolean allowSyntaxErrors, OrganizeImportsOperation.IChooseImportQuery chooseImportQuery) Creates a new OrganizeImportsOperation operation.OrganizeImportsOperation
(ICompilationUnit cu, CompilationUnit astRoot, boolean ignoreLowerCaseNames, boolean save, boolean allowSyntaxErrors, OrganizeImportsOperation.IChooseImportQuery chooseImportQuery, boolean restoreExistingImports) Creates a new OrganizeImportsOperation operation. -
Method Summary
Modifier and TypeMethodDescriptionint
int
After executing the operation, returnsnull
if the operation has been executed successfully or the range where parsing failed.void
run
(IProgressMonitor monitor) Runs the operation.
-
Constructor Details
-
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
-
OrganizeImportsOperation
public OrganizeImportsOperation(ICompilationUnit cu, CompilationUnit astRoot, boolean ignoreLowerCaseNames, boolean save, boolean allowSyntaxErrors, OrganizeImportsOperation.IChooseImportQuery chooseImportQuery, boolean restoreExistingImports) 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 anythingrestoreExistingImports
- when true, the operation will restore existing imports- Since:
- 1.17
-
-
Method Details
-
run
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
-
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
- Returns:
- Returns the scheduling rule for this operation
-