public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager
DO_NOT_ADD_IMPORTS, INCOMPLETE_CODE| Constructor and Description | 
|---|
JavaCodeStyleManagerImpl(Project project)  | 
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
addImport(PsiJavaFile file,
         PsiClass refClass)  | 
int | 
findEntryIndex(PsiImportStatementBase statement)  | 
java.util.Collection<PsiImportStatementBase> | 
findRedundantImports(PsiJavaFile file)  | 
java.lang.String | 
getPrefixByVariableKind(VariableKind variableKind)  | 
java.lang.String | 
getSuffixByVariableKind(VariableKind variableKind)  | 
static java.lang.String | 
getTypeName(PsiType type)  | 
boolean | 
hasConflictingOnDemandImport(PsiJavaFile file,
                            PsiClass psiClass,
                            java.lang.String referenceName)
Single-static-import  
import static classFQN.referenceName; shadows on-demand static imports, like described
 JLS 6.4.1
 A single-static-import declaration d in a compilation unit c of package p that imports a {member} named n
 shadows the declaration of any static {member} named n imported by a static-import-on-demand declaration in c, throughout c. | 
void | 
optimizeImports(PsiFile file)
Optimizes imports in the specified Java or JSP file. 
 | 
PsiImportList | 
prepareOptimizeImportsResult(PsiJavaFile file)
Calculates the import list that would be substituted in the specified Java or JSP
 file if an Optimize Imports operation was performed on it. 
 | 
java.lang.String | 
propertyNameToVariableName(java.lang.String propertyName,
                          VariableKind variableKind)
Appends code style defined prefixes and/or suffixes for the specified variable kind
 to the specified variable name. 
 | 
PsiElement | 
qualifyClassReferences(PsiElement element)
Replaces all references to Java classes in the contents of the specified element,
 except for references to classes in the same package or in implicitly imported packages,
 with full-qualified references. 
 | 
void | 
removeRedundantImports(PsiJavaFile file)
Removes unused import statements from the specified Java file. 
 | 
PsiElement | 
shortenClassReferences(PsiElement element)
Replaces fully-qualified class names in the contents of the specified element with
 non-qualified names and adds import statements as necessary. 
 | 
PsiElement | 
shortenClassReferences(PsiElement element,
                      int flags)  | 
void | 
shortenClassReferences(PsiElement element,
                      int startOffset,
                      int endOffset)
Replaces fully-qualified class names in a part of contents of the specified element with
 non-qualified names and adds import statements as necessary. 
 | 
SuggestedNameInfo | 
suggestCompiledParameterName(PsiType type)
Generates compiled parameter name for given type. 
 | 
SuggestedNameInfo | 
suggestNames(java.util.Collection<java.lang.String> semanticNames,
            VariableKind kind,
            PsiType type)  | 
java.util.Collection<java.lang.String> | 
suggestSemanticNames(PsiExpression expression)
This method is not actually tied to Java Code Style. 
 | 
java.lang.String | 
suggestUniqueVariableName(java.lang.String baseName,
                         PsiElement place,
                         boolean lookForward)
Suggests a unique name for the variable used at the specified location. 
 | 
java.lang.String | 
suggestUniqueVariableName(java.lang.String baseName,
                         PsiElement place,
                         java.util.function.Predicate<? super PsiVariable> canBeReused)
Suggests a unique name for the variable used at the specified location looking forward with possible filtering. 
 | 
SuggestedNameInfo | 
suggestUniqueVariableName(SuggestedNameInfo baseNameInfo,
                         PsiElement place,
                         boolean ignorePlaceName,
                         boolean lookForward)
Suggests a unique name for the variable used at the specified location. 
 | 
SuggestedNameInfo | 
suggestVariableName(VariableKind kind,
                   java.lang.String propertyName,
                   PsiExpression expr,
                   PsiType type,
                   boolean correctKeywords)  | 
java.lang.String | 
variableNameToPropertyName(java.lang.String name,
                          VariableKind variableKind)
Generates a stripped-down name (with no code style defined prefixes or suffixes, usable as
 a property name) from the specified name of a variable of the specified kind. 
 | 
