本文整理汇总了Java中com.intellij.codeHighlighting.HighlightDisplayLevel.WARNING属性的典型用法代码示例。如果您正苦于以下问题:Java HighlightDisplayLevel.WARNING属性的具体用法?Java HighlightDisplayLevel.WARNING怎么用?Java HighlightDisplayLevel.WARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.codeHighlighting.HighlightDisplayLevel
的用法示例。
在下文中一共展示了HighlightDisplayLevel.WARNING属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toHighlightDisplayLevel
@Nullable
static HighlightDisplayLevel toHighlightDisplayLevel(@NotNull Severity severity) {
switch (severity) {
case ERROR:
return HighlightDisplayLevel.ERROR;
case FATAL:
return HighlightDisplayLevel.ERROR;
case WARNING:
return HighlightDisplayLevel.WARNING;
case INFORMATIONAL:
return HighlightDisplayLevel.WEAK_WARNING;
case IGNORE:
return null;
default:
LOG.error("Unknown severity " + severity);
return null;
}
}
示例2: fillErrorLevels
protected void fillErrorLevels(final ModifiableModel profile) {
InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
LOG.assertTrue(toolWrappers != null, "Profile was not correctly init");
//fill error levels
for (final String shortName : myDisplayLevelMap.keySet()) {
//key <-> short name
HighlightDisplayLevel level = myDisplayLevelMap.get(shortName);
HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
if (key == null) continue;
//set up tools for default profile
if (level != HighlightDisplayLevel.DO_NOT_SHOW) {
profile.enableTool(shortName, null, null);
}
if (level == null || level == HighlightDisplayLevel.DO_NOT_SHOW) {
level = HighlightDisplayLevel.WARNING;
}
profile.setErrorLevel(key, level, null);
}
}
示例3: getCategoryByHighlightDisplayLevel
public CompilerMessageCategory getCategoryByHighlightDisplayLevel(@NotNull final HighlightDisplayLevel severity,
@NotNull final VirtualFile virtualFile,
@NotNull final CompileContext context) {
if (severity == HighlightDisplayLevel.ERROR) return CompilerMessageCategory.ERROR;
if (severity == HighlightDisplayLevel.WARNING) return CompilerMessageCategory.WARNING;
return CompilerMessageCategory.INFORMATION;
}
示例4: 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;
}
示例5: getDefaultLevel
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
if (level == null) return HighlightDisplayLevel.WARNING;
HighlightDisplayLevel displayLevel = HighlightDisplayLevel.find(level);
if (displayLevel == null) {
LOG.error("Can't find highlight display level: " + level);
return HighlightDisplayLevel.WARNING;
}
return displayLevel;
}
示例6: getErrorLevel
@Override
public HighlightDisplayLevel getErrorLevel(@NotNull HighlightDisplayKey inspectionToolKey, PsiElement element) {
Project project = element == null ? null : element.getProject();
final ToolsImpl tools = getTools(inspectionToolKey.toString(), project);
HighlightDisplayLevel level = tools != null ? tools.getLevel(element) : HighlightDisplayLevel.WARNING;
if (!((SeverityProvider)getProfileManager()).getOwnSeverityRegistrar().isSeverityValid(level.getSeverity().getName())) {
level = HighlightDisplayLevel.WARNING;
setErrorLevel(inspectionToolKey, level, project);
}
return level;
}
示例7: apply
@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);
}
}
}
}
}
示例8: getDefaultLevel
@NotNull
@Override
public HighlightDisplayLevel getDefaultLevel() {
final Severity defaultSeverity = myIssue.getDefaultSeverity();
if (defaultSeverity == null) {
return HighlightDisplayLevel.WARNING;
}
final HighlightDisplayLevel displayLevel = toHighlightDisplayLevel(defaultSeverity);
return displayLevel != null ? displayLevel : HighlightDisplayLevel.WARNING;
}
示例9: getDefaultLevel
@NotNull
@Override
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.WARNING;
}
示例10: getDefaultLevel
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.WARNING;
}
示例11: getDefaultLevel
@Override
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.WARNING;
}
示例12: createAnnotation
@SuppressWarnings("deprecation")
@NotNull
private Annotation createAnnotation(@NotNull AnnotationHolder holder,
@NotNull String message,
@NotNull TextRange range,
@NotNull HighlightDisplayLevel displayLevel,
@NotNull Issue issue) {
// Convert from inspection severity to annotation severity
HighlightSeverity severity;
if (displayLevel == HighlightDisplayLevel.ERROR) {
severity = HighlightSeverity.ERROR;
} else if (displayLevel == HighlightDisplayLevel.WARNING) {
severity = HighlightSeverity.WARNING;
} else if (displayLevel == HighlightDisplayLevel.WEAK_WARNING) {
severity = HighlightSeverity.WEAK_WARNING;
} else if (displayLevel == HighlightDisplayLevel.INFO) {
severity = HighlightSeverity.INFO;
} else {
severity = HighlightSeverity.WARNING;
}
// Attempt to mark up as HTML? Only if available
Method createHtmlAnnotation = getCreateHtmlAnnotation();
if (createHtmlAnnotation != null) {
// Based on LocalInspectionsPass#createHighlightInfo
String link = " <a "
+"href=\"#lint/" + issue.getId() + "\""
+ (UIUtil.isUnderDarcula() ? " color=\"7AB4C9\" " : "")
+">" + DaemonBundle.message("inspection.extended.description")
+"</a> " + getShowMoreShortCut();
String tooltip = XmlStringUtil.wrapInHtml(RAW.convertTo(message, HTML) + link);
try {
return (Annotation)createHtmlAnnotation.invoke(holder, severity, range, message, tooltip);
}
catch (IllegalAccessException ignored) {
ourCreateHtmlAnnotationMethod = null;
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourCreateHtmlAnnotationMethodFailed = true;
}
catch (InvocationTargetException e) {
ourCreateHtmlAnnotationMethod = null;
//noinspection AssignmentToStaticFieldFromInstanceMethod
ourCreateHtmlAnnotationMethodFailed = true;
}
}
return holder.createAnnotation(severity, range, message);
}