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


Java Keymap.getActionIds方法代码示例

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


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

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private static boolean isOpenInNewWindow() {
  AWTEvent event = IdeEventQueue.getInstance().getTrueCurrentEvent();

  // Shift was used while clicking
  if (event instanceof MouseEvent &&
      ((MouseEvent)event).isShiftDown() &&
      (event.getID() == MouseEvent.MOUSE_CLICKED || event.getID() == MouseEvent.MOUSE_PRESSED || event.getID() == MouseEvent.MOUSE_RELEASED)) {
    return true;
  }

  if (event instanceof KeyEvent) {
    KeyEvent ke = (KeyEvent)event;
    Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
    String[] ids = keymap.getActionIds(KeyStroke.getKeyStroke(ke.getKeyCode(), ke.getModifiers()));
    return Arrays.asList(ids).contains("OpenElementInNewWindow");
  }

  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:FileEditorManagerImpl.java

示例4: isMouseActionEvent

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private static boolean isMouseActionEvent(@Nonnull MouseEvent e, String actionId) {
  KeymapManager keymapManager = KeymapManager.getInstance();
  if (keymapManager == null) return false;
  Keymap keymap = keymapManager.getActiveKeymap();
  if (keymap == null) return false;
  MouseShortcut mouseShortcut = KeymapUtil.createMouseShortcut(e);
  String[] mappedActions = keymap.getActionIds(mouseShortcut);
  if (!ArrayUtil.contains(actionId, mappedActions)) return false;
  if (mappedActions.length < 2) return true;
  ActionManager actionManager = ActionManager.getInstance();
  for (String mappedActionId : mappedActions) {
    if (actionId.equals(mappedActionId)) continue;
    AnAction action = actionManager.getAction(mappedActionId);
    AnActionEvent actionEvent =
            AnActionEvent.createFromAnAction(action, e, ActionPlaces.MAIN_MENU, DataManager.getInstance().getDataContext(e.getComponent()));
    if (ActionUtil.lastUpdateAndCheckDumb(action, actionEvent, false)) return false;
  }
  return true;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:EditorImpl.java

示例5: fillActionsList

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private void fillActionsList(MouseShortcut mouseShortcut, boolean isModalContext) {
  myActions.clear();

  // search in main keymap
  if (KeymapManagerImpl.ourKeymapManagerInitialized) {
    final KeymapManager keymapManager = KeymapManager.getInstance();
    if (keymapManager != null) {
      final Keymap keymap = keymapManager.getActiveKeymap();
      final String[] actionIds = keymap.getActionIds(mouseShortcut);

      ActionManager actionManager = ActionManager.getInstance();
      for (String actionId : actionIds) {
        AnAction action = actionManager.getAction(actionId);

        if (action == null) continue;

        if (isModalContext && !action.isEnabledInModalContext()) continue;

        if (!myActions.contains(action)) {
          myActions.add(action);
        }
      }
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:MacGestureSupportForEditor.java

示例6: togglePopup

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
@SuppressWarnings("HardCodedStringLiteral")
private boolean togglePopup(KeyEvent e) {
  final KeyStroke stroke = KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers());
  final Object action = ((InputMap)UIManager.get("ComboBox.ancestorInputMap")).get(stroke);
  if ("selectNext".equals(action)) {
    if (!isPopupShowing()) {
      return true;
    }
    else {
      return false;
    }
  }
  else if ("togglePopup".equals(action)) {
    if (isPopupShowing()) {
      closePopup();
    }
    else {
      suggestCompletion(true, true);
    }
    return true;
  }
  else {
    final Keymap active = KeymapManager.getInstance().getActiveKeymap();
    final String[] ids = active.getActionIds(stroke);
    if (ids.length > 0 && IdeActions.ACTION_CODE_COMPLETION.equals(ids[0])) {
      suggestCompletion(true, true);
    }
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:FileTextFieldImpl.java

示例7: togglePopup

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
private boolean togglePopup(KeyEvent e) {
  final KeyStroke stroke = KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers());
  final Object action = ((InputMap)UIManager.get("ComboBox.ancestorInputMap")).get(stroke);
  if ("selectNext".equals(action)) {
    if (!isPopupShowing() && myAutoPopup) {
      showPopup(true);
      return true;
    }
    else {
      return false;
    }
  }
  else if ("togglePopup".equals(action)) {
    if (isPopupShowing()) {
      hideCurrentPopup();
    }
    else {
      showPopup(true);
    }
    return true;
  }
  else {
    final Keymap active = KeymapManager.getInstance().getActiveKeymap();
    final String[] ids = active.getActionIds(stroke);
    if (ids.length > 0 && "CodeCompletion".equals(ids[0])) {
      showPopup(true);
    }
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:SearchSupport.java

示例8: main

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
@Override
public void main(String[] args) {
  StringBuilder xml = new StringBuilder();
  xml.append("<Keymaps>\n");

  for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) {
    xml.append("  <Keymap name=\"").append(keymap.getName()).append("\">\n");
    for (String id : keymap.getActionIds()) {
      String shortcuts = KeymapUtil.getShortcutsText(keymap.getShortcuts(id));
      if (!StringUtil.isEmpty(shortcuts)) {
        xml.append("    <Action id=\"").append(id).append("\">\n");
        for (Shortcut shortcut : keymap.getShortcuts(id)) {
          xml.append("      <Shortcut>").append(KeymapUtil.getShortcutText(shortcut)).append("</Shortcut>\n");
        }
        xml.append("    </Action>\n");
      }
    }
    xml.append("  </Keymap>\n");
  }
  xml.append("</Keymaps>");

  final String path = args.length == 2 ? args[1] : PathManager.getHomePath() + File.separator + "AllKeymaps.xml";

  File out = new File(path);
  try {
    FileUtil.writeToFile(out, xml.toString());
    System.out.println("Saved to: " + out.getAbsolutePath());
  }
  catch (IOException e) {
    e.printStackTrace();
    System.exit(1);
  }
  System.exit(0);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:KeymapGenerator.java

示例9: projectOpened

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
@Override
public void projectOpened() {
  final KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
  final String prefix = AntConfiguration.getActionIdPrefix(myProject);
  final ActionManager actionManager = ActionManager.getInstance();

  for (Keymap keymap : keymapManager.getAllKeymaps()) {
    for (String id : keymap.getActionIds()) {
      if (id.startsWith(prefix) && actionManager.getAction(id) == null) {
        actionManager.registerAction(id, new TargetActionStub(id, myProject));
      }
    }      
  }
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:15,代码来源:AntToolwindowRegistrar.java

示例10: main

import com.intellij.openapi.keymap.Keymap; //导入方法依赖的package包/类
@Override
public void main(String[] args) {
  ActionManager actionManager = ActionManager.getInstance();
  StringBuilder xml = new StringBuilder();
  xml.append("<Keymaps>\n");

  for (Keymap keymap : KeymapManagerEx.getInstanceEx().getAllKeymaps()) {

    xml.append("  <Keymap name=\"").append(keymap.getPresentableName()).append("\">\n");
    for (String id : keymap.getActionIds()) {
      String shortcuts = KeymapUtil.getShortcutsText(keymap.getShortcuts(id));
      if (!StringUtil.isEmpty(shortcuts)) {
        AnAction action = actionManager.getAction(id);
        xml.append("    <Action id=\"").append(id).append("\">\n");
        Set<String> addedShortcuts = new THashSet<String>();
        for (Shortcut shortcut : keymap.getShortcuts(id)) {
          // Different shortcuts may have equal display strings (e.g. shift+minus and shift+subtract)
          // We don't want them do be duplicated for users
          String shortcutText = KeymapUtil.getShortcutText(shortcut);
          if (addedShortcuts.add(shortcutText)) {
            xml.append("      <Shortcut>").append(shortcutText).append("</Shortcut>\n");
          }
        }
        if (action != null) {
          String text = action.getTemplatePresentation().getText();
          if (text != null) {
            xml.append("      <Text>").append(StringUtil.escapeXml(text)).append("</Text>\n");
          }
        }
        xml.append("    </Action>\n");
      }
    }
    xml.append("  </Keymap>\n");
  }
  xml.append("</Keymaps>");

  final String path = args.length == 2 ? args[1] : PathManager.getHomePath() + File.separator + "AllKeymaps.xml";

  File out = new File(path);
  try {
    FileUtil.writeToFile(out, xml.toString());
    System.out.println("Saved to: " + out.getAbsolutePath());
  }
  catch (IOException e) {
    e.printStackTrace();
    System.exit(1);
  }
  System.exit(0);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:50,代码来源:KeymapGenerator.java


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