Java Code Examples for com.intellij.openapi.keymap.Keymap#getActionIds()
The following examples show how to use
com.intellij.openapi.keymap.Keymap#getActionIds() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileEditorManagerImpl.java From consulo with Apache License 2.0 | 6 votes |
private static boolean isOpenInNewWindow() { if (!Platform.current().isDesktop()) { return false; } AWTEvent event = IdeEventQueue.getInstance().getTrueCurrentEvent(); // Shift was used while clicking if (event instanceof MouseEvent && ((MouseEvent)event).isShiftDown() && (event.getID() == MouseEvent.MOUSE_CLICKED || event.getID() == MouseEvent.MOUSE_PRESSED || event.getID() == MouseEvent.MOUSE_RELEASED)) { return true; } if (event instanceof KeyEvent) { KeyEvent ke = (KeyEvent)event; Keymap keymap = KeymapManager.getInstance().getActiveKeymap(); String[] ids = keymap.getActionIds(KeyStroke.getKeyStroke(ke.getKeyCode(), ke.getModifiers())); return Arrays.asList(ids).contains("OpenElementInNewWindow"); } return false; }
Example 2
Source File: DesktopEditorImpl.java From consulo with Apache License 2.0 | 6 votes |
private static boolean isMouseActionEvent(@Nonnull MouseEvent e, String actionId) { KeymapManager keymapManager = KeymapManager.getInstance(); if (keymapManager == null) return false; Keymap keymap = keymapManager.getActiveKeymap(); MouseShortcut mouseShortcut = KeymapUtil.createMouseShortcut(e); String[] mappedActions = keymap.getActionIds(mouseShortcut); if (!ArrayUtil.contains(actionId, mappedActions)) return false; if (mappedActions.length < 2 || e.getID() == MouseEvent.MOUSE_DRAGGED /* 'normal' actions are not invoked on mouse drag */) return true; ActionManager actionManager = ActionManager.getInstance(); for (String mappedActionId : mappedActions) { if (actionId.equals(mappedActionId)) continue; AnAction action = actionManager.getAction(mappedActionId); AnActionEvent actionEvent = AnActionEvent.createFromAnAction(action, e, ActionPlaces.MAIN_MENU, DataManager.getInstance().getDataContext(e.getComponent())); if (ActionUtil.lastUpdateAndCheckDumb(action, actionEvent, false)) return false; } return true; }
Example 3
Source File: MacGestureSupportForEditor.java From consulo with Apache License 2.0 | 6 votes |
private void fillActionsList(MouseShortcut mouseShortcut, boolean isModalContext) { myActions.clear(); // search in main keymap if (KeymapManagerImpl.ourKeymapManagerInitialized) { final KeymapManager keymapManager = KeymapManager.getInstance(); if (keymapManager != null) { final Keymap keymap = keymapManager.getActiveKeymap(); final String[] actionIds = keymap.getActionIds(mouseShortcut); ActionManager actionManager = ActionManager.getInstance(); for (String actionId : actionIds) { AnAction action = actionManager.getAction(actionId); if (action == null) continue; if (isModalContext && !action.isEnabledInModalContext()) continue; if (!myActions.contains(action)) { myActions.add(action); } } } } }
Example 4
Source File: FileTextFieldImpl.java From consulo with Apache License 2.0 | 5 votes |
@SuppressWarnings("HardCodedStringLiteral") 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()) { return true; } else { return false; } } else if ("togglePopup".equals(action)) { if (isPopupShowing()) { closePopup(); } else { suggestCompletion(true, true); } return true; } else { final Keymap active = KeymapManager.getInstance().getActiveKeymap(); final String[] ids = active.getActionIds(stroke); if (ids.length > 0 && IdeActions.ACTION_CODE_COMPLETION.equals(ids[0])) { suggestCompletion(true, true); } } return false; }