Examples of PsiAnnotation


Examples of com.intellij.psi.PsiAnnotation

*/
public class PsiQuickFixFactory {
  public static AddAnnotationFix createAddAnnotationQuickFix(@NotNull PsiClass psiClass, @NotNull String annotationFQN, @Nullable String annotationParam) {
    PsiElementFactory elementFactory = JavaPsiFacade.getInstance(psiClass.getProject()).getElementFactory();

    PsiAnnotation newAnnotation = elementFactory.createAnnotationFromText("@" + annotationFQN + "(" + StringUtil.notNullize(annotationParam) + ")", psiClass);

    final PsiNameValuePair[] attributes = newAnnotation.getParameterList().getAttributes();

    return new AddAnnotationFix(annotationFQN, psiClass, attributes);
  }
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

* @author Plushnikov Michail
*/
public class PsiQuickFixFactory {
  public static LocalQuickFix createAddAnnotationQuickFix(@NotNull PsiClass psiClass, @NotNull String annotationFQN, @Nullable String annotationParam) {
    PsiElementFactory elementFactory = JavaPsiFacade.getInstance(psiClass.getProject()).getElementFactory();
    PsiAnnotation newAnnotation = elementFactory.createAnnotationFromText("@" + annotationFQN + "(" + StringUtil.notNullize(annotationParam) + ")", psiClass);
    final PsiNameValuePair[] attributes = newAnnotation.getParameterList().getAttributes();

    final BuildNumber buildNumber = ApplicationInfo.getInstance().getBuild();
    switch (IntelliJVersionRangeUtil.getIntelliJVersion(buildNumber)) {
      case INTELLIJ_8:
        throw new RuntimeException(String.format("This version (%s) of IntelliJ is not supported!", buildNumber.asString()));
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

          }

          if (null != myNewValue) {
            //add new parameter
            final PsiElementFactory elementFactory = JavaPsiFacade.getInstance(myAnnotation.getProject()).getElementFactory();
            PsiAnnotation newAnnotation = elementFactory.createAnnotationFromText("@" + myAnnotation.getQualifiedName() + "(" + myName + "=" + myNewValue + ")", myAnnotation.getContext());
            final PsiNameValuePair[] attributes = newAnnotation.getParameterList().getAttributes();

            myAnnotation.setDeclaredAttributeValue(attributes[0].getName(), attributes[0].getValue());
          }

          UndoUtil.markPsiFileForUndo(file);
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
                                                 @NotNull InspectionManager manager,
                                                 boolean isOnTheFly )
    {
        // If class does not have @Concerns, ignore
        PsiAnnotation concernsAnnotation = getConcernsAnnotation( psiClass );
        if( concernsAnnotation == null )
        {
            return null;
        }
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

    @Override
    public ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
                                           @NotNull InspectionManager manager,
                                           boolean isOnTheFly )
    {
        PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass );
        if( mixinsAnnotation == null )
        {
            return null;
        }
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

        this.annotation = annotationToReplace;
    }

    public final void applyFix( @NotNull Project project, @NotNull ProblemDescriptor descriptor )
    {
        PsiAnnotation structureAnnotation = createStructureAnnotation( project, annotation );
        annotation.replace( structureAnnotation );
    }
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

     */
    @NotNull
    public static ServiceAnnotationDeclarationValidationResult isValidServiceAnnotationDeclaration(
        @NotNull PsiVariable variable )
    {
        PsiAnnotation serviceAnnotation = getServiceAnnotation( variable );
        if( serviceAnnotation == null )
        {
            return invalidServiceAnnotationNotDeclared;
        }

View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

    @Override
    public final ProblemDescriptor[] checkField( @NotNull PsiField field,
                                                 @NotNull InspectionManager manager,
                                                 boolean isOnTheFly )
    {
        PsiAnnotation annotationToCheck = getAnnotationToCheck( field );
        if( annotationToCheck == null )
        {
            return null;
        }
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

        if( method.isConstructor() )
        {
            List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
            for( PsiParameter parameter : parameters )
            {
                PsiAnnotation annotation = getAnnotationToCheck( parameter );
                if( annotation != null )
                {
                    ProblemDescriptor[] descriptors =
                        verifyAnnotationDeclaredCorrectly( parameter, annotation, manager );
                    if( descriptors != null )
                    {
                        problems.addAll( asList( descriptors ) );
                    }
                }
            }

            return problems.toArray( new ProblemDescriptor[problems.size()] );
        }
        else
        {
            List<ProblemDescriptor> problems = new LinkedList<ProblemDescriptor>();
            for( PsiParameter parameter : parameters )
            {
                PsiAnnotation annotationToCheck = getAnnotationToCheck( parameter );
                if( annotationToCheck != null )
                {
                    String message = getInjectionAnnotationValidDeclarationMessage();
                    AbstractFix removeAnnotationFix = createRemoveAnnotationFix( annotationToCheck );
                    ProblemDescriptor problemDescriptor = manager.createProblemDescriptor(
View Full Code Here

Examples of com.intellij.psi.PsiAnnotation

    public final ProblemDescriptor[] checkClass( @NotNull PsiClass psiClass,
                                                 @NotNull InspectionManager manager,
                                                 boolean isOnTheFly )
    {
        // If class does not have @SideEffects, ignore
        PsiAnnotation sideEffectsAnnotation = getSideEffectsAnnotation( psiClass );
        if( sideEffectsAnnotation == null )
        {
            return null;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.