List of usage examples for com.intellij.openapi.keymap Keymap addShortcut
void addShortcut(@NotNull String actionId, @NotNull Shortcut shortcut);
From source file:com.android.tools.idea.AndroidInitialConfigurator.java
License:Apache License
private static void setActivateAndroidToolWindowShortcut() { for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) { KeyboardShortcut shortcut = removeFirstKeyboardShortcut(keymap, TODO_TOOLWINDOW_ACTION_ID); if (shortcut != null) { keymap.addShortcut(ANDROID_TOOLWINDOW_ACTION_ID, shortcut); }//from www . j a v a 2 s . c om } }
From source file:com.intellij.ide.actionMacro.ActionMacroConfigurationPanel.java
License:Apache License
public void apply() { if (myRenamingList != null) { for (Pair<String, String> pair : myRenamingList) { Keymap[] allKeymaps = KeymapManagerEx.getInstanceEx().getAllKeymaps(); for (Keymap keymap : allKeymaps) { keymap.removeAllActionShortcuts(ActionMacro.MACRO_ACTION_PREFIX + pair.getSecond()); for (Shortcut shortcut : keymap .getShortcuts(ActionMacro.MACRO_ACTION_PREFIX + pair.getFirst())) { keymap.addShortcut(ActionMacro.MACRO_ACTION_PREFIX + pair.getSecond(), shortcut); }//from w w w . j ava 2s . c o m keymap.removeAllActionShortcuts(ActionMacro.MACRO_ACTION_PREFIX + pair.getFirst()); } } } final ActionMacroManager manager = ActionMacroManager.getInstance(); ActionMacro[] macros = manager.getAllMacros(); HashSet<String> removedIds = new HashSet<String>(); for (ActionMacro macro1 : macros) { removedIds.add(macro1.getActionId()); } manager.removeAllMacros(); final Enumeration newMacros = myMacrosModel.elements(); while (newMacros.hasMoreElements()) { ActionMacro macro = (ActionMacro) newMacros.nextElement(); manager.addMacro(macro); removedIds.remove(macro.getActionId()); } manager.registerActions(); for (String id : removedIds) { Keymap[] allKeymaps = KeymapManagerEx.getInstanceEx().getAllKeymaps(); for (Keymap keymap : allKeymaps) { keymap.removeAllActionShortcuts(id); } } }
From source file:com.twitter.intellij.pants.components.impl.PantsInitComponentImpl.java
License:Apache License
@Override public void initComponent() { // The Pants plugin doesn't do so many computations for building a project // to start an external JVM each time. // The plugin only calls `export` goal and parses JSON response. // So it will be in process all the time. final String key = PantsConstants.SYSTEM_ID.getId() + ExternalSystemConstants.USE_IN_PROCESS_COMMUNICATION_REGISTRY_KEY_SUFFIX; Registry.get(key).setValue(true); // hack to trick BuildProcessClasspathManager final String basePath = System.getProperty("pants.plugin.base.path"); final IdeaPluginDescriptor plugin = PluginManager.getPlugin(PluginId.getId(PantsConstants.PLUGIN_ID)); if (StringUtil.isNotEmpty(basePath) && plugin instanceof IdeaPluginDescriptorImpl) { ((IdeaPluginDescriptorImpl) plugin).setPath(new File(basePath)); }/*from w w w. j a v a2 s . c o m*/ Keymap keymap = KeymapManager.getInstance().getActiveKeymap(); KeyboardShortcut keyboardShortcut = KeyboardShortcut.fromString("shift meta pressed R"); // Add (Cmd Shift R) as shortcut to refresh the project if there is no shortcut for that action yet. // Shows error message if conflicting shortcut exists if (KeymapManager.getInstance().getActiveKeymap() .getShortcuts("ExternalSystem.RefreshAllProjects").length == 0 && keymap.getActionIds(keyboardShortcut).length > 0) { Notification notification = new Notification("Keymap Error", "Keymap Error", "Conflict found assigning '+Shift+R' to 'Refresh all external projects'. Please set it manually in " + "<a href='#'>Keymap settings</a>.", NotificationType.WARNING, new NotificationListener() { @Override public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) { ShowSettingsUtil.getInstance().showSettingsDialog(null, "Keymap"); } }); Notifications.Bus.notify(notification); keymap.addShortcut("ExternalSystem.RefreshAllProjects", keyboardShortcut); } }
From source file:de.fu_berlin.inf.dpp.intellij.SarosComponent.java
License:Open Source License
public SarosComponent(final Project project) { loadLoggers();/*from w w w .ja va 2s .c o m*/ Keymap keymap = KeymapManager.getInstance().getActiveKeymap(); keymap.addShortcut("ActivateSarosToolWindow", new KeyboardShortcut( KeyStroke.getKeyStroke(KeyEvent.VK_F11, java.awt.event.InputEvent.ALT_DOWN_MASK), null)); Saros.create(project); }
From source file:org.jetbrains.plugins.ruby.settings.RSettings.java
License:Apache License
private void registerDefaultActions(final Keymap keymap) { //Generators//from ww w . ja v a2s.co m final KeyStroke ctrAltG = KeyStroke.getKeyStroke("ctrl alt G"); keymap.addShortcut(GeneratorNodeInfo.getActionId("controller"), new KeyboardShortcut(ctrAltG, KeyStroke.getKeyStroke("C"))); keymap.addShortcut(GeneratorNodeInfo.getActionId("model"), new KeyboardShortcut(ctrAltG, KeyStroke.getKeyStroke("M"))); keymap.addShortcut(GeneratorNodeInfo.getActionId("migration"), new KeyboardShortcut(ctrAltG, KeyStroke.getKeyStroke("I"))); keymap.addShortcut(GeneratorNodeInfo.getActionId("scaffold"), new KeyboardShortcut(ctrAltG, KeyStroke.getKeyStroke("S"))); //RakeTasks final KeyStroke ctrAltR = KeyStroke.getKeyStroke("ctrl alt R"); keymap.addShortcut(RakeTaskNodeInfo.getActionId("db:migrate"), new KeyboardShortcut(ctrAltR, KeyStroke.getKeyStroke("I"))); }