@Override
    public void run(@NotNull ProgressIndicator indicator) {
      try {
        indicator.setText(IdeBundle.message("progress.counting.files"));
        Ref<Integer> curFileCount = new Ref<>(0);
        for (PsiElement element : myFileElements) {
          VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile();
          Files.walkFileTree(file.toNioPath(), new NioFiles.StatsCollectingVisitor() {
            @Override
            protected void countDirectory(Path dir, BasicFileAttributes attrs) {
              count();
            }

            @Override
            protected void countFile(Path file, BasicFileAttributes attrs) {
              count();
            }

            private void count() {
              indicator.checkCanceled();
              curFileCount.set(curFileCount.get() + 1);
            }
          });
        }
        final int totalFileCount = curFileCount.get();
        curFileCount.set(0);
        indicator.setIndeterminate(totalFileCount <= 1); // don't show progression when deleting single file
        for (int i = 0; i < myFileElements.length; i++) {
          PsiElement element = myFileElements[i];
          if (indicator.isCanceled()) break;
          indicator.setFraction((double) i / myFileElements.length);

          VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile();
          aborted = file;
          Path path = file.toNioPath();
          indicator.setText(path.toString());

          try {
            NioFiles.deleteRecursively(path, p -> {
              curFileCount.set(curFileCount.get() + 1);
              indicator.checkCanceled();
              indicator.setFraction((double)curFileCount.get() / totalFileCount);
              indicator.setText2(path.relativize(p).toString());
            });
            processed.add(element);
            aborted = null;
          }
          catch (ProcessCanceledException ignored) { }
        }
      }
      catch (Throwable t) {
        Logger.getInstance(getClass()).info(t);
        error = t;
      }
    }
@Override
    public void run(@NotNull ProgressIndicator indicator)