private static void selectBranchAndPerformAction(@NotNull VcsLogUiEx ui,
                                                   @NotNull AnActionEvent event,
                                                   @NotNull Consumer<? super String> consumer,
                                                   @NotNull Collection<? extends VirtualFile> visibleRoots) {
    VcsLogDataPack dataPack = ui.getDataPack();
    ActionGroup actionGroup = new BranchPopupBuilder(dataPack, visibleRoots, null) {
      @Override
      protected @NotNull AnAction createAction(@NotNull @NlsActions.ActionText String name, @NotNull Collection<? extends VcsRef> refs) {
        return new DumbAwareAction(name) {
          @Override
          public void actionPerformed(@NotNull AnActionEvent e) {
            consumer.consume(name);
          }
        };
      }
    }.build();
    ListPopup popup =
      JBPopupFactory.getInstance().createActionGroupPopup(GitBundle.message("git.log.cherry.picked.highlighter.select.branch.popup"),
                                                          actionGroup, event.getDataContext(),
                                                          false, false, false,
                                                          null, -1, null);
    InputEvent inputEvent = event.getInputEvent();
    if (inputEvent instanceof MouseEvent) {
      popup.show(new RelativePoint((MouseEvent)inputEvent));
    }
    else {
      popup.showInCenterOf(VcsLogUiUtil.getComponent(ui));
    }
  }
private static void selectBranchAndPerformAction(@NotNull VcsLogUiEx ui,
                                                   @NotNull AnActionEvent event,
                                                   @NotNull Consumer<? super String> consumer,
                                                   @NotNull Collection<? extends VirtualFile> visibleRoots)