use of com.intellij.openapi.keymap.Keymap in project intellij-community by JetBrains.
the class PyCharmEduInitialConfigurator method patchKeymap.
private static void patchKeymap() {
Set<String> droppedActions = ContainerUtil.newHashSet("AddToFavoritesPopup", "DatabaseView.ImportDataSources", "CompileDirty", "Compile", // hidden
"AddNewFavoritesList", "EditFavorites", "RenameFavoritesList", "RemoveFavoritesList");
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
if (keymap.canModify())
continue;
KeymapImpl keymapImpl = (KeymapImpl) keymap;
for (String id : keymapImpl.getOwnActionIds()) {
if (droppedActions.contains(id))
keymapImpl.clearOwnActionsId(id);
}
}
}
use of com.intellij.openapi.keymap.Keymap in project intellij-community by JetBrains.
the class MavenShortcutsManager method getShortcuts.
@NotNull
private Shortcut[] getShortcuts(MavenProject project, String goal) {
String actionId = getActionId(project.getPath(), goal);
if (actionId == null)
return Shortcut.EMPTY_ARRAY;
Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
return activeKeymap.getShortcuts(actionId);
}
use of com.intellij.openapi.keymap.Keymap in project intellij-community by JetBrains.
the class GrInplaceVariableIntroducer method getAdvertisementText.
@Nullable
private static String getAdvertisementText() {
final Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
final Shortcut[] shortcuts = keymap.getShortcuts("PreviousTemplateVariable");
if (shortcuts.length > 0) {
return "Press " + KeymapUtil.getShortcutText(shortcuts[0]) + " to change type";
}
return null;
}
use of com.intellij.openapi.keymap.Keymap in project intellij-community by JetBrains.
the class StudyProjectComponent method addShortcut.
private void addShortcut(@NotNull final String actionIdString, @NotNull final String[] shortcuts) {
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
if (pairs == null) {
pairs = new ArrayList<>();
myDeletedShortcuts.put(keymap, pairs);
}
for (String shortcutString : shortcuts) {
Shortcut studyActionShortcut = new KeyboardShortcut(KeyStroke.getKeyStroke(shortcutString), null);
String[] actionsIds = keymap.getActionIds(studyActionShortcut);
for (String actionId : actionsIds) {
pairs.add(Pair.create(actionId, shortcutString));
keymap.removeShortcut(actionId, studyActionShortcut);
}
keymap.addShortcut(actionIdString, studyActionShortcut);
}
}
}
use of com.intellij.openapi.keymap.Keymap in project ideavim by JetBrains.
the class KeyGroup method getKeymapActions.
@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);
}
}
return results;
}
Aggregations