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


Java Annotation.getSeverity方法代碼示例

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


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

示例1: convertToProblemDescriptors

import com.intellij.lang.annotation.Annotation; //導入方法依賴的package包/類
@NotNull
private static ProblemDescriptor[] convertToProblemDescriptors(@NotNull final List<Annotation> annotations,
                                                               @NotNull final InspectionManager manager,
                                                               @NotNull final PsiFile file) {
  if (annotations.isEmpty()) {
    return ProblemDescriptor.EMPTY_ARRAY;
  }

  List<ProblemDescriptor> problems = ContainerUtil.newArrayListWithCapacity(annotations.size());
  IdentityHashMap<IntentionAction, LocalQuickFix> quickFixMappingCache = ContainerUtil.newIdentityHashMap();
  for (Annotation annotation : annotations) {
    if (annotation.getSeverity() == HighlightSeverity.INFORMATION ||
        annotation.getStartOffset() == annotation.getEndOffset()) {
      continue;
    }

    final PsiElement startElement = file.findElementAt(annotation.getStartOffset());
    final PsiElement endElement = file.findElementAt(annotation.getEndOffset() - 1);
    if (startElement == null || endElement == null) {
      continue;
    }

    LocalQuickFix[] quickFixes = toLocalQuickFixes(annotation.getQuickFixes(), quickFixMappingCache);
    ProblemDescriptor descriptor = manager.createProblemDescriptor(startElement,
                                                                   endElement,
                                                                   annotation.getMessage(),
                                                                   ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                                   false,
                                                                   quickFixes);
    problems.add(descriptor);
  }
  return problems.toArray(new ProblemDescriptor[problems.size()]);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:34,代碼來源:ExternalAnnotatorInspectionVisitor.java

示例2: fromAnnotation

import com.intellij.lang.annotation.Annotation; //導入方法依賴的package包/類
@NotNull
static HighlightInfo fromAnnotation(@NotNull Annotation annotation, @Nullable TextRange fixedRange, boolean batchMode) {
  final TextAttributes forcedAttributes = annotation.getEnforcedTextAttributes();
  TextAttributesKey key = annotation.getTextAttributes();
  final TextAttributesKey forcedAttributesKey = forcedAttributes == null ? (key == HighlighterColors.NO_HIGHLIGHTING ? null : key) : null;

  HighlightInfo info = new HighlightInfo(forcedAttributes, forcedAttributesKey, convertType(annotation),
                                         fixedRange != null? fixedRange.getStartOffset() : annotation.getStartOffset(),
                                         fixedRange != null? fixedRange.getEndOffset() : annotation.getEndOffset(),
                                         annotation.getMessage(), annotation.getTooltip(),
                                         annotation.getSeverity(), annotation.isAfterEndOfLine(), annotation.needsUpdateOnTyping(), annotation.isFileLevelAnnotation(),
                                         0, annotation.getProblemGroup(), annotation.getGutterIconRenderer());
  appendFixes(fixedRange, info, batchMode ? annotation.getBatchFixes() : annotation.getQuickFixes());
  return info;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:16,代碼來源:HighlightInfo.java


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