Example usage for com.intellij.openapi.keymap Keymap getConflicts

List of usage examples for com.intellij.openapi.keymap Keymap getConflicts

Introduction

In this page you can find the example usage for com.intellij.openapi.keymap Keymap getConflicts.

Prototype

@NotNull
    Map<String, List<KeyboardShortcut>> getConflicts(@NotNull String actionId,
            @NotNull KeyboardShortcut keyboardShortcut);

Source Link

Usage

From source file:com.maddyhome.idea.vim.group.KeyGroup.java

License:Open Source License

@NotNull
public List<AnAction> getKeymapConflicts(@NotNull KeyStroke keyStroke) {
    final KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
    final Keymap keymap = keymapManager.getActiveKeymap();
    final KeyboardShortcut shortcut = new KeyboardShortcut(keyStroke, null);
    final Map<String, ? extends List<KeyboardShortcut>> conflicts = keymap.getConflicts("", shortcut);
    final List<AnAction> actions = new ArrayList<AnAction>();
    for (String actionId : conflicts.keySet()) {
        final AnAction action = ActionManagerEx.getInstanceEx().getAction(actionId);
        if (action != null) {
            actions.add(action);//w  w  w . j  a va 2  s .  c o  m
        }
    }
    return actions;
}