Package org.eclipse.jdt.core.manipulation

# Class CodeStyleConfiguration

java.lang.Object
org.eclipse.jdt.core.manipulation.CodeStyleConfiguration

public class CodeStyleConfiguration extends Object
Gives access to the import rewrite configured with the settings as specified in the user interface. These settings are kept in JDT UI for compatibility reasons.

This class is not intended to be subclassed or instantiated by clients.

Since:
  1.10
Restriction:
  This class is not intended to be subclassed by clients.
Restriction:
  This class is not intended to be instantiated by clients.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`ORGIMPORTS_IMPORTORDER`
A named preference that holds a list of semicolon separated package names.
`static final String`
`ORGIMPORTS_ONDEMANDTHRESHOLD`
A named preference that specifies the number of imports added before a star-import declaration is used.
`static final String`
`ORGIMPORTS_STATIC_ONDEMANDTHRESHOLD`
A named preference that specifies the number of static imports added before a star-import declaration is used.

## Method Summary

Modifier and Type
Method
Description
`static ImportRewrite`
`createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports)`
Returns a `ImportRewrite` using `ImportRewrite.create(CompilationUnit, boolean)` and configures the rewriter with the settings as specified in the JDT UI preferences.
`static ImportRewrite`
`createImportRewrite(ICompilationUnit cu, boolean restoreExistingImports)`
Returns a `ImportRewrite` using `ImportRewrite.create(ICompilationUnit, boolean)` and configures the rewriter with the settings as specified in the JDT UI preferences.

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

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

## Field Details

### ORGIMPORTS_IMPORTORDER

public static final String ORGIMPORTS_IMPORTORDER
A named preference that holds a list of semicolon separated package names. The list specifies the import order used by the "Organize Imports" operation.

Value is of type `String`: semicolon separated list of package names

See Also:
  - Constant Field Values

### ORGIMPORTS_ONDEMANDTHRESHOLD

public static final String ORGIMPORTS_ONDEMANDTHRESHOLD
A named preference that specifies the number of imports added before a star-import declaration is used.

Value is of type `Integer`: positive value specifying the number of non star-import is used

See Also:
  - Constant Field Values

### ORGIMPORTS_STATIC_ONDEMANDTHRESHOLD

public static final String ORGIMPORTS_STATIC_ONDEMANDTHRESHOLD
A named preference that specifies the number of static imports added before a star-import declaration is used.

Value is of type `Integer`: positive value specifying the number of non star-import is used

See Also:
  - Constant Field Values

## Method Details

### createImportRewrite

public static ImportRewrite createImportRewrite(ICompilationUnit cu, boolean restoreExistingImports) throws JavaModelException
Returns a `ImportRewrite` using `ImportRewrite.create(ICompilationUnit, boolean)` and configures the rewriter with the settings as specified in the JDT UI preferences.

Parameters:
  `cu` - the compilation unit to create the rewriter on
  `restoreExistingImports` - specifies if the existing imports should be kept or removed.
Returns:
  the new rewriter configured with the settings as specified in the JDT UI preferences.
Throws:
  `JavaModelException` - thrown when the compilation unit could not be accessed.
See Also:
  - `ImportRewrite.create(ICompilationUnit, boolean)`

### createImportRewrite

public static ImportRewrite createImportRewrite(CompilationUnit astRoot, boolean restoreExistingImports)
Returns a `ImportRewrite` using `ImportRewrite.create(CompilationUnit, boolean)` and configures the rewriter with the settings as specified in the JDT UI preferences.

Parameters:
  `astRoot` - the AST root to create the rewriter on
  `restoreExistingImports` - specifies if the existing imports should be kept or removed.
Returns:
  the new rewriter configured with the settings as specified in the JDT UI preferences.
See Also:
  - `ImportRewrite.create(CompilationUnit, boolean)`