Package com.intellij.psi.codeStyle

Examples of com.intellij.psi.codeStyle.JavaCodeStyleManager


            PsiModifierList modifierList = modifierListOwner.getModifierList();
            modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() );
        }

        // Shorten all class references if possible
        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
        codeStyleManager.shortenClassReferences( newMixinsAnnotation );

        return newMixinsAnnotation;
    }
View Full Code Here


            PsiModifierList modifierList = modifierListOwner.getModifierList();
            modifierList.addBefore( newConcernsAnnotation, modifierList.getFirstChild() );
        }

        // Shorten all class references if possible
        JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project );
        codeStyleManager.shortenClassReferences( newConcernsAnnotation );

        return newConcernsAnnotation;
    }
View Full Code Here

          return EMPTY_ARRAY;
        }

        final Project project = psiClass.getProject();
        final PsiClassType classType = PsiTypesUtil.getClassType(psiClass);
        final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(project);
        final SuggestedNameInfo info = codeStyleManager.suggestVariableName(VariableKind.LOCAL_VARIABLE, null, null, classType);

        final Set<String> variants = new HashSet<String>(Arrays.asList(info.names));
        variants.remove(ACTION_SUFFIX);

        // remove existing action-names
View Full Code Here

      final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(project).getElementFactory();
      PsiMethod actionMethod = elementFactory.createMethodFromText("public java.lang.String " + methodName + "() throws java.lang.Exception { return \"success\"; }",
                                                                   actionClass);

      final JavaCodeStyleManager javaCodeStyleManager = JavaCodeStyleManager.getInstance(project);
      actionMethod = (PsiMethod) javaCodeStyleManager.shortenClassReferences(actionMethod);
      final CodeStyleManager codestylemanager = CodeStyleManager.getInstance(project);
      actionMethod = (PsiMethod) codestylemanager.reformat(actionMethod);

      final PsiMethod element = (PsiMethod) actionClass.add(actionMethod);
View Full Code Here

  private void addAnnotation(@NotNull PsiModifierListOwner targetElement, @NotNull PsiAnnotation newPsiAnnotation,
                             @NotNull Class<? extends Annotation> annotationClass) {
    final PsiAnnotation presentAnnotation = PsiAnnotationUtil.findAnnotation(targetElement, annotationClass);

    final Project project = targetElement.getProject();
    final JavaCodeStyleManager javaCodeStyleManager = JavaCodeStyleManager.getInstance(project);
    javaCodeStyleManager.shortenClassReferences(newPsiAnnotation);

    if (null == presentAnnotation) {
      PsiModifierList modifierList = targetElement.getModifierList();
      if (null != modifierList) {
        modifierList.addAfter(newPsiAnnotation, null);
View Full Code Here

TOP

Related Classes of com.intellij.psi.codeStyle.JavaCodeStyleManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.