void (@NotNull AnActionEvent e) { JBPopupFactory popupFactory = JBPopupFactory.getInstance(); DataContext dataContext = e.getDataContext(); ListPopupStep step = popupFactory.createActionsStep( myActionGroup, dataContext, null, false, false, myActionGroup.getTemplatePresentation().getText(), myTree, true, myPreselection != null ? myPreselection.getDefaultIndex() : 0, true); final ListPopup listPopup = popupFactory.createListPopup(step); listPopup.setHandleAutoSelectionBeforeShow(true); if (e instanceof AnActionButton.AnActionEventWrapper) { ((AnActionButton.AnActionEventWrapper)e).showPopup(listPopup); } else { listPopup.showInBestPositionFor(dataContext); } }