public static boolean showUntrackedFilesDialogWithRollback(final @NotNull Project project,
                                                             @NotNull @Nls String operationName,
                                                             @NotNull @NlsContexts.Label String rollbackProposal,
                                                             @NotNull VirtualFile root,
                                                             final @NotNull Collection<String> relativePaths) {
    Collection<String> absolutePaths = GitUtil.toAbsolute(root, relativePaths);
    List<VirtualFile> untrackedFiles = ContainerUtil.mapNotNull(absolutePaths,
                                                                      absolutePath -> GitUtil.findRefreshFileOrLog(absolutePath));

    Ref<Boolean> rollback = Ref.create();
    ApplicationManager.getApplication().invokeAndWait(() -> {
      JComponent filesBrowser;
      if (untrackedFiles.isEmpty()) {
        LOG.debug("Couldn't find the untracked files, displaying simplified dialog.");
        filesBrowser = new GitSimplePathsBrowser(project, absolutePaths);
      }
      else {
        long validFiles = untrackedFiles.stream().filter(VirtualFile::isValid).count();
        LOG.debug(String.format("Untracked files: [%s]. Valid: %d (of %d)", untrackedFiles, validFiles, untrackedFiles.size()));
        filesBrowser = ScrollPaneFactory.createScrollPane(new SelectFilesDialog.VirtualFileList(project, false, true, untrackedFiles));
      }
      String title = GitBundle.message("dialog.title.could.not.operation", StringUtil.capitalize(operationName));
      String description = GitBundle.message("dialog.message.untracked.files.will.be.overwritten.by.operation", operationName);
      DialogWrapper dialog = new UntrackedFilesRollBackDialog(project, filesBrowser, description, rollbackProposal);
      dialog.setTitle(title);
      DialogManager.show(dialog);
      rollback.set(dialog.isOK());
    });
    return rollback.get();
  }
public static boolean showUntrackedFilesDialogWithRollback(final @NotNull Project project,
                                                             @NotNull @Nls String operationName,
                                                             @NotNull @NlsContexts.Label String rollbackProposal,
                                                             @NotNull VirtualFile root,
                                                             final @NotNull Collection<String> relativePaths)