org.eclipse.jdt.core.manipulation

## 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
`static interface` `OrganizeImportsOperation.IChooseImportQuery`

### Constructor Summary

Constructors
Constructor and 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
`TextEdit` `createTextEdit(IProgressMonitor m)`
`int` `getNumberOfImportsAdded()`
`int` `getNumberOfImportsRemoved()`
`IProblem` `getParseError()` After executing the operation, returns `null` if the operation has been executed successfully or the range where parsing failed.
`ISchedulingRule` `getScheduleRule()`
`void` `run(IProgressMonitor monitor)` Runs the operation.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 unit
  `astRoot` - the compilation unit AST node
  `ignoreLowerCaseNames` - when true, type names starting with a lower case are ignored
  `save` - If set, the result will be saved
  `allowSyntaxErrors` - If set, the operation will only proceed when the compilation unit has no syntax errors
  `chooseImportQuery` - Query element to be used for UI interaction or `null` to not select anything

### Method Detail

#### run

    public void run(IProgressMonitor monitor)
             throws CoreException,
                    OperationCanceledException

Runs the operation.

Specified by:
  `run` in interface `IWorkspaceRunnable`
Specified by:
  `run` in interface `ICoreRunnable`
Parameters:
  `monitor` - the progress monitor
Throws:
  `CoreException` - thrown when the operation failed
  `OperationCanceledException` - Runtime error thrown when operation is canceled.

#### createTextEdit

    public TextEdit createTextEdit(IProgressMonitor m)
                            throws CoreException,
                                   OperationCanceledException

Throws:
  `CoreException`
  `OperationCanceledException`

#### getParseError

    public IProblem getParseError()

After executing the operation, returns `null` 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