private static void addAndSelectDirectoriesWithUndo(@NotNull Project project, @Nullable Module module, @NotNull List<? extends VirtualFile> roots) {
    addRemoveEntriesWithUndo(project, module, roots, true);
    VirtualFile file = ContainerUtil.getFirstItem(roots);
    if (file != null) {
      ModalityUiUtil.invokeLaterIfNeeded(ModalityState.defaultModalityState(), () ->
        ProjectViewSelectInTarget.select(project, file, ProjectViewPane.ID, null, file, true)
      );
    }
  }
private static void addAndSelectDirectoriesWithUndo(@NotNull Project project, @Nullable Module module, @NotNull List<? extends VirtualFile> roots)