當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotationHolder.createInfoAnnotation方法代碼示例

本文整理匯總了Java中com.intellij.lang.annotation.AnnotationHolder.createInfoAnnotation方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationHolder.createInfoAnnotation方法的具體用法?Java AnnotationHolder.createInfoAnnotation怎麽用?Java AnnotationHolder.createInfoAnnotation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.annotation.AnnotationHolder的用法示例。


在下文中一共展示了AnnotationHolder.createInfoAnnotation方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: annotate

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	if (!(element instanceof SQFCommand)) {
		return;
	}
	SQFCommand command = (SQFCommand) element;
	switch (command.getCommandName().toLowerCase()) {
		case "if": //fall
		case "then": //fall
		case "else": //fall
		case "for": //fall
		case "foreach": //fall
		case "switch": //fall
		case "case": //fall
		case "default": //fall
		case "while"://fall
		case "do": {
			Annotation annotation = holder.createInfoAnnotation(command, "");
			annotation.setTextAttributes(SQFSyntaxHighlighter.CONTROL_STRUCTURE_COMMAND);
			break;
		}
	}
}
 
開發者ID:kayler-renslow,項目名稱:arma-intellij-plugin,代碼行數:24,代碼來源:SQFControlStructureCommandAnnotator.java

示例2: annotate

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) {
  if (psiElement instanceof PsiField) {
    PsiField field = (PsiField) psiElement;
    final PsiFile boundForm = FormReferenceProvider.getFormFile(field);
    if (boundForm != null) {
      annotateFormField(field, boundForm, holder);
    }
  }
  else if (psiElement instanceof PsiClass) {
    PsiClass aClass = (PsiClass) psiElement;
    final List<PsiFile> formsBoundToClass = FormClassIndex.findFormsBoundToClass(aClass.getProject(), aClass);
    if (formsBoundToClass.size() > 0) {
      Annotation boundClassAnnotation = holder.createInfoAnnotation(aClass.getNameIdentifier(), null);
      boundClassAnnotation.setGutterIconRenderer(new BoundIconRenderer(aClass));
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:19,代碼來源:FormClassAnnotator.java

示例3: attachColorIcon

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
private static void attachColorIcon(final PsiElement element, AnnotationHolder holder, String attributeValueText) {
  try {
    Color color = null;
    if (attributeValueText.startsWith("#")) {
      color = ColorUtil.fromHex(attributeValueText.substring(1));
    } else {
      final String hexCode = ColorMap.getHexCodeForColorName(StringUtil.toLowerCase(attributeValueText));
      if (hexCode != null) {
        color = ColorUtil.fromHex(hexCode);
      }
    }
    if (color != null) {
      final ColorIcon icon = new ColorIcon(8, color);
      final Annotation annotation = holder.createInfoAnnotation(element, null);
      annotation.setGutterIconRenderer(new ColorIconRenderer(icon, element));
    }
  }
  catch (Exception ignored) {
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:JavaFxAnnotator.java

示例4: annotateIcon

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
private void annotateIcon(PsiElement psiElement, AnnotationHolder annotationHolder, String value) {
    if (IconIndex.getAllAvailableIcons(psiElement.getProject()).contains(value)) {
        annotationHolder.createInfoAnnotation(psiElement, null);
    } else {
        annotationHolder.createWarningAnnotation(psiElement, "Unresolved icon - this may also occur if the icon is defined in your extension, but not in the global icon registry.");
    }
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:8,代碼來源:IconAnnotator.java

示例5: annotateTranslation

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
private void annotateTranslation(PsiElement psiElement, AnnotationHolder annotationHolder, String value) {
    if (TranslationUtil.keyExists(psiElement.getProject(), value)) {
        annotationHolder.createInfoAnnotation(psiElement, null);
    } else {
        annotationHolder.createErrorAnnotation(psiElement, "Unresolved translation - this may occur if you defined the translation key only in TypoScript");
    }
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:8,代碼來源:TranslationAnnotator.java

示例6: annotate

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder annotationHolder) {
  if (element instanceof SoyTemplateBlock) {
    // Abort if values are passed with data="...", parameter are sometimes defined for the sake
    // of added documentation even when not technically used directly in the template body.
    if (element.getText().contains("data=")) {
      return;
    }

    Collection<Parameter> parameters = ParamUtils.getParamDefinitions(element);

    Collection<String> usedVariableIdentifiers =
        PsiTreeUtil.findChildrenOfType(element, IdentifierElement.class)
            .stream()
            .map(IdentifierElement::getReferences)
            .flatMap(references -> Arrays.stream(references))
            .map(PsiReference::getCanonicalText)
            .filter(id -> id.startsWith("$"))
            .map(id -> id.substring(1))
            .collect(Collectors.toList());

    for (Variable parameter : parameters) {
      boolean isMatched = false;
      for (String usedIdentifier : usedVariableIdentifiers) {
        if (usedIdentifier.startsWith(parameter.name)) {
          isMatched = true;
          break;
        }
      }

      if (!isMatched) {
        annotationHolder.createInfoAnnotation(parameter.element,
            "Parameter " + parameter.name + " is unused.");
      }
    }
  }
}
 
開發者ID:google,項目名稱:bamboo-soy,代碼行數:38,代碼來源:UnusedParameterAnnotator.java

示例7: annotate

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	if (element instanceof SQFVariable) {
		SQFVariable var = (SQFVariable) element;
		if (var.isMagicVar()) {
			Annotation a = holder.createInfoAnnotation(TextRange.from(element.getTextOffset(), var.getTextLength()), null);
			a.setTextAttributes(SQFSyntaxHighlighter.MAGIC_VAR);
		}
	}
}
 
開發者ID:kayler-renslow,項目名稱:arma-intellij-plugin,代碼行數:11,代碼來源:SQFMagicVarColorizerAnnotator.java

示例8: annotate

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
	String elementText = element.getText();
	if (elementText.length() >= 1 && elementText.charAt(0) == '#') {
		int macroNameEnd = elementText.indexOf(' ');
		Annotation a = holder.createInfoAnnotation(TextRange.from(element.getTextOffset(), macroNameEnd < 0 ? elementText.length() : macroNameEnd), null);
		a.setTextAttributes(HeaderSyntaxHighlighter.PREPROCESSOR);
	}
}
 
開發者ID:kayler-renslow,項目名稱:arma-intellij-plugin,代碼行數:10,代碼來源:PreprocessorColorizerAnnotator.java

示例9: annotate

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
/**
 * The method annotates all nodes which are used in edges but not declared explicitly
 *
 * @param element element you would like to annotate
 * @param holder  annotation holder
 */
@Override
public void annotate(@NotNull final PsiElement element, @NotNull AnnotationHolder holder) {
    if (element instanceof DotDotgraphStmtImpl) {
        for (DotId id : getNotMentionedNodeIds(element)) {
            TextRange range = new TextRange(id.getTextRange().getStartOffset(),
                    id.getTextRange().getEndOffset());
            Annotation annotation = holder.createInfoAnnotation(range, "No such such node specified in graph");
            annotation.setHighlightType(ProblemHighlightType.LIKE_UNUSED_SYMBOL);
        }

    }

}
 
開發者ID:bzixilu,項目名稱:dotplugin,代碼行數:20,代碼來源:DotAnnotator.java

示例10: extractSetValue

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
private void extractSetValue(EndpointValidationResult result, Set<String> validationSet, String fromElement, PsiElement element,
                             AnnotationHolder holder, CamelAnnotatorEndpointMessage msg, boolean lenient) {
    if (validationSet != null && (lenient || !result.isSuccess())) {

        for (String entry : validationSet) {
            String propertyValue = entry;

            int startIdxQueryParameters = fromElement.indexOf("?" + propertyValue);
            startIdxQueryParameters = (startIdxQueryParameters == -1) ? fromElement.indexOf("&" + propertyValue) : fromElement.indexOf("?");

            int propertyIdx = fromElement.indexOf(propertyValue, startIdxQueryParameters);
            int propertyLength = propertyValue.length();

            propertyIdx = getIdeaUtils().isJavaLanguage(element) || getIdeaUtils().isXmlLanguage(element)  ? propertyIdx + 1  : propertyIdx;

            TextRange range = new TextRange(element.getTextRange().getStartOffset() + propertyIdx,
                element.getTextRange().getStartOffset() + propertyIdx + propertyLength);

            if (msg.isInfoLevel()) {
                holder.createInfoAnnotation(range, summaryMessage(result, propertyValue, msg));
            } else if (msg.isWarnLevel()) {
                holder.createWarningAnnotation(range, summaryMessage(result, propertyValue, msg));
            } else {
                holder.createErrorAnnotation(range, summaryMessage(result, propertyValue, msg));
            }
        }
    }
}
 
開發者ID:camel-idea-plugin,項目名稱:camel-idea-plugin,代碼行數:29,代碼來源:CamelEndpointAnnotator.java

示例11: annotate

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
  if (element instanceof PsiDocTag) {
    String name = ((PsiDocTag)element).getName();
    if ("param".equals(name)) {
      PsiDocTagValue tagValue = ((PsiDocTag)element).getValueElement();
      if (tagValue != null) {
        Annotation annotation = holder.createInfoAnnotation(tagValue, null);
        annotation.setTextAttributes(JavaHighlightingColors.DOC_COMMENT_TAG_VALUE);
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:JavaDocAnnotator.java

示例12: apply

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void apply(@NotNull PsiFile file, MyInfo[] infos, @NotNull AnnotationHolder holder) {
  if (infos == null || infos.length == 0) {
    return;
  }

  final HighlightDisplayLevel displayLevel = getHighlightDisplayLevel(file);

  for (MyInfo info : infos) {
    if (!info.myResult) {
      final PsiElement element = info.myAnchor.retrieve();
      if (element != null) {
        final int start = element.getTextRange().getStartOffset();
        final TextRange range = new TextRange(start + info.myRangeInElement.getStartOffset(),
                                              start + info.myRangeInElement.getEndOffset());
        final String message = getErrorMessage(info.myUrl);

        final Annotation annotation;

        if (displayLevel == HighlightDisplayLevel.ERROR) {
          annotation = holder.createErrorAnnotation(range, message);
        }
        else if (displayLevel == HighlightDisplayLevel.WARNING) {
          annotation = holder.createWarningAnnotation(range, message);
        }
        else if (displayLevel == HighlightDisplayLevel.WEAK_WARNING) {
          annotation = holder.createInfoAnnotation(range, message);
        }
        else {
          annotation = holder.createWarningAnnotation(range, message);
        }

        for (IntentionAction action : getQuickFixes()) {
          annotation.registerFix(action);
        }
      }
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:40,代碼來源:WebReferencesAnnotatorBase.java

示例13: apply

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
@Override
public void apply(@NotNull PsiFile file, List<HighlightRange> ranges, @NotNull AnnotationHolder holder) {
  for (HighlightRange range : ranges) {
    if (range.getStyleClass().equals("error")) {
      holder.createErrorAnnotation(range.getTextRange(), null);
    }
    else {
      final Annotation infoAnnotation = holder.createInfoAnnotation(range.getTextRange(), null);
      infoAnnotation.setEnforcedTextAttributes(range.getTextAttributes());
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:YouTrackHighlightingAnnotator.java

示例14: checkGrDocReferenceElement

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
private static void checkGrDocReferenceElement(AnnotationHolder holder, PsiElement element) {
  ASTNode node = element.getNode();
  if (node != null && TokenSets.BUILT_IN_TYPES.contains(node.getElementType())) {
    Annotation annotation = holder.createInfoAnnotation(element, null);
    annotation.setTextAttributes(GroovySyntaxHighlighter.KEYWORD);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:GroovyAnnotator.java

示例15: setHighlighting

import com.intellij.lang.annotation.AnnotationHolder; //導入方法依賴的package包/類
protected static Annotation setHighlighting(
    @NotNull PsiElement element, @NotNull AnnotationHolder holder,
    @NotNull TextAttributesKey key) {
  Annotation annotation = holder.createInfoAnnotation(element, null);
  annotation.setEnforcedTextAttributes(EditorColorsManager.getInstance().getGlobalScheme().getAttributes(key));
  return annotation;
}
 
開發者ID:SumoLogic,項目名稱:epigraph,代碼行數:8,代碼來源:SchemaAnnotatorBase.java


注:本文中的com.intellij.lang.annotation.AnnotationHolder.createInfoAnnotation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。