当前位置: 首页>>代码示例>>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;未经允许,请勿转载。