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


Java HighlightDisplayKey.register方法代码示例

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


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

示例1: enableInspectionTool

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
public static void enableInspectionTool(@NotNull final Project project, @NotNull final InspectionToolWrapper toolWrapper) {
  final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
  final String shortName = toolWrapper.getShortName();
  final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  if (key == null) {
    HighlightDisplayKey.register(shortName, toolWrapper.getDisplayName(), toolWrapper.getID());
  }
  InspectionProfileImpl.initAndDo(new Computable() {
    @Override
    public Object compute() {
      InspectionProfileImpl impl = (InspectionProfileImpl)profile;
      InspectionToolWrapper existingWrapper = impl.getInspectionTool(shortName, project);
      if (existingWrapper == null || existingWrapper.isInitialized() != toolWrapper.isInitialized() || toolWrapper.isInitialized() && toolWrapper.getTool() != existingWrapper.getTool()) {
        impl.addTool(project, toolWrapper, new THashMap<String, List<String>>());
      }
      impl.enableTool(shortName, project);
      return null;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LightPlatformTestCase.java

示例2: testHighlightStatus_OtherInspections

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
public void testHighlightStatus_OtherInspections() throws Throwable {
  myElement.setFileDescription(new DomFileDescription<DomElement>(DomElement.class, "a"));
  final MyDomElementsInspection inspection = new MyDomElementsInspection() {

    @Override
    public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
                                         final boolean isOnTheFly) {
      myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
      return new ProblemDescriptor[0];
    }

    @Override
    public void checkFileElement(final DomFileElement fileElement, final DomElementAnnotationHolder holder) {
    }
  };
  HighlightDisplayKey.register(inspection.getShortName());
  myInspectionProfile.setInspectionTools(new LocalInspectionToolWrapper(inspection));

  myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class);
  assertEquals(DomHighlightStatus.ANNOTATORS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));

  myAnnotationsManager.appendProblems(myElement, createHolder(), inspection.getClass());
  assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DomHighlightingLiteTest.java

示例3: testHighlightStatus_OtherInspections2

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
public void testHighlightStatus_OtherInspections2() throws Throwable {
  myElement.setFileDescription(new DomFileDescription<DomElement>(DomElement.class, "a"));
  final MyDomElementsInspection inspection = new MyDomElementsInspection() {

    @Override
    public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
                                         final boolean isOnTheFly) {
      myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
      return new ProblemDescriptor[0];
    }

    @Override
    public void checkFileElement(final DomFileElement fileElement, final DomElementAnnotationHolder holder) {
    }
  };
  HighlightDisplayKey.register(inspection.getShortName());
  LocalInspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(inspection);
  myInspectionProfile.setInspectionTools(toolWrapper);
  myInspectionProfile.setEnabled(toolWrapper, false);

  myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class);
  assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DomHighlightingLiteTest.java

示例4: runTool

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
public static void runTool(@NotNull InspectionToolWrapper toolWrapper,
                           @NotNull final AnalysisScope scope,
                           @NotNull final GlobalInspectionContextForTests globalContext) {
  final String shortName = toolWrapper.getShortName();
  final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
  if (key == null){
    HighlightDisplayKey.register(shortName);
  }

  globalContext.doInspections(scope);
  do {
    UIUtil.dispatchAllInvocationEvents();
  }
  while (!globalContext.isFinished());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:InspectionTestUtil.java

示例5: addTool

import com.intellij.codeInsight.daemon.HighlightDisplayKey; //导入方法依赖的package包/类
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,代码行数:50,代码来源:InspectionProfileImpl.java


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