本文整理汇总了Java中com.intellij.openapi.keymap.Keymap.removeShortcut方法的典型用法代码示例。如果您正苦于以下问题:Java Keymap.removeShortcut方法的具体用法?Java Keymap.removeShortcut怎么用?Java Keymap.removeShortcut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.keymap.Keymap
的用法示例。
在下文中一共展示了Keymap.removeShortcut方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addShortcut
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
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);
}
}
}
示例2: addShortcut
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
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<Pair<String, String>>();
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);
}
}
}
示例3: processMouseShortcutNode
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private static void processMouseShortcutNode(Element element, String actionId, PluginId pluginId) {
String keystrokeString = element.getAttributeValue(KEYSTROKE_ATTR_NAME);
if (keystrokeString == null || keystrokeString.trim().isEmpty()) {
reportActionError(pluginId, "\"keystroke\" attribute must be specified for action with id=" + actionId);
return;
}
MouseShortcut shortcut;
try {
shortcut = KeymapUtil.parseMouseShortcut(keystrokeString);
}
catch (Exception ex) {
reportActionError(pluginId, "\"keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
String keymapName = element.getAttributeValue(KEYMAP_ATTR_NAME);
if (keymapName == null || keymapName.isEmpty()) {
reportActionError(pluginId, "attribute \"keymap\" should be defined");
return;
}
Keymap keymap = KeymapManager.getInstance().getKeymap(keymapName);
if (keymap == null) {
reportActionError(pluginId, "keymap \"" + keymapName + "\" not found");
return;
}
final String removeOption = element.getAttributeValue(REMOVE_SHORTCUT_ATTR_NAME);
if (Boolean.valueOf(removeOption)) {
keymap.removeShortcut(actionId, shortcut);
} else {
keymap.addShortcut(actionId, shortcut);
}
}
示例4: doWithAltClickShortcut
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private static void doWithAltClickShortcut(ThrowableRunnable runnable) throws Throwable {
Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
MouseShortcut shortcut = new MouseShortcut(1, InputEvent.ALT_DOWN_MASK, 1);
try {
keymap.addShortcut(IdeActions.ACTION_EDITOR_ADD_OR_REMOVE_CARET, shortcut);
runnable.run();
}
finally {
keymap.removeShortcut(IdeActions.ACTION_EDITOR_ADD_OR_REMOVE_CARET, shortcut);
}
}
示例5: removeFirstKeyboardShortcut
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
@Nullable
private static KeyboardShortcut removeFirstKeyboardShortcut(Keymap keymap, String actionId) {
Shortcut[] shortcuts = keymap.getShortcuts(actionId);
for (Shortcut each : shortcuts) {
if (each instanceof KeyboardShortcut) {
keymap.removeShortcut(actionId, each);
return (KeyboardShortcut)each;
}
}
return null;
}
示例6: processMouseShortcutNode
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private static void processMouseShortcutNode(Element element, String actionId, PluginId pluginId) {
String keystrokeString = element.getAttributeValue(KEYSTROKE_ATTR_NAME);
if (keystrokeString == null || keystrokeString.trim().length() == 0) {
reportActionError(pluginId, "\"keystroke\" attribute must be specified for action with id=" + actionId);
return;
}
MouseShortcut shortcut;
try {
shortcut = KeymapUtil.parseMouseShortcut(keystrokeString);
}
catch (Exception ex) {
reportActionError(pluginId, "\"keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
String keymapName = element.getAttributeValue(KEYMAP_ATTR_NAME);
if (keymapName == null || keymapName.length() == 0) {
reportActionError(pluginId, "attribute \"keymap\" should be defined");
return;
}
Keymap keymap = KeymapManager.getInstance().getKeymap(keymapName);
if (keymap == null) {
reportActionError(pluginId, "keymap \"" + keymapName + "\" not found");
return;
}
final String removeOption = element.getAttributeValue(REMOVE_SHORTCUT_ATTR_NAME);
if (Boolean.valueOf(removeOption)) {
keymap.removeShortcut(actionId, shortcut);
}
else {
keymap.addShortcut(actionId, shortcut);
}
}
示例7: processKeyboardShortcutNode
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private void processKeyboardShortcutNode(Element element, String actionId, PluginId pluginId) {
String firstStrokeString = element.getAttributeValue(FIRST_KEYSTROKE_ATTR_NAME);
if (firstStrokeString == null) {
reportActionError(pluginId, "\"first-keystroke\" attribute must be specified for action with id=" + actionId);
return;
}
KeyStroke firstKeyStroke = getKeyStroke(firstStrokeString);
if (firstKeyStroke == null) {
reportActionError(pluginId, "\"first-keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
KeyStroke secondKeyStroke = null;
String secondStrokeString = element.getAttributeValue(SECOND_KEYSTROKE_ATTR_NAME);
if (secondStrokeString != null) {
secondKeyStroke = getKeyStroke(secondStrokeString);
if (secondKeyStroke == null) {
reportActionError(pluginId, "\"second-keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
}
String keymapName = element.getAttributeValue(KEYMAP_ATTR_NAME);
if (keymapName == null || keymapName.trim().isEmpty()) {
reportActionError(pluginId, "attribute \"keymap\" should be defined");
return;
}
Keymap keymap = myKeymapManager.getKeymap(keymapName);
if (keymap == null) {
reportActionWarning(pluginId, "keymap \"" + keymapName + "\" not found");
return;
}
final String removeOption = element.getAttributeValue(REMOVE_SHORTCUT_ATTR_NAME);
final KeyboardShortcut shortcut = new KeyboardShortcut(firstKeyStroke, secondKeyStroke);
final String replaceOption = element.getAttributeValue(REPLACE_SHORTCUT_ATTR_NAME);
if (Boolean.valueOf(removeOption)) {
keymap.removeShortcut(actionId, shortcut);
}
if (Boolean.valueOf(replaceOption)) {
keymap.removeAllActionShortcuts(actionId);
}
if (!Boolean.valueOf(removeOption)) {
keymap.addShortcut(actionId, shortcut);
}
}
示例8: processKeyboardShortcutNode
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private void processKeyboardShortcutNode(Element element, String actionId, PluginId pluginId) {
String firstStrokeString = element.getAttributeValue(FIRST_KEYSTROKE_ATTR_NAME);
if (firstStrokeString == null) {
reportActionError(pluginId, "\"first-keystroke\" attribute must be specified for action with id=" + actionId);
return;
}
KeyStroke firstKeyStroke = getKeyStroke(firstStrokeString);
if (firstKeyStroke == null) {
reportActionError(pluginId, "\"first-keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
KeyStroke secondKeyStroke = null;
String secondStrokeString = element.getAttributeValue(SECOND_KEYSTROKE_ATTR_NAME);
if (secondStrokeString != null) {
secondKeyStroke = getKeyStroke(secondStrokeString);
if (secondKeyStroke == null) {
reportActionError(pluginId, "\"second-keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
}
String keymapName = element.getAttributeValue(KEYMAP_ATTR_NAME);
if (keymapName == null || keymapName.trim().isEmpty()) {
reportActionError(pluginId, "attribute \"keymap\" should be defined");
return;
}
Keymap keymap = myKeymapManager.getKeymap(keymapName);
if (keymap == null) {
reportActionError(pluginId, "keymap \"" + keymapName + "\" not found");
return;
}
final String removeOption = element.getAttributeValue(REMOVE_SHORTCUT_ATTR_NAME);
final KeyboardShortcut shortcut = new KeyboardShortcut(firstKeyStroke, secondKeyStroke);
final String replaceOption = element.getAttributeValue(REPLACE_SHORTCUT_ATTR_NAME);
if (Boolean.valueOf(removeOption)) {
keymap.removeShortcut(actionId, shortcut);
}
if (Boolean.valueOf(replaceOption)) {
keymap.removeAllActionShortcuts(actionId);
}
if (!Boolean.valueOf(removeOption)) {
keymap.addShortcut(actionId, shortcut);
}
}
示例9: processKeyboardShortcutNode
import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private void processKeyboardShortcutNode(Element element, String actionId, PluginId pluginId) {
String firstStrokeString = element.getAttributeValue(FIRST_KEYSTROKE_ATTR_NAME);
if (firstStrokeString == null) {
reportActionError(pluginId, "\"first-keystroke\" attribute must be specified for action with id=" + actionId);
return;
}
KeyStroke firstKeyStroke = getKeyStroke(firstStrokeString);
if (firstKeyStroke == null) {
reportActionError(pluginId, "\"first-keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
KeyStroke secondKeyStroke = null;
String secondStrokeString = element.getAttributeValue(SECOND_KEYSTROKE_ATTR_NAME);
if (secondStrokeString != null) {
secondKeyStroke = getKeyStroke(secondStrokeString);
if (secondKeyStroke == null) {
reportActionError(pluginId, "\"second-keystroke\" attribute has invalid value for action with id=" + actionId);
return;
}
}
String keymapName = element.getAttributeValue(KEYMAP_ATTR_NAME);
if (keymapName == null || keymapName.trim().length() == 0) {
reportActionError(pluginId, "attribute \"keymap\" should be defined");
return;
}
Keymap keymap = myKeymapManager.getKeymap(keymapName);
if (keymap == null) {
reportActionError(pluginId, "keymap \"" + keymapName + "\" not found");
return;
}
final String removeOption = element.getAttributeValue(REMOVE_SHORTCUT_ATTR_NAME);
final KeyboardShortcut shortcut = new KeyboardShortcut(firstKeyStroke, secondKeyStroke);
final String replaceOption = element.getAttributeValue(REPLACE_SHORTCUT_ATTR_NAME);
if (Boolean.valueOf(removeOption)) {
keymap.removeShortcut(actionId, shortcut);
}
if (Boolean.valueOf(replaceOption)) {
keymap.removeAllActionShortcuts(actionId);
}
if (!Boolean.valueOf(removeOption)) {
keymap.addShortcut(actionId, shortcut);
}
}