List of usage examples for com.intellij.openapi.keymap Keymap getActionIds
String @NotNull [] getActionIds(@NotNull MouseShortcut shortcut);
From source file:be.janickreynders.shortcuttranslator.ShortcutTranslatorDialog.java
License:Open Source License
private Set<ShortcutDescription> translateShortcut(KeyStroke stroke, Keymap sourceKeymap, Keymap targetKeymap) { Set<ShortcutDescription> descriptions = new LinkedHashSet<ShortcutDescription>(); String[] actionIds = sourceKeymap.getActionIds(stroke); for (String actionId : actionIds) { Shortcut[] shortcuts = targetKeymap.getShortcuts(actionId); for (Shortcut shortcut : shortcuts) { descriptions.add(new ShortcutDescription(KeymapUtil.getShortcutText(shortcut), actionId, getAction(actionId))); }/*from ww w . j av a2 s . c o m*/ } return descriptions; }
From source file:com.intellij.tasks.actions.SearchSupport.java
License:Apache License
private boolean togglePopup(KeyEvent e) { final KeyStroke stroke = KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers()); final Object action = ((InputMap) UIManager.get("ComboBox.ancestorInputMap")).get(stroke); if ("selectNext".equals(action)) { if (!isPopupShowing() && myAutoPopup) { showPopup(true);/*from w w w . j a v a 2s . co m*/ return true; } else { return false; } } else if ("togglePopup".equals(action)) { if (isPopupShowing()) { hideCurrentPopup(); } else { showPopup(true); } return true; } else { final Keymap active = KeymapManager.getInstance().getActiveKeymap(); final String[] ids = active.getActionIds(stroke); if (ids.length > 0 && "CodeCompletion".equals(ids[0])) { showPopup(true); } } return false; }
From source file:com.maddyhome.idea.vim.group.KeyGroup.java
License:Open Source License
@NotNull private static List<AnAction> getKeymapActions(@NotNull KeyStroke keyStroke) { final List<AnAction> results = new ArrayList<AnAction>(); final Keymap keymap = KeymapManager.getInstance().getActiveKeymap(); for (String id : keymap.getActionIds(keyStroke)) { final AnAction action = ActionManager.getInstance().getAction(id); if (action != null) { results.add(action);/*from w w w. j av a 2 s. c o m*/ } } return results; }
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)); }/* ww w . java 2 s . co 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); } }