void (@NotNull AnActionEvent e) { JBPopup seDialog = getPopup(e).orElse(null); if (seDialog == null) return; KeymapManager km = KeymapManager.getInstance(); Keymap activeKeymap = km != null ? km.getActiveKeymap() : null; if (activeKeymap == null) { return; } AnAction action = e.getData(SELECTED_ACTION); Component component = e.getData(PlatformCoreDataKeys.CONTEXT_COMPONENT); if (action == null || component == null) { return; } seDialog.cancel(); String id = ActionManager.getInstance().getId(action); KeymapPanel.addKeyboardShortcut(id, ActionShortcutRestrictions.getInstance().getForActionId(id), activeKeymap, component); }