@Override
    public void run() {
      List<PsiFile> filesList = new ArrayList<>();
      boolean isRecursive = myExportToHTMLSettings.isIncludeSubdirectories();

      ApplicationManager.getApplication().runReadAction(() -> {
        try {
          addToPsiFileList(myPsiDirectory, filesList, isRecursive, outDir);
        }
        catch (IOException e) {
          if (myLastException == null) {
            myLastException = e;
          }
          else {
            LOG.error(e);
          }
        }
      });

      if (myLastException != null) {
        return;
      }

      ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
      Map<PsiFile, PsiFile> filesMap = new HashMap<>();
      for (PsiFile psiFile : filesList) {
        filesMap.put(psiFile, psiFile);
      }
      for (int i = 0; i < filesList.size(); i++) {
        PsiFile psiFile = filesList.get(i);
        if (progressIndicator.isCanceled()) {
          return;
        }
        progressIndicator.setText(EditorBundle.message("export.to.html.generating.file.progress", getHTMLFileName(psiFile)));
        progressIndicator.setFraction((double)i / filesList.size());
        if (!exportPsiFile(psiFile, outDir, myProject, filesMap)) {
          return;
        }
      }
      if (myExportToHTMLSettings.OPEN_IN_BROWSER) {
        String dirToShow = myExportToHTMLSettings.OUTPUT_DIRECTORY;
        if (!dirToShow.endsWith(File.separator)) {
          dirToShow += File.separatorChar;
        }
        dirToShow += PsiDirectoryFactory.getInstance(myProject).getQualifiedName(myPsiDirectory, false).replace('.', File.separatorChar);
        BrowserUtil.browse(dirToShow);
      }
    }
@Override
    public void run()