void (@NotNull JBPopup popup, @NotNull AnActionEvent e) { InputEvent inputEvent = e.getInputEvent(); if (inputEvent == null) { popup.showInFocusCenter(); } else { Component component = inputEvent.getComponent(); if (component instanceof ActionButtonComponent) { popup.showUnderneathOf(component); } else { popup.showInCenterOf(component); } } }