void (@NotNull Keymap keymap, @NotNull String actionId, @NotNull KeyStroke sysKS, @Nullable String macOsShortcutAction, @NotNull KeyboardShortcut conflicted) { updateKeymapConflicts(keymap); final int unmutedConflicts = getUnmutedConflictsCount(); final boolean hasOtherConflicts = unmutedConflicts > 1; final AnAction act = ActionManager.getInstance().getAction(actionId); final String actText = act == null ? actionId : act.getTemplateText(); // TODO: fix action ids from services domain final String message; if (hasOtherConflicts) { message = IdeBundle.message("notification.content.more.shortcut.conflict", actText, unmutedConflicts - 1); } else { message = IdeBundle.message("notification.content.shortcut.conflicts.with.macos.shortcut.modify", actText, macOsShortcutAction == null ? "" : " '" + macOsShortcutAction + "'"); } final Notification notification = GROUP.createNotification(IdeBundle.message("notification.title.shortcuts.conflicts"), message, NotificationType.WARNING); if (hasOtherConflicts) { final AnAction showKeymapPanelAction = DumbAwareAction.create(IdeBundle.message("action.text.modify.shortcuts"), e -> { new EditKeymapsDialog(null, actionId, true).show(); updateKeymapConflicts(myKeymap); } ); notification.addAction(showKeymapPanelAction); } else { final AnAction configureShortcut = DumbAwareAction.create(IdeBundle.message("action.text.modify.shortcut"), e -> { Component component = e.getDataContext().getData(PlatformCoreDataKeys.CONTEXT_COMPONENT); if (component == null) { Window[] frames = Window.getWindows(); component = frames == null || frames.length == 0 ? null : frames[0]; if (component == null) { LOG.error("can't show KeyboardShortcutDialog (parent component wasn't found)"); return; } } KeymapPanel.addKeyboardShortcut( actionId, ActionShortcutRestrictions.getInstance().getForActionId(actionId), keymap, component, conflicted, this); notification.expire(); }); notification.addAction(configureShortcut); } final AnAction muteAction = DumbAwareAction.create(IdeBundle.message("action.dont.show.again.text"), e -> { myMutedConflicts.addMutedAction(actionId); notification.expire(); }); notification.addAction(muteAction); if (SystemInfo.isMac && !hasOtherConflicts) { final AnAction changeSystemSettings = DumbAwareAction.create(IdeBundle.message("action.text.change.system.shortcuts"), e -> { ApplicationManager.getApplication().executeOnPooledThread(() -> { final GeneralCommandLine cmdLine = new GeneralCommandLine( "osascript", "-e", "tell application \"System Preferences\"", "-e", "set the current pane to pane id \"com.apple.preference.keyboard\"", "-e", "reveal anchor \"shortcutsTab\" of pane id \"com.apple.preference.keyboard\"", "-e", "activate", "-e", "end tell"); try { ExecUtil.execAndGetOutput(cmdLine); // NOTE: we can't detect OS-settings changes // but we can try to schedule check conflicts (and expire notification if necessary) } catch (ExecutionException ex) { LOG.error(ex); } }); }); notification.addAction(changeSystemSettings); } myNotifiedActions.add(actionId); ++myNotifyCount; notification.notify(null); }