use of com.intellij.openapi.keymap.KeymapManager in project kotlin by JetBrains.
the class AndroidLintExternalAnnotator method getShowMoreShortCut.
private String getShowMoreShortCut() {
if (myShortcutText == null) {
final KeymapManager keymapManager = KeymapManager.getInstance();
if (keymapManager != null) {
final Keymap keymap = keymapManager.getActiveKeymap();
myShortcutText = keymap == null ? "" : "(" + KeymapUtil.getShortcutsText(keymap.getShortcuts(IdeActions.ACTION_SHOW_ERROR_DESCRIPTION)) + ")";
} else {
myShortcutText = "";
}
}
return myShortcutText;
}
use of com.intellij.openapi.keymap.KeymapManager in project intellij-community by JetBrains.
the class IdeMouseEventDispatcher method fillActionsList.
private void fillActionsList(Component component, MouseShortcut mouseShortcut, boolean isModalContext) {
myActions.clear();
// here we try to find "local" shortcuts
for (; component != null; component = component.getParent()) {
if (component instanceof JComponent) {
for (AnAction action : ActionUtil.getActions((JComponent) component)) {
for (Shortcut shortcut : action.getShortcutSet().getShortcuts()) {
if (mouseShortcut.equals(shortcut) && !myActions.contains(action)) {
myActions.add(action);
}
}
}
// once we've found a proper local shortcut(s), we exit
if (!myActions.isEmpty()) {
return;
}
}
}
// search in main keymap
KeymapManager keymapManager = KeymapManagerImpl.ourKeymapManagerInitialized ? KeymapManager.getInstance() : null;
if (keymapManager != null) {
Keymap keymap = keymapManager.getActiveKeymap();
ActionManager actionManager = ActionManager.getInstance();
for (String actionId : keymap.getActionIds(mouseShortcut)) {
AnAction action = actionManager.getAction(actionId);
if (action == null || isModalContext && !action.isEnabledInModalContext()) {
continue;
}
if (!myActions.contains(action)) {
myActions.add(action);
}
}
}
}
use of com.intellij.openapi.keymap.KeymapManager in project intellij-community by JetBrains.
the class CommonShortcuts method shortcutsById.
@NotNull
private static CustomShortcutSet shortcutsById(String actionId) {
Application application = ApplicationManager.getApplication();
KeymapManager keymapManager = application == null ? null : application.getComponent(KeymapManager.class);
if (keymapManager == null) {
return new CustomShortcutSet(Shortcut.EMPTY_ARRAY);
}
return new CustomShortcutSet(keymapManager.getActiveKeymap().getShortcuts(actionId));
}
use of com.intellij.openapi.keymap.KeymapManager in project intellij-community by JetBrains.
the class MacGestureSupportForEditor method fillActionsList.
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);
}
}
}
}
}
use of com.intellij.openapi.keymap.KeymapManager in project intellij-community by JetBrains.
the class ShadowAction method _connect.
private void _connect() {
disconnect();
final KeymapManager mgr = getKeymapManager();
if (mgr == null)
return;
mgr.addKeymapManagerListener(myKeymapManagerListener);
rebound();
}
Aggregations