void (@NotNull InputEvent inputEvent, @NotNull AnAction action, @NotNull AnActionEvent event) { inputEvent.consume(); ActionUtil.doPerformActionOrShowPopup(action, event, popup -> { if (inputEvent instanceof MouseEvent) { popup.show(new RelativePoint((MouseEvent)inputEvent)); } else { popup.showInBestPositionFor(event.getDataContext()); } }); }