getInstance, getVariableKind, suggestUniqueVariableName, suggestVariableNamepublic JavaCodeStyleManagerImpl(Project project)
public PsiElement shortenClassReferences(PsiElement element) throws IncorrectOperationException
JavaCodeStyleManagershortenClassReferences in class JavaCodeStyleManagerelement - the element to shorten references in.IncorrectOperationException - if the file to shorten references in is read-only.public PsiElement shortenClassReferences(PsiElement element, int flags) throws IncorrectOperationException
shortenClassReferences in class JavaCodeStyleManagerIncorrectOperationExceptionpublic void shortenClassReferences(PsiElement element, int startOffset, int endOffset) throws IncorrectOperationException
JavaCodeStyleManagershortenClassReferences in class JavaCodeStyleManagerelement - the element to shorten references in.startOffset - the start offset in the element of the part where class references are shortened.endOffset - the end offset in the element of the part where class references are shortened.IncorrectOperationException - if the file to shorten references in is read-only.public PsiElement qualifyClassReferences(PsiElement element)
JavaCodeStyleManagerqualifyClassReferences in class JavaCodeStyleManagerelement - the element to replace the references in.public void optimizeImports(PsiFile file) throws IncorrectOperationException
JavaCodeStyleManageroptimizeImports in class JavaCodeStyleManagerfile - the file to optimize the imports in.IncorrectOperationException - if the file is read-only.public PsiImportList prepareOptimizeImportsResult(PsiJavaFile file)
JavaCodeStyleManagerprepareOptimizeImportsResult in class JavaCodeStyleManagerfile - the file to calculate the import list for.null when the file has no import list.public boolean hasConflictingOnDemandImport(PsiJavaFile file, PsiClass psiClass, java.lang.String referenceName)
JavaCodeStyleManagerimport static classFQN.referenceName; shadows on-demand static imports, like described
 JLS 6.4.1
 A single-static-import declaration d in a compilation unit c of package p that imports a {member} named n
 shadows the declaration of any static {member} named n imported by a static-import-on-demand declaration in c, throughout c.hasConflictingOnDemandImport in class JavaCodeStyleManagerpublic boolean addImport(PsiJavaFile file, PsiClass refClass)
addImport in class JavaCodeStyleManagerpublic void removeRedundantImports(PsiJavaFile file) throws IncorrectOperationException
JavaCodeStyleManagerremoveRedundantImports in class JavaCodeStyleManagerfile - the file to remove the import statements from.IncorrectOperationException - if the operation fails for some reason (for example, the file is read-only).public java.util.Collection<PsiImportStatementBase> findRedundantImports(PsiJavaFile file)
findRedundantImports in class JavaCodeStyleManagerpublic int findEntryIndex(PsiImportStatementBase statement)
findEntryIndex in class JavaCodeStyleManagerpublic SuggestedNameInfo suggestCompiledParameterName(PsiType type)
JavaCodeStyleManagersuggestCompiledParameterName in class JavaCodeStyleManagerpublic SuggestedNameInfo suggestVariableName(VariableKind kind, java.lang.String propertyName, PsiExpression expr, PsiType type, boolean correctKeywords)
suggestVariableName in class JavaCodeStyleManagerpublic static java.lang.String getTypeName(PsiType type)
public java.lang.String variableNameToPropertyName(java.lang.String name,
                                                   VariableKind variableKind)
JavaCodeStyleManagervariableNameToPropertyName in class JavaCodeStyleManagername - the name of the variable.variableKind - the kind of the variable.public java.lang.String propertyNameToVariableName(java.lang.String propertyName,
                                                   VariableKind variableKind)
JavaCodeStyleManagerpropertyNameToVariableName in class JavaCodeStyleManagerpropertyName - the base name of the variable.variableKind - the kind of the variable.public java.lang.String suggestUniqueVariableName(java.lang.String baseName,
                                                  PsiElement place,
                                                  boolean lookForward)
JavaCodeStyleManagersuggestUniqueVariableName in class JavaCodeStyleManagerbaseName - the base name for the variable.place - the location where the variable will be used.lookForward - if true, the existing variables are searched in both directions; if false - only backwardpublic java.lang.String suggestUniqueVariableName(java.lang.String baseName,
                                                  PsiElement place,
                                                  java.util.function.Predicate<? super PsiVariable> canBeReused)
JavaCodeStyleManagersuggestUniqueVariableName in class JavaCodeStyleManagerbaseName - the base name info for the variable.place - the location where the variable will be used.canBeReused - a predicate which returns true for variables which names still could be reused (e.g. a variable will be deleted
                    during the ongoing refactoring)public SuggestedNameInfo suggestUniqueVariableName(SuggestedNameInfo baseNameInfo, PsiElement place, boolean ignorePlaceName, boolean lookForward)
JavaCodeStyleManagersuggestUniqueVariableName in class JavaCodeStyleManagerbaseNameInfo - the base name info for the variable.place - the location where the variable will be used.ignorePlaceName - if true and place is PsiNamedElement, place.getName() would be still treated as unique namelookForward - if true, the existing variables are searched in both directions; if false - only backwardpublic java.lang.String getPrefixByVariableKind(VariableKind variableKind)
getPrefixByVariableKind in class JavaCodeStyleManagerpublic java.lang.String getSuffixByVariableKind(VariableKind variableKind)
getSuffixByVariableKind in class JavaCodeStyleManagerpublic java.util.Collection<java.lang.String> suggestSemanticNames(PsiExpression expression)
JavaCodeStyleManager
 Should be used with JavaCodeStyleManager.suggestNames(Collection, VariableKind, PsiType).
suggestSemanticNames in class JavaCodeStyleManagerpublic SuggestedNameInfo suggestNames(java.util.Collection<java.lang.String> semanticNames, VariableKind kind, PsiType type)
suggestNames in class JavaCodeStyleManager