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


Java Keymap.addShortcut方法代码示例

本文整理汇总了Java中com.intellij.openapi.keymap.Keymap.addShortcut方法的典型用法代码示例。如果您正苦于以下问题:Java Keymap.addShortcut方法的具体用法?Java Keymap.addShortcut怎么用?Java Keymap.addShortcut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.openapi.keymap.Keymap的用法示例。


在下文中一共展示了Keymap.addShortcut方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: projectClosed

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
@Override
public void projectClosed() {
  final Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (course != null) {
    final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
    if (toolWindow != null) {
      toolWindow.getContentManager().removeAllContents(false);
    }
    KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
    for (Keymap keymap : keymapManager.getAllKeymaps()) {
      List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
      if (pairs != null && !pairs.isEmpty()) {
        for (Pair<String, String> actionShortcut : pairs) {
          keymap.addShortcut(actionShortcut.first, new KeyboardShortcut(KeyStroke.getKeyStroke(actionShortcut.second), null));
        }
      }
    }
  }
  myListener = null;
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:21,代码来源:StudyProjectComponent.java

示例3: 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

示例4: projectClosed

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
@Override
public void projectClosed() {
  final Course course = StudyTaskManager.getInstance(myProject).getCourse();
  if (course != null) {
    final ToolWindow toolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(StudyToolWindowFactory.STUDY_TOOL_WINDOW);
    if (toolWindow != null) {
      toolWindow.getContentManager().removeAllContents(false);
    }
    final ToolWindow progressToolWindow = ToolWindowManager.getInstance(myProject).getToolWindow(StudyProgressToolWindowFactory.ID);
    if (progressToolWindow != null) {
      progressToolWindow.getContentManager().removeAllContents(false);
    }
    KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
    for (Keymap keymap : keymapManager.getAllKeymaps()) {
      List<Pair<String, String>> pairs = myDeletedShortcuts.get(keymap);
      if (pairs != null && !pairs.isEmpty()) {
        for (Pair<String, String> actionShortcut : pairs) {
          keymap.addShortcut(actionShortcut.first, new KeyboardShortcut(KeyStroke.getKeyStroke(actionShortcut.second), null));
        }
      }
     }
  }
  myListener = null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:StudyProjectComponent.java

示例5: 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

示例6: 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

示例7: 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

示例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) {
    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

示例9: setActivateAndroidToolWindowShortcut

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private static void setActivateAndroidToolWindowShortcut(Keymap keymap) {
  KeyboardShortcut shortcut = removeFirstKeyboardShortcut(keymap, TODO_TOOLWINDOW_ACTION_ID);
  if (shortcut != null) {
    keymap.addShortcut(ANDROID_TOOLWINDOW_ACTION_ID, shortcut);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:AndroidInitialConfigurator.java

示例10: initComponent

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
public void initComponent(){
    final Keymap keymap = KeymapManagerImpl.getInstance().getActiveKeymap();
    keymap.addShortcut("generateTestMethod", new KeyboardShortcut(KeyStroke.getKeyStroke('U', InputEvent.CTRL_MASK + InputEvent.ALT_MASK), KeyStroke.getKeyStroke('U', 0)));
}
 
开发者ID:testNameGenerator,项目名称:PHPStorm-plugin,代码行数:5,代码来源:Shortcuts.java

示例11: 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

示例12: 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.addShortcut方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。