当前位置: 首页>>代码示例>>Java>>正文


Java HighlightSeverity.WARNING属性代码示例

本文整理汇总了Java中com.intellij.lang.annotation.HighlightSeverity.WARNING属性的典型用法代码示例。如果您正苦于以下问题:Java HighlightSeverity.WARNING属性的具体用法?Java HighlightSeverity.WARNING怎么用?Java HighlightSeverity.WARNING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.lang.annotation.HighlightSeverity的用法示例。


在下文中一共展示了HighlightSeverity.WARNING属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLayer

private static int getLayer(@NotNull HighlightInfo info, @NotNull SeverityRegistrar severityRegistrar) {
  final HighlightSeverity severity = info.getSeverity();
  int layer;
  if (severity == HighlightSeverity.WARNING) {
    layer = HighlighterLayer.WARNING;
  }
  else if (severityRegistrar.compare(severity, HighlightSeverity.ERROR) >= 0) {
    layer = HighlighterLayer.ERROR;
  }
  else if (severity == HighlightInfoType.INJECTED_FRAGMENT_SEVERITY) {
    layer = HighlighterLayer.CARET_ROW-1;
  }
  else if (severity == HighlightInfoType.ELEMENT_UNDER_CARET_SEVERITY) {
    layer = HighlighterLayer.ELEMENT_UNDER_CARET;
  }
  else {
    layer = HighlighterLayer.ADDITIONAL_SYNTAX;
  }
  return layer;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:UpdateHighlightersUtil.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:ProblemDescriptorUtil.java

示例3: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:HighlightInfo.java

示例4: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:HighlightInfo.java

示例5: getUnresolvedHighlightSeverity

@Override
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
  if (isBuiltInConstant()) return null;
  final PyExpression qualifier = myElement.getQualifier();
  if (qualifier == null) {
    return HighlightSeverity.ERROR;
  }
  if (context.getType(qualifier) != null) {
    return HighlightSeverity.WARNING;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PyReferenceImpl.java

示例6: testMinSeverity

public void testMinSeverity() throws Throwable {
  final MyElement element = createElement("<a/>", MyElement.class);
  final DomElementsProblemsHolderImpl holder = new DomElementsProblemsHolderImpl(DomUtil.getFileElement(element));
  final DomElementProblemDescriptorImpl error = new DomElementProblemDescriptorImpl(element, "abc", HighlightSeverity.ERROR);
  final DomElementProblemDescriptorImpl warning = new DomElementProblemDescriptorImpl(element, "abc", HighlightSeverity.WARNING);
  holder.addProblem(error, MockDomInspection.class);
  holder.addProblem(warning, MockDomInspection.class);
  assertEquals(Arrays.asList(error), holder.getProblems(element, true, true, HighlightSeverity.ERROR));
  assertEquals(Arrays.asList(error, warning), holder.getProblems(element, true, true, HighlightSeverity.WARNING));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DomAnnotationsTest.java

示例7: 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CommonAnnotationHolder.java

示例8: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:FrankensteinErrorFilter.java

示例9: getHighlightSeverity

private static HighlightSeverity getHighlightSeverity(Lint.Issue warn) {
    return warn.severity.toLowerCase().equals("error") ? HighlightSeverity.ERROR : HighlightSeverity.WARNING;
}
 
开发者ID:sertae,项目名称:stylint-plugin,代码行数:3,代码来源:StylintExternalAnnotator.java

示例10: getHighlightSeverity

private static HighlightSeverity getHighlightSeverity(SassLint.Issue warn, boolean treatAsWarnings) {
    if (treatAsWarnings) {
        return HighlightSeverity.WARNING;
    }
    return warn.severity.equals("error") ? HighlightSeverity.ERROR : HighlightSeverity.WARNING;
}
 
开发者ID:idok,项目名称:sass-lint-plugin,代码行数:6,代码来源:SassLintExternalAnnotator.java

示例11: getUnresolvedHighlightSeverity

@Nullable
@Override
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
  return HighlightSeverity.WARNING;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:WeakFileReference.java

示例12: getUnresolvedHighlightSeverity

@Override
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
  return HighlightSeverity.WARNING;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PyDocReference.java

示例13: getUnresolvedHighlightSeverity

@Override
public HighlightSeverity getUnresolvedHighlightSeverity(TypeEvalContext context) {
  return myElement.isQualified() ? HighlightSeverity.WARNING : HighlightSeverity.ERROR;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PyFromImportSourceReference.java

示例14: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:AndroidLintExternalAnnotator.java

示例15: reportOtherProblems

private void reportOtherProblems(RenderLogger logger, HtmlBuilder builder) {
  List<RenderProblem> messages = logger.getMessages();
  if (messages != null && !messages.isEmpty()) {
    Set<String> seenTags = Sets.newHashSet();
    for (RenderProblem message : messages) {
      String tag = message.getTag();
      if (tag != null && seenTags.contains(tag)) {
        continue;
      }
      seenTags.add(tag);

      HighlightSeverity severity = message.getSeverity();
      if (severity == HighlightSeverity.ERROR) {
        builder.addIcon(HtmlBuilderHelper.getErrorIconPath());
      } else if (severity == HighlightSeverity.WARNING) {
        builder.addIcon(HtmlBuilderHelper.getWarningIconPath());
      }

      String html = message.getHtml();
      builder.getStringBuilder().append(html);
      builder.newlineIfNecessary();

      Throwable throwable = message.getThrowable();
      if (throwable != null) {
        reportSandboxError(builder, throwable, false, true);
        reportThrowable(builder, throwable, !html.isEmpty());
      }

      if (tag != null) {
        if (LayoutLog.TAG_RESOURCES_FORMAT.equals(tag)) {
          appendFlagValueSuggestions(builder, message);
        }

        int count = logger.getTagCount(tag);
        if (count > 1) {
          builder.add(" (").addHtml(Integer.toString(count)).add(" similar errors not shown)");
        }
      }

      builder.newline();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:43,代码来源:RenderErrorPanel.java


注:本文中的com.intellij.lang.annotation.HighlightSeverity.WARNING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。