Package com.intellij.lang.annotation

Examples of com.intellij.lang.annotation.Annotation


    public void visitMethodDeclaration(GoMethodDeclaration declaration) {
        super.visitMethodDeclaration(declaration);

        PsiElement nameIdentifier = declaration.getNameIdentifier();
        if (nameIdentifier != null) {
            Annotation ann = annotationHolder.createInfoAnnotation(
                nameIdentifier, null);
            ann.setTextAttributes(GoSyntaxHighlighter.METHOD_DECLARATION);
        }
    }
View Full Code Here


    public void visitFunctionDeclaration(GoFunctionDeclaration declaration) {
        super.visitFunctionDeclaration(declaration);

        PsiElement nameIdentifier = declaration.getNameIdentifier();
        if (nameIdentifier != null) {
            Annotation ann = annotationHolder.createInfoAnnotation(
                nameIdentifier, null);
            ann.setTextAttributes(GoSyntaxHighlighter.METHOD_DECLARATION);
        }
    }
View Full Code Here

                String key = value.substring(7);
                List<SimpleProperty> properties = SimpleUtil.findProperties(project, key);
                if (properties.size() == 1) {
                    TextRange range = new TextRange(element.getTextRange().getStartOffset() + 7,
                            element.getTextRange().getStartOffset() + 7);
                    Annotation annotation = holder.createInfoAnnotation(range, null);
                    annotation.setTextAttributes(SyntaxHighlighterColors.LINE_COMMENT);
                } else if (properties.size() == 0) {
                    TextRange range = new TextRange(element.getTextRange().getStartOffset() + 8,
                            element.getTextRange().getEndOffset());
                    holder.createErrorAnnotation(range, "Unresolved property").
                            registerFix(new CreatePropertyQuickFix(key));
View Full Code Here

        }

        // search for possible domain targets and provide translation key creation fix
        if(StringUtils.isNotBlank(keyName) && !TranslationUtil.hasTranslationKey(psiElement.getProject(), keyName, domainName)) {

            Annotation annotationHolder = holder.createWarningAnnotation(psiElement, "Missing Translation");
            List<PsiFile> psiElements = TranslationUtil.getDomainPsiFiles(psiElement.getProject(), domainName);
            for(PsiElement psiFile: psiElements) {
                if(psiFile instanceof YAMLFile) {
                    annotationHolder.registerFix(new TranslationKeyIntentionAction((YAMLFile) psiFile, keyName));
                }
            }
        }

    }
View Full Code Here

        // get domain on file scope or method parameter
        String domainName = TwigUtil.getPsiElementTranslationDomain(psiElement);

        if(!TranslationUtil.hasTranslationKey(psiElement.getProject(), text, domainName)) {
            Annotation annotationHolder = holder.createWarningAnnotation(psiElement, "Missing Translation");
            List<PsiFile> psiElements = TranslationUtil.getDomainPsiFiles(psiElement.getProject(), domainName);
            for(PsiElement psiFile: psiElements) {
                if(psiFile instanceof YAMLFile) {
                    annotationHolder.registerFix(new TranslationKeyIntentionAction((YAMLFile) psiFile, text));
                }
            }
        }

    }
View Full Code Here

                        while (currentLine < line) {
                            currentOffset = text.indexOf("\n", currentOffset) + 1;
                            currentLine++;
                        }
                        final ErrorProcessor processor = errorBean.getProcessor();
                        final Annotation annotation = annotationHolder.createWarningAnnotation(
                                processor.getSelectionRange(text, currentOffset, errorBean),
                                processor.getMessage(errorBean));

                        for (IntentionAction intentionAction : processor.getFixes(errorBean)) {
                            annotation.registerFix(intentionAction);
                            annotation.setNeedsUpdateOnTyping(true);
                        }
                    }
                }
            }
        } catch (IOException e) {
View Full Code Here

      int width = 0;
      while (offset + width < text.length() && !StringUtil.isLineBreak(text.charAt(offset + width))) width++;

      TextRange problemRange = TextRange.create(offset, offset + width);
      String message = "Dialyzer: " + problem.myDescription;
      Annotation annotation = holder.createWarningAnnotation(problemRange, message);
      HighlightDisplayKey key = HighlightDisplayKey.find(ErlangDialyzerInspection.INSPECTION_SHORT_NAME);
      annotation.registerFix(new DisableInspectionToolAction(key) {
        @NotNull
        @Override
        public String getName() {
          return "Disable 'Dialyzer-based inspections'";
        }
View Full Code Here

  private void checkKeywordTextConsistency(ClKeyword keyword, AnnotationHolder holder) {
    String keywordText = keyword.getText();
    int index = keywordText.lastIndexOf("/");
    if ((index != -1 && keywordText.charAt(index - 1) == ':') || keywordText.endsWith(":") ||
        keywordText.substring(1).contains("::")) {
      Annotation annotation = holder.createErrorAnnotation(keyword, ClojureBundle.message("invalid.token", keywordText));
      annotation.setHighlightType(ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
      return;
    }
  }
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.