Codota Logo
JavaCodeStyleManager.shortenClassReferences
Code IndexAdd Codota 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)

  • Common ways to obtain JavaCodeStyleManager
private void myMethod () {
JavaCodeStyleManager j =
  • Codota IconStyle.JavaCodeStyleManager javaCodeStyleManager;Project project;javaCodeStyleManager.getInstance(project)
  • Smart code suggestions by Codota
}
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
  • onCreateOptionsMenu (Activity)
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BufferedInputStream (java.io)
    Wraps an existing InputStream and buffers the input. Expensive interaction with the underlying input
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JFrame (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now