@Override
  public void deleteElement(@NotNull DataContext dataContext) {
    final VirtualFile[] files = CommonDataKeys.VIRTUAL_FILE_ARRAY.getData(dataContext);
    if (files == null || files.length == 0) return;
    Project project = CommonDataKeys.PROJECT.getData(dataContext);

    String message = createConfirmationMessage(files);
    int returnValue = Messages.showOkCancelDialog(message, UIBundle.message("delete.dialog.title"), ApplicationBundle.message("button.delete"),
      CommonBundle.getCancelButtonText(), Messages.getQuestionIcon());
    if (returnValue != Messages.OK) return;

    Arrays.sort(files, FileComparator.getInstance());

    List<String> problems = new LinkedList<>();
    CommandProcessor.getInstance().executeCommand(project, () -> new Task.Modal(project, IdeBundle.message("progress.title.deleting.files"), true) {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        indicator.setIndeterminate(false);
        int i = 0;
        for (VirtualFile file : files) {
          indicator.checkCanceled();
          indicator.setText2(file.getPresentableUrl());
          indicator.setFraction((double)i / files.length);
          i++;

          try {
            WriteAction.runAndWait(()-> file.delete(this));
          }
          catch (IOException e) {
            LOG.info("Error when deleting " + file, e);
            problems.add(file.getName());
          }
        }
      }

      @Override
      public void onSuccess() {
        reportProblems();
      }

      @Override
      public void onCancel() {
        reportProblems();
      }

      private void reportProblems() {
        if (!problems.isEmpty()) {
          reportDeletionProblem(problems);
        }
      }
    }.queue(), IdeBundle.message("command.deleting.files"), null);
  }
@Override
  public void deleteElement(@NotNull DataContext dataContext)