public final class ImportRewriteAnalyzer
extends java.lang.Object
Operates in either of two modes (selected via ImportRewriteConfiguration.Builder's
static factory methods):
| Modifier and Type | Class and Description |
|---|---|
static class |
ImportRewriteAnalyzer.RewriteResult
Encapsulates, for a computed import rewrite, a
TextEdit that can be applied to effect
the rewrite as well as the names of imports created by the rewrite. |
| Constructor and Description |
|---|
ImportRewriteAnalyzer(ICompilationUnit cu,
CompilationUnit astRoot,
ImportRewriteConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
void |
addImport(boolean isStatic,
java.lang.String qualifiedName)
Specifies that applying the rewrite should result in the compilation unit containing the
specified import.
|
ImportRewriteAnalyzer.RewriteResult |
analyzeRewrite(IProgressMonitor monitor)
Computes and returns the result of performing the rewrite, incorporating all changes
specified by calls to
addImport(boolean, java.lang.String), removeImport(boolean, java.lang.String), and
requireExplicitImport(boolean, java.lang.String). |
void |
removeImport(boolean isStatic,
java.lang.String qualifiedName)
Specifies that applying the rewrite should result in the compilation unit not containing the
specified import.
|
void |
requireExplicitImport(boolean isStatic,
java.lang.String simpleName)
Specifies that any import of the given simple name must be explicit - that it may neither be
reduced into an on-demand (".*") import nor be filtered as an implicit (e.g.
|
public ImportRewriteAnalyzer(ICompilationUnit cu, CompilationUnit astRoot, ImportRewriteConfiguration configuration) throws JavaModelException
JavaModelExceptionpublic void addImport(boolean isStatic,
java.lang.String qualifiedName)
Has no effect if the compilation unit otherwise would contain the given import.
Overrides any previous corresponding call to removeImport(boolean, java.lang.String).
public void removeImport(boolean isStatic,
java.lang.String qualifiedName)
Has no effect if the compilation unit otherwise would not contain the given import.
Overrides any previous corresponding call to addImport(boolean, java.lang.String).
public void requireExplicitImport(boolean isStatic,
java.lang.String simpleName)
public ImportRewriteAnalyzer.RewriteResult analyzeRewrite(IProgressMonitor monitor) throws JavaModelException
addImport(boolean, java.lang.String), removeImport(boolean, java.lang.String), and
requireExplicitImport(boolean, java.lang.String).
This method has no side-effects.
JavaModelException