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();
}
use of com.intellij.openapi.keymap.KeymapManager in project intellij-community by JetBrains.
the class ShadowAction method disconnect.
private void disconnect() {
final KeymapManager mgr = getKeymapManager();
if (mgr == null)
return;
mgr.removeKeymapManagerListener(myKeymapManagerListener);
if (myKeymap != null) {
myKeymap.removeShortcutChangeListener(myKeymapListener);
}
}
use of com.intellij.openapi.keymap.KeymapManager in project intellij-community by JetBrains.
the class ShadowAction method rebound.
private void rebound() {
final KeymapManager mgr = getKeymapManager();
if (mgr == null)
return;
myActionId = ActionManager.getInstance().getId(myCopyFromAction);
if (myPresentation == null) {
myAction.copyFrom(myCopyFromAction);
} else {
myAction.getTemplatePresentation().copyFrom(myPresentation);
myAction.copyShortcutFrom(myCopyFromAction);
}
unregisterAll();
myKeymap = mgr.getActiveKeymap();
myKeymap.addShortcutChangeListener(myKeymapListener);
if (myActionId == null)
return;
final Shortcut[] shortcuts = myKeymap.getShortcuts(myActionId);
myShortcutSet = new CustomShortcutSet(shortcuts);
myAction.registerCustomShortcutSet(myShortcutSet, myComponent);
}
use of com.intellij.openapi.keymap.KeymapManager in project intellij-community by JetBrains.
the class EditorImpl method isMouseActionEvent.
private static boolean isMouseActionEvent(@NotNull MouseEvent e, String actionId) {
KeymapManager keymapManager = KeymapManager.getInstance();
if (keymapManager == null)
return false;
Keymap keymap = keymapManager.getActiveKeymap();
if (keymap == null)
return false;
MouseShortcut mouseShortcut = KeymapUtil.createMouseShortcut(e);
String[] mappedActions = keymap.getActionIds(mouseShortcut);
if (!ArrayUtil.contains(actionId, mappedActions))
return false;
if (mappedActions.length < 2)
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;
}
Aggregations