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


Java HighlightDisplayLevel.WEAK_WARNING属性代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:InspectionValidatorWrapper.java

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

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

示例4: getDefaultLevel

@NotNull
@Override
public HighlightDisplayLevel getDefaultLevel() {
    return HighlightDisplayLevel.WEAK_WARNING;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:5,代码来源:RedundantInitializationInspection.java

示例5: getDefaultLevel

@NotNull
public HighlightDisplayLevel getDefaultLevel() {
    return HighlightDisplayLevel.WEAK_WARNING;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:4,代码来源:AbstractInspection.java

示例6: getDefaultLevel

@NotNull
public HighlightDisplayLevel getDefaultLevel() {
  return HighlightDisplayLevel.WEAK_WARNING;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:PyNestedDecoratorsInspection.java

示例7: getDefaultLevel

@NotNull
@Override
public HighlightDisplayLevel getDefaultLevel() {
  return HighlightDisplayLevel.WEAK_WARNING;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:PyCallByClassInspection.java

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


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