void (@NotNull AnActionEvent e) { final JBPopup popup = createPopup(e); InputEvent event = e.getInputEvent(); if (event instanceof MouseEvent) { popup.showUnderneathOf(event.getComponent()); } else { popup.showInBestPositionFor(e.getDataContext()); } }