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


Java HighlightDisplayLevel.DO_NOT_SHOW属性代码示例

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


在下文中一共展示了HighlightDisplayLevel.DO_NOT_SHOW属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: fillErrorLevels

protected void fillErrorLevels(final ModifiableModel profile) {
  InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
  LOG.assertTrue(toolWrappers != null, "Profile was not correctly init");
  //fill error levels
  for (final String shortName : myDisplayLevelMap.keySet()) {
    //key <-> short name
    HighlightDisplayLevel level = myDisplayLevelMap.get(shortName);

    HighlightDisplayKey key = HighlightDisplayKey.find(shortName);

    if (key == null) continue;

    //set up tools for default profile
    if (level != HighlightDisplayLevel.DO_NOT_SHOW) {
      profile.enableTool(shortName, null, null);
    }

    if (level == null || level == HighlightDisplayLevel.DO_NOT_SHOW) {
      level = HighlightDisplayLevel.WARNING;
    }
    profile.setErrorLevel(key, level, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:InspectionProfileConvertor.java

示例3: getHighlightDisplayLevel

private static HighlightDisplayLevel getHighlightDisplayLevel(final LocalInspectionTool inspectionTool,
                                                              final InspectionProfile inspectionProfile, PsiElement file) {
  final HighlightDisplayKey key = HighlightDisplayKey.find(inspectionTool.getShortName());
  return inspectionProfile.isToolEnabled(key, file) ? inspectionProfile.getErrorLevel(key, file) : HighlightDisplayLevel.DO_NOT_SHOW;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:InspectionValidatorWrapper.java

示例4: addTool

public void addTool(@Nullable Project project, @NotNull InspectionToolWrapper toolWrapper, @NotNull Map<String, List<String>> dependencies) {
  final String shortName = toolWrapper.getShortName();
  HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  if (key == null) {
    final InspectionEP extension = toolWrapper.getExtension();
    Computable<String> computable = extension == null ? new Computable.PredefinedValueComputable<String>(toolWrapper.getDisplayName()) : new Computable<String>() {
      @Override
      public String compute() {
        return extension.getDisplayName();
      }
    };
    if (toolWrapper instanceof LocalInspectionToolWrapper) {
      key = HighlightDisplayKey.register(shortName, computable, toolWrapper.getID(),
                                         ((LocalInspectionToolWrapper)toolWrapper).getAlternativeID());
    }
    else {
      key = HighlightDisplayKey.register(shortName, computable);
    }
  }

  LOG.assertTrue(key != null, shortName + " ; number of initialized tools: " + myTools.size());
  HighlightDisplayLevel baseLevel = myBaseProfile != null && myBaseProfile.getTools(shortName, project) != null
                                 ? myBaseProfile.getErrorLevel(key, project)
                                 : HighlightDisplayLevel.DO_NOT_SHOW;
  HighlightDisplayLevel defaultLevel = toolWrapper.getDefaultLevel();
  HighlightDisplayLevel level = baseLevel.getSeverity().compareTo(defaultLevel.getSeverity()) > 0 ? baseLevel : defaultLevel;
  //HighlightDisplayLevel level = myBaseProfile != null && myBaseProfile.getTools(shortName, project) != null ? myBaseProfile.getErrorLevel(key, project) : toolWrapper.getDefaultLevel();
  boolean enabled = myBaseProfile != null ? myBaseProfile.isToolEnabled(key) : toolWrapper.isEnabledByDefault();
  final ToolsImpl toolsList = new ToolsImpl(toolWrapper, level, !myLockedProfile && enabled, enabled);
  final Element element = myUninstalledInspectionsSettings.remove(shortName);
  try {
    if (element != null) {
      toolsList.readExternal(element, this, dependencies);
    }
    else if (!myUninstalledInspectionsSettings.containsKey(InspectionElementsMerger.getMergedMarkerName(shortName))) {
      final InspectionElementsMerger merger = getMergers().get(shortName);
      if (merger != null) {
        final Element merged = merger.merge(myUninstalledInspectionsSettings);
        if (merged != null) {
          toolsList.readExternal(merged, this, dependencies);
        }
      }
    }
  }
  catch (InvalidDataException e) {
    LOG.error("Can't read settings for " + toolWrapper, e);
  }
  myTools.put(shortName, toolsList);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:49,代码来源:InspectionProfileImpl.java


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