use of com.intellij.openapi.actionSystem.Shortcut in project intellij-plugins by StepicOrg.
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 = deletedShortcuts.computeIfAbsent(keymap, k -> new ArrayList<>());
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.actionSystem.Shortcut in project android by JetBrains.
the class HotswapAction method getShortcutText.
@Nullable
private static String getShortcutText() {
Keymap activeKeymap = KeymapManager.getInstance().getActiveKeymap();
Shortcut[] shortcuts = activeKeymap.getShortcuts("Android.HotswapChanges");
return shortcuts.length > 0 ? " (" + KeymapUtil.getShortcutText(shortcuts[0]) + ") " : "";
}
use of com.intellij.openapi.actionSystem.Shortcut in project intellij-community by JetBrains.
the class GotoTestOrCodeHandler method getAdText.
@Nullable
@Override
protected String getAdText(PsiElement source, int length) {
if (length > 0 && !TestFinderHelper.isTest(source)) {
final Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
final Shortcut[] shortcuts = keymap.getShortcuts(DefaultRunExecutor.getRunExecutorInstance().getContextActionId());
if (shortcuts.length > 0) {
return ("Press " + KeymapUtil.getShortcutText(shortcuts[0]) + " to run selected tests");
}
}
return null;
}
use of com.intellij.openapi.actionSystem.Shortcut in project intellij-community by JetBrains.
the class ShortcutFilteringPanel method setShortcut.
void setShortcut(Shortcut shortcut) {
Shortcut old = myShortcut;
if (old != null || shortcut != null) {
myShortcut = shortcut;
firePropertyChange("shortcut", old, shortcut);
}
}
use of com.intellij.openapi.actionSystem.Shortcut in project intellij-community by JetBrains.
the class JBTerminalSystemSettingsProviderBase method getKeyStrokesByActionId.
private KeyStroke[] getKeyStrokesByActionId(String actionId) {
java.util.List<KeyStroke> keyStrokes = new ArrayList<>();
Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(actionId);
for (Shortcut sc : shortcuts) {
if (sc instanceof KeyboardShortcut) {
KeyStroke ks = ((KeyboardShortcut) sc).getFirstKeyStroke();
keyStrokes.add(ks);
}
}
return keyStrokes.toArray(new KeyStroke[keyStrokes.size()]);
}
Aggregations