本文整理汇总了Java中com.intellij.lang.annotation.HighlightSeverity.INFORMATION属性的典型用法代码示例。如果您正苦于以下问题:Java HighlightSeverity.INFORMATION属性的具体用法?Java HighlightSeverity.INFORMATION怎么用?Java HighlightSeverity.INFORMATION使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.annotation.HighlightSeverity
的用法示例。
在下文中一共展示了HighlightSeverity.INFORMATION属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runXmlFileSchemaValidation
private Map<ProblemDescriptor, HighlightDisplayLevel> runXmlFileSchemaValidation(@NotNull XmlFile xmlFile) {
final AnnotationHolderImpl holder = new AnnotationHolderImpl(new AnnotationSession(xmlFile));
final List<ExternalAnnotator> annotators = ExternalLanguageAnnotators.allForFile(StdLanguages.XML, xmlFile);
for (ExternalAnnotator<?, ?> annotator : annotators) {
processAnnotator(xmlFile, holder, annotator);
}
if (!holder.hasAnnotations()) return Collections.emptyMap();
Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
for (final Annotation annotation : holder) {
final HighlightInfo info = HighlightInfo.fromAnnotation(annotation);
if (info.getSeverity() == HighlightSeverity.INFORMATION) continue;
final PsiElement startElement = xmlFile.findElementAt(info.startOffset);
final PsiElement endElement = info.startOffset == info.endOffset ? startElement : xmlFile.findElementAt(info.endOffset - 1);
if (startElement == null || endElement == null) continue;
final ProblemDescriptor descriptor =
myInspectionManager.createProblemDescriptor(startElement, endElement, info.getDescription(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
false);
final HighlightDisplayLevel level = info.getSeverity() == HighlightSeverity.ERROR? HighlightDisplayLevel.ERROR: HighlightDisplayLevel.WARNING;
problemsMap.put(descriptor, level);
}
return problemsMap;
}
示例2: highlightTypeFromDescriptor
@NotNull
public static HighlightInfoType highlightTypeFromDescriptor(@NotNull ProblemDescriptor problemDescriptor,
@NotNull HighlightSeverity severity,
@NotNull SeverityRegistrar severityRegistrar) {
final ProblemHighlightType highlightType = problemDescriptor.getHighlightType();
switch (highlightType) {
case GENERIC_ERROR_OR_WARNING:
return severityRegistrar.getHighlightInfoTypeBySeverity(severity);
case LIKE_DEPRECATED:
return new HighlightInfoType.HighlightInfoTypeImpl(severity, HighlightInfoType.DEPRECATED.getAttributesKey());
case LIKE_UNKNOWN_SYMBOL:
if (severity == HighlightSeverity.ERROR) {
return new HighlightInfoType.HighlightInfoTypeImpl(severity, HighlightInfoType.WRONG_REF.getAttributesKey());
}
if (severity == HighlightSeverity.WARNING) {
return new HighlightInfoType.HighlightInfoTypeImpl(severity, CodeInsightColors.WEAK_WARNING_ATTRIBUTES);
}
return severityRegistrar.getHighlightInfoTypeBySeverity(severity);
case LIKE_UNUSED_SYMBOL:
return new HighlightInfoType.HighlightInfoTypeImpl(severity, HighlightInfoType.UNUSED_SYMBOL.getAttributesKey());
case INFO:
return HighlightInfoType.INFO;
case WEAK_WARNING:
return HighlightInfoType.WEAK_WARNING;
case ERROR:
return HighlightInfoType.WRONG_REF;
case GENERIC_ERROR:
return HighlightInfoType.ERROR;
case INFORMATION:
final TextAttributesKey attributes = ((ProblemDescriptorBase)problemDescriptor).getEnforcedTextAttributes();
if (attributes != null) {
return new HighlightInfoType.HighlightInfoTypeImpl(HighlightSeverity.INFORMATION, attributes);
}
return HighlightInfoType.INFORMATION;
}
throw new RuntimeException("Cannot map " + highlightType);
}
示例3: convertToProblemDescriptors
@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()]);
}
示例4: getHighlightInfoTypeBySeverity
@NotNull
public HighlightInfoType.HighlightInfoTypeImpl getHighlightInfoTypeBySeverity(@NotNull HighlightSeverity severity) {
HighlightInfoType infoType = STANDARD_SEVERITIES.get(severity.getName());
if (infoType != null) {
return (HighlightInfoType.HighlightInfoTypeImpl)infoType;
}
if (severity == HighlightSeverity.INFORMATION){
return (HighlightInfoType.HighlightInfoTypeImpl)HighlightInfoType.INFORMATION;
}
final SeverityBasedTextAttributes type = getAttributesBySeverity(severity);
return (HighlightInfoType.HighlightInfoTypeImpl)(type == null ? HighlightInfoType.WARNING : type.getType());
}
示例5: accept
@Override
public boolean accept(@NotNull HighlightInfo info, PsiFile file) {
if (Holder.ourTestMode) return true; // Tests need to verify highlighting is applied no matter what attributes are defined for this kind of highlighting
TextAttributes attributes = info.getTextAttributes(file, null);
// optimization
return attributes == TextAttributes.ERASE_MARKER || attributes != null &&
!(attributes.isEmpty() && info.getSeverity() == HighlightSeverity.INFORMATION && info.getGutterIconRenderer() == null);
}
示例6: isGotoBySeverityEnabled
public boolean isGotoBySeverityEnabled(HighlightSeverity minSeverity) {
return minSeverity != HighlightSeverity.INFORMATION;
}
示例7: isGotoBySeverityEnabled
public static boolean isGotoBySeverityEnabled(@NotNull HighlightSeverity minSeverity) {
for (SeveritiesProvider provider : Extensions.getExtensions(SeveritiesProvider.EP_NAME)) {
if (provider.isGotoBySeverityEnabled(minSeverity)) return true;
}
return minSeverity != HighlightSeverity.INFORMATION;
}