Search in sources :

Example 31 with HighlightSeverity

use of com.intellij.lang.annotation.HighlightSeverity in project android by JetBrains.

the class AndroidLintExternalAnnotator method 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;
    }
    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);
    return holder.createAnnotation(severity, range, message, tooltip);
}
Also used : HighlightSeverity(com.intellij.lang.annotation.HighlightSeverity) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

HighlightSeverity (com.intellij.lang.annotation.HighlightSeverity)31 Element (org.jdom.Element)8 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)7 HighlightInfoType (com.intellij.codeInsight.daemon.impl.HighlightInfoType)6 NotNull (org.jetbrains.annotations.NotNull)6 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)5 SeverityRegistrar (com.intellij.codeInsight.daemon.impl.SeverityRegistrar)5 TextAttributesKey (com.intellij.openapi.editor.colors.TextAttributesKey)5 Nullable (org.jetbrains.annotations.Nullable)4 Annotation (com.intellij.lang.annotation.Annotation)3 TextRange (com.intellij.openapi.util.TextRange)3 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)2 IntentionAction (com.intellij.codeInsight.intention.IntentionAction)2 Document (com.intellij.openapi.editor.Document)2 DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)2 Project (com.intellij.openapi.project.Project)2 JDOMExternalizableStringList (com.intellij.openapi.util.JDOMExternalizableStringList)2 PsiElement (com.intellij.psi.PsiElement)2 THashSet (gnu.trove.THashSet)2 NonNls (org.jetbrains.annotations.NonNls)2