Java 类com.intellij.openapi.actionSystem.impl.ActionManagerImpl 实例源码

项目:intellij-ce-playground    文件:ToolWindowContentUi.java   
public void showContextMenu(Component comp, int x, int y, ActionGroup toolWindowGroup, @Nullable Content selectedContent) {
  if (selectedContent == null && toolWindowGroup == null) {
    return;
  }
  DefaultActionGroup group = new DefaultActionGroup();
  if (selectedContent != null) {
    initActionGroup(group, selectedContent);
  }

  if (toolWindowGroup != null) {
    group.addAll(toolWindowGroup);
  }

  final ActionPopupMenu popupMenu =
    ((ActionManagerImpl)ActionManager.getInstance()).createActionPopupMenu(POPUP_PLACE, group, new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(comp, x, y);
}
项目:intellij-ce-playground    文件:TraverseUIStarter.java   
private static void processKeymap(final Element configurableElement){
  final ActionManager actionManager = ActionManager.getInstance();
  final String componentName = actionManager.getComponentName();
  final SearchableOptionsRegistrar searchableOptionsRegistrar = SearchableOptionsRegistrar.getInstance();
  final Set<String> ids = ((ActionManagerImpl)actionManager).getActionIds();
  final TreeSet<OptionDescription> options = new TreeSet<OptionDescription>();
  for (String id : ids) {
    final AnAction anAction = actionManager.getAction(id);
    final String text = anAction.getTemplatePresentation().getText();
    if (text != null) {
      collectOptions(searchableOptionsRegistrar, options, text, componentName);
    }
    final String description = anAction.getTemplatePresentation().getDescription();
    if (description != null) {
      collectOptions(searchableOptionsRegistrar, options, description, componentName);
    }
  }
  writeOptions(configurableElement, options);
}
项目:intellij-ce-playground    文件:GotoActionItemProvider.java   
private boolean processActions(String pattern, boolean everywhere, Processor<MatchedValue> consumer, DataContext dataContext) {
  Set<AnAction> actions = new THashSet<AnAction>(ACTION_OBJECT_HASHING_STRATEGY);
  if (everywhere) {
    for (String id : ((ActionManagerImpl)myActionManager).getActionIds()) {
      ProgressManager.checkCanceled();
      ContainerUtil.addIfNotNull(actions, myActionManager.getAction(id));
    }
  } else {
    actions.addAll(myModel.myActionGroups.keySet());
  }

  List<ActionWrapper> actionWrappers = ContainerUtil.newArrayList();
  for (AnAction action : actions) {
    ProgressManager.checkCanceled();
    MatchMode mode = myModel.actionMatches(pattern, action);
    if (mode != MatchMode.NONE) {
      actionWrappers.add(new ActionWrapper(action, myModel.myActionGroups.get(action), mode, dataContext));
    }
  }
  return processItems(pattern, actionWrappers, consumer);
}
项目:tools-idea    文件:ToolWindowContentUi.java   
public void showContextMenu(Component comp, int x, int y, ActionGroup toolWindowGroup, @Nullable Content selectedContent) {
  if (selectedContent == null && toolWindowGroup == null) {
    return;
  }
  DefaultActionGroup group = new DefaultActionGroup();
  if (selectedContent != null) {
    initActionGroup(group, selectedContent);
  }

  if (toolWindowGroup != null) {
    group.addAll(toolWindowGroup);
  }

  final ActionPopupMenu popupMenu =
    ((ActionManagerImpl)ActionManager.getInstance()).createActionPopupMenu(POPUP_PLACE, group, new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(comp, x, y);
}
项目:tools-idea    文件:TraverseUIStarter.java   
private static void processKeymap(final Element configurableElement){
  final ActionManager actionManager = ActionManager.getInstance();
  final String componentName = actionManager.getComponentName();
  final SearchableOptionsRegistrar searchableOptionsRegistrar = SearchableOptionsRegistrar.getInstance();
  final Set<String> ids = ((ActionManagerImpl)actionManager).getActionIds();
  final TreeSet<OptionDescription> options = new TreeSet<OptionDescription>();
  for (String id : ids) {
    final AnAction anAction = actionManager.getAction(id);
    final String text = anAction.getTemplatePresentation().getText();
    if (text != null) {
      collectOptions(searchableOptionsRegistrar, options, text, componentName);
    }
    final String description = anAction.getTemplatePresentation().getDescription();
    if (description != null) {
      collectOptions(searchableOptionsRegistrar, options, description, componentName);
    }
  }
  writeOptions(configurableElement, options);
}
项目:tools-idea    文件:GotoActionModel.java   
@Override
@NotNull
public String[] getNames(boolean checkBoxState) {
  final ArrayList<String> result = new ArrayList<String>();
  for (AnAction action : myActionsMap.keySet()) {
    result.add(getActionId(action));
  }
  if (checkBoxState) {
    final Set<String> ids = ((ActionManagerImpl)myActionManager).getActionIds();
    for (String id : ids) {
      result.add(id);
    }
  }
  result.add(SETTINGS_KEY);
  return ArrayUtil.toStringArray(result);
}
项目:consulo    文件:UnifiedToolWindowContentUI.java   
public void showContextMenu(Component comp, int x, int y, ActionGroup toolWindowGroup, @Nullable Content selectedContent) {
  if (selectedContent == null && toolWindowGroup == null) {
    return;
  }
  DefaultActionGroup group = new DefaultActionGroup();
  if (selectedContent != null) {
    initActionGroup(group, selectedContent);
  }

  if (toolWindowGroup != null) {
    group.addAll(toolWindowGroup);
  }

  final ActionPopupMenu popupMenu = ((ActionManagerImpl)ActionManager.getInstance()).createActionPopupMenu(POPUP_PLACE, group, new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(comp, x, y);
}
项目:consulo    文件:GotoActionItemProvider.java   
private boolean processActions(String pattern, boolean everywhere, Processor<MatchedValue> consumer, DataContext dataContext) {
  List<AnAction> actions = ContainerUtil.newArrayList();
  if (everywhere) {
    for (String id : ((ActionManagerImpl)myActionManager).getActionIds()) {
      ProgressManager.checkCanceled();
      ContainerUtil.addIfNotNull(actions, myActionManager.getAction(id));
    }
  } else {
    actions.addAll(myModel.myActionGroups.keySet());
  }

  List<ActionWrapper> actionWrappers = ContainerUtil.newArrayList();
  for (AnAction action : actions) {
    ProgressManager.checkCanceled();
    MatchMode mode = myModel.actionMatches(pattern, action);
    if (mode != MatchMode.NONE) {
      actionWrappers.add(new ActionWrapper(action, myModel.myActionGroups.get(action), mode, dataContext));
    }
  }
  return processItems(pattern, actionWrappers, consumer);
}
项目:consulo    文件:DesktopToolWindowContentUi.java   
public void showContextMenu(Component comp, int x, int y, ActionGroup toolWindowGroup, @Nullable Content selectedContent) {
  if (selectedContent == null && toolWindowGroup == null) {
    return;
  }
  DefaultActionGroup group = new DefaultActionGroup();
  if (selectedContent != null) {
    initActionGroup(group, selectedContent);
  }

  if (toolWindowGroup != null) {
    group.addAll(toolWindowGroup);
  }

  final ActionPopupMenu popupMenu =
          ((ActionManagerImpl)ActionManager.getInstance()).createActionPopupMenu(POPUP_PLACE, group, new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(comp, x, y);
}
项目:react-native-console    文件:RunIOSDevicesAction.java   
private void showDevicesPopup(Component component, int x, int y, DefaultActionGroup defaultActionGroup) {
    ActionPopupMenu popupMenu =
            ((ActionManagerImpl) ActionManager.getInstance())
                    .createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, defaultActionGroup,
                            new MenuItemPresentationFactory(false));// don't set forceHide to true, otherwise icons will be hidden in menu item
    popupMenu.getComponent().show(component, x, y);
}
项目:HakunaMatataIntelliJPlugin    文件:AbstractRichStringBasedPostfixTemplate.java   
protected void onTemplateFinished(TemplateManager manager, Editor editor, Template template) {
    // format and add ;
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "EditorCompleteStatement";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
项目:android-postfix-plugin    文件:FindViewByIdFieldTemplate.java   
@Override
protected void onTemplateFinished(final TemplateManager manager, final Editor editor, Template template) {
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "IntroduceField";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
项目:android-postfix-plugin    文件:FindViewByIdVariableTemplate.java   
@Override
protected void onTemplateFinished(final TemplateManager manager, final Editor editor, Template template) {
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "IntroduceVariable";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
项目:android-postfix-plugin    文件:AbstractRichStringBasedPostfixTemplate.java   
protected void onTemplateFinished(TemplateManager manager, Editor editor, Template template) {
    // format and add ;
    final ActionManager actionManager = ActionManagerImpl.getInstance();
    final String editorCompleteStatementText = "EditorCompleteStatement";
    final AnAction action = actionManager.getAction(editorCompleteStatementText);
    actionManager.tryToExecute(action, ActionCommand.getInputEvent(editorCompleteStatementText), null, ActionPlaces.UNKNOWN, true);
}
项目:consulo    文件:BranchActionGroupPopup.java   
private void createTitlePanelToolbar(@Nonnull String dimensionKey) {
  JPanel panel = new NonOpaquePanel();
  panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
  myRestoreSizeButton = new MyToolbarButton("Restore Size", CollapseComponent, CollapseComponentHover, e -> {
    WindowStateService.getInstance(myProject).putSizeFor(myProject, dimensionKey, null);
    myInternalSizeChanged = true;
    pack(true, true);
  }) {
    @Override
    protected boolean isButtonEnabled() {
      return myUserSizeChanged;
    }
  };
  mySettingsButton = new MyToolbarButton("Settings", AllIcons.General.Gear, AllIcons.General.GearHover, e -> {
    final ActionPopupMenu popupMenu = ((ActionManagerImpl)ActionManager.getInstance()).createActionPopupMenu(BRANCH_POPUP, new DefaultActionGroup(mySettingsActions));
    popupMenu.getComponent().show(mySettingsButton, 0, assertNotNull(mySettingsButton).getHeight());
  }) {
    @Override
    protected boolean isButtonEnabled() {
      return !mySettingsActions.isEmpty();
    }
  };
  mySettingsButton.setBorder(JBUI.Borders.emptyLeft(4));

  panel.add(myRestoreSizeButton);
  panel.add(mySettingsButton);
  getTitle().setButtonComponent(new ActiveComponent.Adapter() {
    @Override
    public JComponent getComponent() {
      return panel;
    }
  }, JBUI.Borders.emptyRight(2));
}
项目:react-native-console    文件:ShowRNConsoleAction.java   
private void showGearPopup(Component component, int x, int y) {
    ActionPopupMenu popupMenu =
            ((ActionManagerImpl) ActionManager.getInstance())
                    .createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, createGearPopupGroup(), new MenuItemPresentationFactory(true));
    popupMenu.getComponent().show(component, x, y);
}
项目:intellij-ce-playground    文件:LightToolWindow.java   
private void showGearPopup(Component component, int x, int y) {
  ActionPopupMenu popupMenu =
    ((ActionManagerImpl)ActionManager.getInstance())
      .createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, createGearPopupGroup(), new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(component, x, y);
}
项目:intellij-ce-playground    文件:GenerateAction.java   
@Override
public void preload() {
  ((ActionManagerImpl) ActionManager.getInstance()).preloadActionGroup(IdeActions.GROUP_GENERATE);
}
项目:tools-idea    文件:GenerateAction.java   
@Override
public void preload() {
  ((ActionManagerImpl) ActionManager.getInstance()).preloadActionGroup(IdeActions.GROUP_GENERATE);
}
项目:tools-idea    文件:LightToolWindow.java   
private void showGearPopup(Component component, int x, int y) {
  ActionPopupMenu popupMenu =
    ((ActionManagerImpl)ActionManager.getInstance())
      .createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, createGearPopupGroup(), new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(component, x, y);
}
项目:cordovastudio    文件:LightToolWindow.java   
private void showGearPopup(Component component, int x, int y) {
  ActionPopupMenu popupMenu =
    ((ActionManagerImpl) ActionManager.getInstance())
      .createActionPopupMenu(ToolWindowContentUi.POPUP_PLACE, createGearPopupGroup(), new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(component, x, y);
}
项目:consulo    文件:LightToolWindow.java   
private void showGearPopup(Component component, int x, int y) {
  ActionPopupMenu popupMenu = ((ActionManagerImpl)ActionManager.getInstance()).createActionPopupMenu(ToolWindowContentUI.POPUP_PLACE, createGearPopupGroup(), new MenuItemPresentationFactory(true));
  popupMenu.getComponent().show(component, x, y);
}