本文整理汇总了Java中com.intellij.codeHighlighting.HighlightDisplayLevel.WEAK_WARNING属性的典型用法代码示例。如果您正苦于以下问题:Java HighlightDisplayLevel.WEAK_WARNING属性的具体用法?Java HighlightDisplayLevel.WEAK_WARNING怎么用?Java HighlightDisplayLevel.WEAK_WARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.codeHighlighting.HighlightDisplayLevel
的用法示例。
在下文中一共展示了HighlightDisplayLevel.WEAK_WARNING属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runInspectionTool
private static Map<ProblemDescriptor, HighlightDisplayLevel> runInspectionTool(final PsiFile file,
final LocalInspectionTool inspectionTool,
final HighlightDisplayLevel level) {
Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
for (ProblemDescriptor descriptor : runInspectionOnFile(file, inspectionTool)) {
final ProblemHighlightType highlightType = descriptor.getHighlightType();
final HighlightDisplayLevel highlightDisplayLevel;
if (highlightType == ProblemHighlightType.WEAK_WARNING) {
highlightDisplayLevel = HighlightDisplayLevel.WEAK_WARNING;
}
else if (highlightType == ProblemHighlightType.INFORMATION) {
highlightDisplayLevel = HighlightDisplayLevel.DO_NOT_SHOW;
}
else {
highlightDisplayLevel = level;
}
problemsMap.put(descriptor, highlightDisplayLevel);
}
return problemsMap;
}
示例2: 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;
}
}
示例3: 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);
}
}
}
}
}
示例4: getDefaultLevel
@NotNull
@Override
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.WEAK_WARNING;
}
示例5: getDefaultLevel
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.WEAK_WARNING;
}
示例6: getDefaultLevel
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.WEAK_WARNING;
}
示例7: getDefaultLevel
@NotNull
@Override
public HighlightDisplayLevel getDefaultLevel() {
return HighlightDisplayLevel.WEAK_WARNING;
}
示例8: 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);
}