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;
  private static boolean init() {
    // It's assumed that default spell checking inspection settings are just fine for processing all
    // types of data.
    // Please perform corresponding settings tuning if that assumption is broken at future.

    Class<LocalInspectionTool>[] inspectionClasses =
        (Class<LocalInspectionTool>[]) new Class<?>[] {SpellCheckingInspection.class};
    for (Class<LocalInspectionTool> inspectionClass : inspectionClasses) {
      try {
        LocalInspectionTool tool = inspectionClass.newInstance();
        SPELL_CHECK_TOOLS.put(tool.getShortName(), new LocalInspectionToolWrapper(tool));
      } catch (Throwable e) {
        return false;
    return true;
 /** This should be used in tests primarily */
 public LocalInspectionToolWrapper(@NotNull LocalInspectionTool tool) {
   super(tool, ourEPMap.getValue().get(tool.getShortName()));