void (@NotNull AnAction action, @NotNull AnActionEvent e, @Nullable Consumer<? super JBPopup> popupShow) { if (action instanceof ActionGroup group && !e.getPresentation().isPerformGroup()) { DataContext dataContext = e.getDataContext(); String place = ActionPlaces.getActionGroupPopupPlace(e.getPlace()); ListPopup popup = JBPopupFactory.getInstance().createActionGroupPopup( e.getPresentation().getText(), group, dataContext, JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false, null, -1, null, place); var toolbarPopupLocation = CommonActionsPanel.getPreferredPopupPoint(action, dataContext.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT)); if (toolbarPopupLocation != null) { popup.show(toolbarPopupLocation); } else if (popupShow != null) { popupShow.accept(popup); } else { popup.showInBestPositionFor(dataContext); } } else { action.actionPerformed(e); } }