congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
JavaCodeStyleManager.shortenClassReferences
Code IndexAdd Tabnine to your IDE (free)

How to use
shortenClassReferences
method
in
com.intellij.psi.codeStyle.JavaCodeStyleManager

Best Java code snippets using com.intellij.psi.codeStyle.JavaCodeStyleManager.shortenClassReferences (Showing top 5 results out of 315)

origin: zzz40500/GsonFormat

protected void formatJavCode(PsiClass cls) {
  if (cls == null) {
    return;
  }
  JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(cls.getProject());
  styleManager.optimizeImports(cls.getContainingFile());
  styleManager.shortenClassReferences(cls);
}
origin: mustfun/mybatis-plus

protected PsiFile createFile(Project project, @NotNull PsiDirectory psiDirectory, String fileName, String context, LanguageFileType fileType) {
  //+        final String simpleContent = XmlSorterUtil.replaceAllByRegex(content, ">" + lineSeparator + "*\\s+?<", "><");
  String replace = context.replaceAll("\r\n", "\n");
  PsiFile file = psiDirectory.findFile(fileName);
  if (file!=null){
    file.delete();
  }
  PsiFile psiFile = PsiFileFactory.getInstance(project).createFileFromText(fileName, fileType, replace);
  // reformat class
  CodeStyleManager.getInstance(project).reformat(psiFile);
  if (psiFile instanceof PsiJavaFile) {
    JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(project);
    styleManager.optimizeImports(psiFile);
    styleManager.shortenClassReferences(psiFile);
  }
  //加载到磁盘中
  psiDirectory.add(psiFile);
  return psiFile;
}
origin: mustfun/mybatis-plus

public void addAnnotation(@NotNull PsiModifierListOwner parameter, @NotNull Annotation annotation) {
 PsiModifierList modifierList = parameter.getModifierList();
 if (JavaUtils.isAnnotationPresent(parameter, annotation) || null == modifierList) {
  return;
 }
 JavaService.getInstance(parameter.getProject()).importClazz((PsiJavaFile) parameter.getContainingFile(), annotation.getQualifiedName());
 
 PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
 PsiAnnotation psiAnnotation = elementFactory.createAnnotationFromText(annotation.toString(), parameter);
 modifierList.add(psiAnnotation);
 JavaCodeStyleManager.getInstance(project).shortenClassReferences(psiAnnotation.getParent());
}
origin: mapstruct/mapstruct-idea

    mappingMethod.getModifierList()
  );
  JavaCodeStyleManager.getInstance( project ).shortenClassReferences( inserted );
}, containingFile );
origin: mustfun/mybatis-plus

JavaCodeStyleManager.getInstance(project).shortenClassReferences(psiGetterAnnotation);
PsiAnnotation psiGetterAnnotation = elementFactory.createAnnotationFromText(Annotation.SETTER.toString(), clazz);
clazz.addBefore(psiGetterAnnotation,JavaUtils.findNealModifierElement(clazz.getFirstChild()).getFirstChild());
JavaCodeStyleManager.getInstance(project).shortenClassReferences(psiGetterAnnotation);
com.intellij.psi.codeStyleJavaCodeStyleManagershortenClassReferences

Javadoc

Replaces fully-qualified class names in the contents of the specified element with non-qualified names and adds import statements as necessary.

Popular methods of JavaCodeStyleManager

  • getInstance
  • optimizeImports
    Optimizes imports in the specified Java or JSP file.
  • propertyNameToVariableName
    Appends code style defined prefixes and/or suffixes for the specified variable kind to the specified
  • getPrefixByVariableKind
  • getVariableKind
    Returns the kind of the specified variable (local, parameter, field, static field or static final fi
  • suggestUniqueVariableName
  • suggestVariableName
  • variableNameToPropertyName
    Generates a stripped-down name (with no code style defined prefixes or suffixes, usable as a propert

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • getSupportFragmentManager (FragmentActivity)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Collectors (java.util.stream)
  • BoxLayout (javax.swing)
  • JButton (javax.swing)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now