当前位置: 首页>>代码示例>>Java>>正文


Java Keymap.removeShortcut方法代码示例

本文整理汇总了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);
    }
  }
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:20,代码来源:StudyProjectComponent.java

示例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);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:StudyProjectComponent.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ActionManagerImpl.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:EditorMultiCaretTest.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:AndroidInitialConfigurator.java

示例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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:35,代码来源:ActionManagerImpl.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:46,代码来源:ActionManagerImpl.java

示例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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:46,代码来源:ActionManagerImpl.java

示例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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:46,代码来源:ActionManagerImpl.java


注:本文中的com.intellij.openapi.keymap.Keymap.removeShortcut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。