本文整理汇总了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()]);
}
示例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;
}