Search in sources :

Example 1 with BranchPopupBuilder

use of com.intellij.vcs.log.ui.filter.BranchPopupBuilder in project intellij-community by JetBrains.

the class DeepCompareAction method selectBranchAndPerformAction.

private static void selectBranchAndPerformAction(@NotNull VcsLogDataPack dataPack, @NotNull AnActionEvent event, @NotNull final Consumer<String> consumer, @NotNull Collection<VirtualFile> visibleRoots) {
    ActionGroup actionGroup = new BranchPopupBuilder(dataPack, visibleRoots, null) {

        @NotNull
        @Override
        protected AnAction createAction(@NotNull final String name) {
            return new DumbAwareAction(name) {

                @Override
                public void actionPerformed(AnActionEvent e) {
                    consumer.consume(name);
                }
            };
        }
    }.build();
    ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup("Select branch to compare", 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.showInBestPositionFor(event.getDataContext());
    }
}
Also used : BranchPopupBuilder(com.intellij.vcs.log.ui.filter.BranchPopupBuilder) MouseEvent(java.awt.event.MouseEvent) ListPopup(com.intellij.openapi.ui.popup.ListPopup) InputEvent(java.awt.event.InputEvent) RelativePoint(com.intellij.ui.awt.RelativePoint) NotNull(org.jetbrains.annotations.NotNull) DumbAwareAction(com.intellij.openapi.project.DumbAwareAction)

Aggregations

DumbAwareAction (com.intellij.openapi.project.DumbAwareAction)1 ListPopup (com.intellij.openapi.ui.popup.ListPopup)1 RelativePoint (com.intellij.ui.awt.RelativePoint)1 BranchPopupBuilder (com.intellij.vcs.log.ui.filter.BranchPopupBuilder)1 InputEvent (java.awt.event.InputEvent)1 MouseEvent (java.awt.event.MouseEvent)1 NotNull (org.jetbrains.annotations.NotNull)1