public class ImportHelper
extends java.lang.Object
Constructor and Description |
---|
ImportHelper(CodeStyleSettings settings)
Deprecated.
Use
ImportHelper(JavaCodeStyleSettings) instead. The instance of JavaCodeStyleSettings
can be obtained using JavaCodeStyleSettings.getInstance(PsiFile) method. |
ImportHelper(JavaCodeStyleSettings settings) |
Modifier and Type | Method and Description |
---|---|
boolean |
addImport(PsiJavaFile file,
PsiClass refClass)
Adds import if it is needed.
|
static void |
collectOnDemandImports(java.util.List<? extends Pair<java.lang.String,java.lang.Boolean>> resultList,
JavaCodeStyleSettings settings,
java.util.Map<java.lang.String,java.lang.Boolean> outClassesOrPackagesToImportOnDemand) |
ASTNode |
getDefaultAnchor(PsiImportList list,
PsiImportStatementBase statement) |
int |
getEmptyLinesBetween(PsiImportStatementBase statement1,
PsiImportStatementBase statement2) |
static boolean |
hasConflictingOnDemandImport(PsiJavaFile file,
PsiClass psiClass,
java.lang.String referenceName) |
static boolean |
isAlreadyImported(PsiJavaFile file,
java.lang.String fullyQualifiedName) |
PsiImportList |
prepareOptimizeImportsResult(PsiJavaFile file) |
PsiImportList |
prepareOptimizeImportsResult(PsiJavaFile file,
java.util.function.Predicate<? super Pair<java.lang.String,java.lang.Boolean>> filter) |
static java.util.List<Pair<java.lang.String,java.lang.Boolean>> |
sortItemsAccordingToSettings(java.util.List<? extends Pair<java.lang.String,java.lang.Boolean>> names,
JavaCodeStyleSettings settings) |
public ImportHelper(JavaCodeStyleSettings settings)
@Deprecated public ImportHelper(CodeStyleSettings settings)
ImportHelper(JavaCodeStyleSettings)
instead. The instance of JavaCodeStyleSettings
can be obtained using JavaCodeStyleSettings.getInstance(PsiFile)
method.public PsiImportList prepareOptimizeImportsResult(PsiJavaFile file)
public PsiImportList prepareOptimizeImportsResult(PsiJavaFile file, java.util.function.Predicate<? super Pair<java.lang.String,java.lang.Boolean>> filter)
filter
- pretend some references do not exist so the corresponding imports may be deletedpublic static void collectOnDemandImports(java.util.List<? extends Pair<java.lang.String,java.lang.Boolean>> resultList, JavaCodeStyleSettings settings, java.util.Map<java.lang.String,java.lang.Boolean> outClassesOrPackagesToImportOnDemand)
public static java.util.List<Pair<java.lang.String,java.lang.Boolean>> sortItemsAccordingToSettings(java.util.List<? extends Pair<java.lang.String,java.lang.Boolean>> names, JavaCodeStyleSettings settings)
public boolean addImport(PsiJavaFile file, PsiClass refClass)
public static boolean isAlreadyImported(PsiJavaFile file, java.lang.String fullyQualifiedName)
public ASTNode getDefaultAnchor(PsiImportList list, PsiImportStatementBase statement)
public int getEmptyLinesBetween(PsiImportStatementBase statement1, PsiImportStatementBase statement2)
public static boolean hasConflictingOnDemandImport(PsiJavaFile file, PsiClass psiClass, java.lang.String referenceName)