Package com.intellij.lang.annotation

Examples of com.intellij.lang.annotation.Annotation


    switch (errorCode.getErrorSeverity()) {
      case NONE:
        return null;
      case INFO:
        final Annotation annotation = holder.createWeakWarningAnnotation(textRange, message.getMessage());
        if (errorCode == HintCode.UNUSED_IMPORT || errorCode == HintCode.DUPLICATE_IMPORT) {
          annotation.setHighlightType(ProblemHighlightType.LIKE_UNUSED_SYMBOL);
        }
        return annotation;
      case WARNING:
        return holder.createWarningAnnotation(textRange, message.getMessage());
      case ERROR:
View Full Code Here


    String[] files = ArrayUtil.append(additionalFiles, testName + getExtension());
    files = ArrayUtil.reverseArray(files);

    myFixture.configureByFiles(files);

    final Annotation annotation = doHighlightingAndFindIntention(message);
    assertNotNull("Can't find intention for message: " + message, annotation);

    final List<Annotation.QuickFixInfo> quickFixes = annotation.getQuickFixes();
    assertNotNull("Can't find fixes", quickFixes);
    assertFalse(quickFixes.isEmpty());

    final List<Annotation.QuickFixInfo> quickFixInfos = ContainerUtil.findAll(quickFixes, new Condition<Annotation.QuickFixInfo>() {
      @Override
View Full Code Here

        }

        String openBlockName = openBlockMustacheName.getName();
        String closeBlockName = closeBlockMustacheName.getName();
        if (!openBlockName.equals(closeBlockName)) {
          Annotation openBlockAnnotation
            = holder.createErrorAnnotation(openBlockMustacheName,
                                           HbBundle.message("hb.block.mismatch.inspection.open.block", openBlockName, closeBlockName));
          openBlockAnnotation.registerFix(new HbBlockMismatchFix(closeBlockName, openBlockName, true));
          openBlockAnnotation.registerFix(new HbBlockMismatchFix(openBlockName, closeBlockName, false));

          Annotation closeBlockAnnotation
            = holder.createErrorAnnotation(closeBlockMustacheName,
                                           HbBundle.message("hb.block.mismatch.inspection.close.block", openBlockName, closeBlockName));
          closeBlockAnnotation.registerFix(new HbBlockMismatchFix(openBlockName, closeBlockName, false));
          closeBlockAnnotation.registerFix(new HbBlockMismatchFix(closeBlockName, openBlockName, true));
        }
      }
      else {
        holder.createErrorAnnotation(openBlockMustacheName,
                                     HbBundle.message("hb.block.mismatch.inspection.missing.end.block", openBlockMustache.getName()));
View Full Code Here

        return;
      }
    }

    final boolean fileSetAvailable = allConfigFileSets.size() != 0;
    final Annotation annotation =
      holder.createWarningAnnotation(xmlFile,
                                     fileSetAvailable ?
                                     StrutsBundle.message("annotators.fileset.file.not.registered") :
                                     StrutsBundle.message("annotators.fileset.no.file.sets"));
    annotation.setFileLevelAnnotation(true);

    if (fileSetAvailable) {
      final AddToFileSetFix addToFileSetFix = new AddToFileSetFix(xmlFile.getName());
      annotation.registerFix(addToFileSetFix);
    }
    else {
      annotation.registerFix(new IntentionAction() {
        @NotNull
        public String getText() {
          return StrutsBundle.message("annotators.fileset.edit.facet.settings");
        }
View Full Code Here

      else if (JstdConfigFileUtils.isTopLevelKeyWithInnerFileSequence(keyValue)) {
        annotateKeyValueWithInnerFileSequence(keyValue, holder, basePathInfo.getBasePath());
      }
    }
    if (!visitedKeys.contains("test")) {
      Annotation annotation = holder.createWeakWarningAnnotation(yamlDocument, "JsTestDriver configuration file should have 'test:' section");
      annotation.registerFix(new AddTestSectionAction());
    }
  }
View Full Code Here

    private Annotation toAnnotation(ProblemDescriptor pd) {
        TextRange problemRange = getProblemRange(pd);
        String desc = pd.getDescriptionTemplate();

        Annotation annotation;

        switch (pd.getHighlightType()) {
            case GENERIC_ERROR_OR_WARNING:
            case ERROR:
            case GENERIC_ERROR:
            case LIKE_UNKNOWN_SYMBOL:
                annotation = annotationHolder.createErrorAnnotation(
                    problemRange, desc);
                break;

            case LIKE_DEPRECATED:
            case LIKE_UNUSED_SYMBOL: {
                annotation =
                    annotationHolder.createWeakWarningAnnotation(problemRange,
                                                                 desc);
                break;
            }

            case INFORMATION:
                annotation =
                    annotationHolder.createInfoAnnotation(problemRange, desc);
                break;

            case WEAK_WARNING:
            default:
                annotation =
                    annotationHolder.createWarningAnnotation(problemRange,
                                                             desc);
        }

        if (annotation != null) {
            annotation.setHighlightType(pd.getHighlightType());
        }

        return annotation;
    }
View Full Code Here

        return annotation;
    }

    @Override
    public void visitLiteralBool(GoLiteral<Boolean> literal) {
        Annotation ann = annotationHolder.createInfoAnnotation(literal, null);
        ann.setTextAttributes(GoSyntaxHighlighter.KEYWORD);
    }
View Full Code Here

        PsiElement definition = resolveSafely(identifier, PsiElement.class);

        if (definition == null)
            return;

        Annotation annotation =
            annotationHolder.createInfoAnnotation(identifier, null);

        if (psiElement().withParent(GoConstDeclaration.class)
            .accepts(definition)) {
            annotation.setTextAttributes(GoSyntaxHighlighter.CONST);
            return;
        }

        if (GLOBAL_VAR_DECL.accepts(definition)) {
            annotation.setTextAttributes(GoSyntaxHighlighter.GLOBAL_VARIABLE);
            return;
        }

        if (psiElement(GoTypeSpec.class).accepts(definition)) {
            annotation.setTextAttributes(GoSyntaxHighlighter.TYPE_NAME);
            return;
        }

        annotation.setTextAttributes(GoSyntaxHighlighter.VARIABLE);
    }
View Full Code Here

        annotation.setTextAttributes(GoSyntaxHighlighter.VARIABLE);
    }

    @Override
    public void visitTypeName(GoPsiTypeName typeName) {
        Annotation ann = annotationHolder.createInfoAnnotation(typeName, null);
        ann.setTextAttributes(GoSyntaxHighlighter.TYPE_NAME);
    }
View Full Code Here

        ann.setTextAttributes(GoSyntaxHighlighter.TYPE_NAME);
    }

    @Override
    public void visitTypeNameDeclaration(GoTypeNameDeclaration declaration) {
        Annotation ann = annotationHolder.createInfoAnnotation(declaration,
                                                               null);
        ann.setTextAttributes(GoSyntaxHighlighter.TYPE_NAME);
    }
View Full Code Here

TOP

Related Classes of com.intellij.lang.annotation.Annotation

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.