Klasse ImportRewriteAnalyzer
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.dom.rewrite.imports.ImportRewriteAnalyzer
Allows the caller to specify imports to be added to or removed from a compilation unit and
creates a TextEdit which, applied to the compilation unit, effects the specified additions and
removals.
Operates in either of two modes (selected via ImportRewriteConfiguration.Builder
's
static factory methods):
- Discarding original imports and totally sorting all imports added thereafter. This mode is used by the Organize Imports operation.
- Preserving original imports and placing each added import adjacent to the one most closely matching it. This mode is used e.g. when Content Assist adds an import for a completed name.
-
Verschachtelte Klassen - Übersicht
Modifizierer und TypKlasseBeschreibungstatic final class
Encapsulates, for a computed import rewrite, aTextEdit
that can be applied to effect the rewrite as well as the names of imports created by the rewrite. -
Konstruktorübersicht
KonstruktorBeschreibungImportRewriteAnalyzer
(ICompilationUnit cu, CompilationUnit astRoot, ImportRewriteConfiguration configuration) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Specifies that applying the rewrite should result in the compilation unit containing the specified import.analyzeRewrite
(org.eclipse.core.runtime.IProgressMonitor monitor) Computes and returns the result of performing the rewrite, incorporating all changes specified by calls toaddImport(boolean, java.lang.String)
,removeImport(boolean, java.lang.String)
, andrequireExplicitImport(boolean, java.lang.String)
.void
removeImport
(boolean isStatic, String qualifiedName) Specifies that applying the rewrite should result in the compilation unit not containing the specified import.void
requireExplicitImport
(boolean isStatic, 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.
-
Konstruktordetails
-
ImportRewriteAnalyzer
public ImportRewriteAnalyzer(ICompilationUnit cu, CompilationUnit astRoot, ImportRewriteConfiguration configuration) throws JavaModelException - Löst aus:
JavaModelException
-
-
Methodendetails
-
addImport
Specifies that applying the rewrite should result in the compilation unit containing the specified import.Has no effect if the compilation unit otherwise would contain the given import.
Overrides any previous corresponding call to
removeImport(boolean, java.lang.String)
. -
removeImport
Specifies that applying the rewrite should result in the compilation unit not containing the specified import.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)
. -
requireExplicitImport
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. "java.lang.*") import. -
analyzeRewrite
public ImportRewriteAnalyzer.RewriteResult analyzeRewrite(org.eclipse.core.runtime.IProgressMonitor monitor) throws JavaModelException Computes and returns the result of performing the rewrite, incorporating all changes specified by calls toaddImport(boolean, java.lang.String)
,removeImport(boolean, java.lang.String)
, andrequireExplicitImport(boolean, java.lang.String)
.This method has no side-effects.
- Löst aus:
JavaModelException
-