public static List<VirtualFile> getPotentialRoots(Module module) {
   final PsiDirectory[] dirs = getIntentionDescriptionsDirs(module);
   final List<VirtualFile> result = new ArrayList<VirtualFile>();
   if (dirs.length != 0) {
     for (PsiDirectory dir : dirs) {
       final PsiDirectory parent = dir.getParentDirectory();
       if (parent != null) result.add(parent.getVirtualFile());
     }
   } else {
     ContainerUtil.addAll(result, ModuleRootManager.getInstance(module).getSourceRoots());
   }
   return result;
 }
  @Override
  public ProblemDescriptor[] checkClass(
      @NotNull PsiClass aClass, @NotNull InspectionManager manager, boolean isOnTheFly) {
    final Project project = aClass.getProject();
    final PsiIdentifier nameIdentifier = aClass.getNameIdentifier();
    final Module module = ModuleUtil.findModuleForPsiElement(aClass);

    if (nameIdentifier == null || module == null || !PsiUtil.isInstanciatable(aClass)) return null;

    final PsiClass base =
        JavaPsiFacade.getInstance(project)
            .findClass(INTENTION, GlobalSearchScope.allScope(project));

    if (base == null || !aClass.isInheritor(base, true)) return null;

    String descriptionDir = getDescriptionDirName(aClass);
    if (StringUtil.isEmptyOrSpaces(descriptionDir)) {
      return null;
    }

    for (PsiDirectory description : getIntentionDescriptionsDirs(module)) {
      PsiDirectory dir = description.findSubdirectory(descriptionDir);
      if (dir == null) continue;
      final PsiFile descr = dir.findFile("description.html");
      if (descr != null) {
        if (!hasBeforeAndAfterTemplate(dir.getVirtualFile())) {
          PsiElement problem = aClass.getNameIdentifier();
          ProblemDescriptor problemDescriptor =
              manager.createProblemDescriptor(
                  problem == null ? nameIdentifier : problem,
                  "Intention must have 'before.*.template' and 'after.*.template' beside 'description.html'",
                  isOnTheFly,
                  ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
          return new ProblemDescriptor[] {problemDescriptor};
        }

        return null;
      }
    }

    final PsiElement problem = aClass.getNameIdentifier();
    final ProblemDescriptor problemDescriptor =
        manager.createProblemDescriptor(
            problem == null ? nameIdentifier : problem,
            "Intention does not have a description",
            isOnTheFly,
            new LocalQuickFix[] {new CreateHtmlDescriptionFix(descriptionDir, module, true)},
            ProblemHighlightType.GENERIC_ERROR_OR_WARNING);
    return new ProblemDescriptor[] {problemDescriptor};
  }