本文整理汇总了Java中com.intellij.lang.annotation.HighlightSeverity.WEAK_WARNING属性的典型用法代码示例。如果您正苦于以下问题:Java HighlightSeverity.WEAK_WARNING属性的具体用法?Java HighlightSeverity.WEAK_WARNING怎么用?Java HighlightSeverity.WEAK_WARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.lang.annotation.HighlightSeverity
的用法示例。
在下文中一共展示了HighlightSeverity.WEAK_WARNING属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: convertSeverity
@NotNull
public static HighlightInfoType convertSeverity(@NotNull HighlightSeverity severity) {
return severity == HighlightSeverity.ERROR? HighlightInfoType.ERROR :
severity == HighlightSeverity.WARNING ? HighlightInfoType.WARNING :
severity == HighlightSeverity.INFO ? HighlightInfoType.INFO :
severity == HighlightSeverity.WEAK_WARNING ? HighlightInfoType.WEAK_WARNING :
severity ==HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING ? HighlightInfoType.GENERIC_WARNINGS_OR_ERRORS_FROM_SERVER :
HighlightInfoType.INFORMATION;
}
示例2: convertSeverityToProblemHighlight
@NotNull
public static ProblemHighlightType convertSeverityToProblemHighlight(HighlightSeverity severity) {
return severity == HighlightSeverity.ERROR ? ProblemHighlightType.ERROR :
severity == HighlightSeverity.WARNING ? ProblemHighlightType.GENERIC_ERROR_OR_WARNING :
severity == HighlightSeverity.INFO ? ProblemHighlightType.INFO :
severity == HighlightSeverity.WEAK_WARNING ? ProblemHighlightType.WEAK_WARNING : ProblemHighlightType.INFORMATION;
}
示例3: createAnnotation
@Override
public Annotation createAnnotation(T element, @NotNull HighlightSeverity severity, String message) {
if (severity == HighlightSeverity.ERROR) {
return myHolder.createErrorAnnotation(element, message);
} else if (severity == HighlightSeverity.WARNING) {
return myHolder.createWarningAnnotation(element, message);
} else if (severity == HighlightSeverity.WEAK_WARNING) {
return myHolder.createWeakWarningAnnotation(element, message);
} else {
return myHolder.createInfoAnnotation(element, message);
}
}
示例4: accept
@Override
public boolean accept(@NotNull HighlightInfo highlightInfo, @Nullable PsiFile file) {
if (highlightInfo.getSeverity() != HighlightSeverity.WARNING &&
highlightInfo.getSeverity() != HighlightSeverity.WEAK_WARNING) return true;
if (file == null || !isFrankenstein(file)) return true;
int start = highlightInfo.getStartOffset();
int end = highlightInfo.getEndOffset();
String text = file.getText().substring(start, end);
return !"missingValue".equals(text);
}
示例5: getUnresolvedHighlightSeverity
@Nullable
@Override
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
return HighlightSeverity.WEAK_WARNING;
}
示例6: 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);
}