Java 类com.intellij.openapi.actionSystem.AnAction 实例源码

项目:intellij-bpmn-editor    文件:BPMNEditor.java   
public void initBPMNModelMenu() {
    DefaultActionGroup modelMenu = (DefaultActionGroup) ActionManager.getInstance().getAction("yaoqiang.actions.BPMNModelMenu");
    AppMenu model = new ModelMenu();
    for (int i = 0; i < model.getItemCount(); i++) {
        JMenuItem item = model.getItem(i);
        if (item == null) {
            modelMenu.addSeparator();
        } else {
            AnAction action = new AnAction(item.getText()) {
                @Override
                public void actionPerformed(AnActionEvent e) {
                    item.getAction().actionPerformed(new ActionEvent(e, 0, ""));
                }
            };
            modelMenu.add(action);
        }
    }
}
项目:IntelliJ-Key-Promoter-X    文件:KeyPromoterAction.java   
/**
 * Information extraction for entries in the menu
 *
 * @param source source of the action
 */
private void analyzeActionMenuItem(ActionMenuItem source) {
    mySource = ActionSource.MENU_ENTRY;
    myDescription = source.getText();
    myMnemonic = source.getMnemonic();
    final Field actionField = findActionField(source, ActionRef.class);
    if (actionField != null) {
        try {
            final ActionRef o = (ActionRef) actionField.get(source);
            final AnAction action = o.getAction();
            if (action != null) {
                fixValuesFromAction(action);
            }
        } catch (Exception e) {
            // happens..
        }
    }
}
项目:IntelliJ-Key-Promoter-X    文件:StatisticsList.java   
@Override
public JLabel getListCellRendererComponent(JList<? extends StatisticsItem> list, StatisticsItem value, int index, boolean isSelected, boolean cellHasFocus) {
    final Color foreground = list.getForeground();
    final String message = KeyPromoterBundle.message(
            "kp.list.item",
            value.getShortcut(),
            value.description,
            value.count,
            value.count == 1 ? "time" : "times"
            );
    setText(message);
    setForeground(foreground);
    setBorder(new EmptyBorder(2,10,2,10));
    if (value.ideaActionID != null && !"".equals(value.ideaActionID)) {
        final AnAction action = ActionManager.getInstance().getAction(value.ideaActionID);
        if (action != null) {
            final Icon icon = action.getTemplatePresentation().getIcon();
            if (icon != null) {
                setIcon(icon);
            }
        }
    }
    return this;
}
项目:CodeGen    文件:TemplateAddAction.java   
@Override
public void run(AnActionButton button) {
    // 获取选中节点
    final DefaultMutableTreeNode selectedNode = getSelectedNode();
    if (selectedNode == null) {
        return;
    }
    List<AnAction> actions = getMultipleActions(selectedNode);
    if (actions == null || actions.isEmpty()) {
        return;
    }
    // 显示新增按钮
    final DefaultActionGroup group = new DefaultActionGroup(actions);
    JBPopupFactory.getInstance()
            .createActionGroupPopup(null, group, DataManager.getInstance().getDataContext(button.getContextComponent()),
                    JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, true).show(button.getPreferredPopupPoint());
}
项目:intellij-ce-playground    文件:ActionUrl.java   
@Nullable
public AnAction getComponentAction(){
  if (myComponent instanceof Separator){
    return Separator.getInstance();
  }
  if (myComponent instanceof String){
    return ActionManager.getInstance().getAction((String)myComponent);
  }
  if (myComponent instanceof Group){
    final String id = ((Group)myComponent).getId();
    if (id == null || id.length() == 0){
      return ((Group)myComponent).constructActionGroup(true);
    }
    return ActionManager.getInstance().getAction(id);
  }
  return null;
}
项目:intellij-ce-playground    文件:ChangeProjectIconAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  List<AnAction> elements = getSelectedElements(e);
  String path = ((ReopenProjectAction)elements.get(0)).getProjectPath();
  final ChangeProjectIconForm form = new ChangeProjectIconForm(path);
  DialogWrapper dialog = new DialogWrapper(null) {
    {
      init();
    }

    @Nullable
    @Override
    protected JComponent createCenterPanel() {
      return form.myRootPanel;
    }
  };
  dialog.show();
  if (dialog.isOK()) {
    try {
      form.apply();
    }
    catch (IOException e1) {
      System.out.println(e1);
    }
  }
}
项目: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    文件:JBTabbedTerminalWidget.java   
public static void convertActions(@NotNull JComponent component,
                                  @NotNull List<TerminalAction> actions,
                                  @Nullable final Predicate<KeyEvent> elseAction) {
  for (final TerminalAction action : actions) {
    AnAction a = new DumbAwareAction() {
      @Override
      public void actionPerformed(AnActionEvent e) {
        KeyEvent event = e.getInputEvent() instanceof KeyEvent ? (KeyEvent)e.getInputEvent() : null;
        if (!action.perform(event)) {
          if (elseAction != null) {
            elseAction.apply(event);
          }
        }
      }
    };
    a.registerCustomShortcutSet(action.getKeyCode(), action.getModifiers(), component);
  }
}
项目:intellij-ce-playground    文件:PythonTestCommandLineStateBase.java   
@Override
public ExecutionResult execute(Executor executor, CommandLinePatcher... patchers) throws ExecutionException {
  final ProcessHandler processHandler = startProcess(patchers);
  final ConsoleView console = createAndAttachConsole(myConfiguration.getProject(), processHandler, executor);

  List<AnAction> actions = Lists
    .newArrayList(createActions(console, processHandler));

  DefaultExecutionResult executionResult =
    new DefaultExecutionResult(console, processHandler, actions.toArray(new AnAction[actions.size()]));

  PyRerunFailedTestsAction rerunFailedTestsAction = new PyRerunFailedTestsAction(console);
  if (console instanceof SMTRunnerConsoleView) {
    rerunFailedTestsAction.init(((BaseTestsOutputConsoleView)console).getProperties());
    rerunFailedTestsAction.setModelProvider(new Getter<TestFrameworkRunningModel>() {
    @Override
    public TestFrameworkRunningModel get() {
      return ((SMTRunnerConsoleView)console).getResultsViewer();
    }
  });
  }

  executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
  return executionResult;
}
项目:IntelliJ-OnlineSearch    文件:LaunchSearchActionRegistration.java   
@Override
public void disposeComponent() {
    ActionManager am = ActionManager.getInstance();

    // Gets an instance of the WindowMenu action group.
    DefaultActionGroup menuManager = (DefaultActionGroup) am.getAction(COMPONENT_GROUP); //(IdeActions.GROUP_EDITOR_POPUP); //"EditorPopupMenu");

    for (AnAction a : menuManager.getChildActionsOrStubs()) {
        if (a.getClass() == LaunchSearchAction.class) {
            am.unregisterAction(getActionId((LaunchSearchAction) a));
        }
    }

    // Adds a separator and a new menu command to the WindowMenu group on the main menu.
    menuManager.removeAll();
}
项目:intellij-ce-playground    文件:CustomizableActionsPanel.java   
protected void enableSetIconButton(ActionManager actionManager) {
  final TreePath selectionPath = myTree.getSelectionPath();
  Object userObject = null;
  if (selectionPath != null) {
    userObject = ((DefaultMutableTreeNode)selectionPath.getLastPathComponent()).getUserObject();
    if (userObject instanceof String) {
      final AnAction action = actionManager.getAction((String)userObject);
      if (action != null && action.getTemplatePresentation().getIcon() != null) {
        mySetIconButton.setEnabled(true);
        return;
      }
    }
  }
  mySetIconButton.setEnabled(myTextField.getText().length() != 0 &&
                             selectionPath != null &&
                             new DefaultMutableTreeNode(selectionPath).isLeaf() &&
                             !(userObject instanceof Separator));
}
项目:intellij-ce-playground    文件:UnwrapTestCase.java   
protected void assertOptions(String code, String... expectedOptions) throws IOException {
  configureCode(code);

  final List<String> actualOptions = new ArrayList<String>();

  UnwrapHandler h = new UnwrapHandler() {
    @Override
    protected void selectOption(List<AnAction> options, Editor editor, PsiFile file) {
      for (AnAction each : options) {
        actualOptions.add(each.getTemplatePresentation().getText());
      }
    }
  };

  h.invoke(getProject(), getEditor(), getFile());

  assertEquals(Arrays.asList(expectedOptions), actualOptions);
}
项目:intellij-ce-playground    文件:MacDockDelegate.java   
@Override
public void updateRecentProjectsMenu () {
  RecentProjectsManager projectsManager = RecentProjectsManager.getInstance();
  if (projectsManager == null) return;
  final AnAction[] recentProjectActions = projectsManager.getRecentProjectsActions(false);
  recentProjectsMenu.removeAll();

  for (final AnAction action : recentProjectActions) {
    MenuItem menuItem = new MenuItem(((ReopenProjectAction)action).getProjectName());
    menuItem.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        action.actionPerformed(AnActionEvent.createFromAnAction(action, null, ActionPlaces.DOCK_MENU, DataManager.getInstance().getDataContext(null)));
      }
    });
    recentProjectsMenu.add(menuItem);
  }
}
项目:intellij-ce-playground    文件:ToolWindowAlikePanel.java   
@NotNull
public static ToolWindowAlikePanel createTreePanel(@NotNull String title, @NotNull JTree tree) {
  ToolWindowAlikePanel panel = new ToolWindowAlikePanel(title, createScrollPane(tree));

  Object root = tree.getModel().getRoot();
  if (root instanceof TreeNode && ((TreeNode)root).getChildCount() > 0) {
    TreeExpander expander = new DefaultTreeExpander(tree);
    CommonActionsManager actions = CommonActionsManager.getInstance();

    AnAction expandAllAction = actions.createExpandAllAction(expander, tree);
    expandAllAction.getTemplatePresentation().setIcon(ExpandAll);

    AnAction collapseAllAction = actions.createCollapseAllAction(expander, tree);
    collapseAllAction.getTemplatePresentation().setIcon(CollapseAll);

    panel.setAdditionalTitleActions(expandAllAction, collapseAllAction);
  }

  return panel;
}
项目:intellij-ce-playground    文件:SvnCommittedChangesProvider.java   
@NotNull
public VcsCommittedViewAuxiliary createActions(@NotNull DecoratorManager manager, @Nullable RepositoryLocation location) {
  final RootsAndBranches rootsAndBranches = new RootsAndBranches(myVcs, manager, location);
  refreshMergeInfo(rootsAndBranches);

  final DefaultActionGroup popup = new DefaultActionGroup(myVcs.getDisplayName(), true);
  popup.add(rootsAndBranches.getIntegrateAction());
  popup.add(rootsAndBranches.getUndoIntegrateAction());
  popup.add(new ConfigureBranchesAction());

  final ShowHideMergePanelAction action = new ShowHideMergePanelAction(manager, rootsAndBranches.getStrategy());

  return new VcsCommittedViewAuxiliary(Collections.<AnAction>singletonList(popup), new Runnable() {
    public void run() {
      if (myMergeInfoUpdatesListener != null) {
        myMergeInfoUpdatesListener.removePanel(rootsAndBranches);
        rootsAndBranches.dispose();
      }
    }
  }, Collections.<AnAction>singletonList(action));
}
项目:intellij-ce-playground    文件:ExternalSystemKeymapExtension.java   
public static void updateRunConfigurationActions(Project project, ProjectSystemId systemId) {
  final AbstractExternalSystemTaskConfigurationType configurationType = ExternalSystemUtil.findConfigurationType(systemId);
  if (configurationType == null) return;

  ActionManager actionManager = ActionManager.getInstance();
  for (String eachAction : actionManager.getActionIds(getActionPrefix(project, null))) {
    AnAction action = actionManager.getAction(eachAction);
    if (action instanceof ExternalSystemRunConfigurationAction) {
      actionManager.unregisterAction(eachAction);
    }
  }

  Set<RunnerAndConfigurationSettings> settings = new THashSet<RunnerAndConfigurationSettings>(
    RunManager.getInstance(project).getConfigurationSettingsList(configurationType));

  final ExternalSystemShortcutsManager shortcutsManager = ExternalProjectsManager.getInstance(project).getShortcutsManager();
  for (RunnerAndConfigurationSettings configurationSettings : settings) {
    ExternalSystemRunConfigurationAction runConfigurationAction =
      new ExternalSystemRunConfigurationAction(project, configurationSettings);
    String id = runConfigurationAction.getId();
    actionManager.unregisterAction(id);
    if (shortcutsManager.hasShortcuts(id)) {
      actionManager.registerAction(id, runConfigurationAction);
    }
  }
}
项目:intellij-ce-playground    文件:XmlLanguageInjectionSupport.java   
@Override
public AnAction createEditAction(final Project project, final Factory<BaseInjection> producer) {
  return new AnAction() {
    @Override
    public void actionPerformed(final AnActionEvent e) {
      final BaseInjection originalInjection = producer.create();
      final BaseInjection injection = createFrom(originalInjection);
      if (injection != null) {
        final BaseInjection newInjection = showInjectionUI(project, injection);
        if (newInjection != null) {
          originalInjection.copyFrom(newInjection);
        }
      }
      else {
        createDefaultEditAction(project, producer).actionPerformed(null);
      }
    }
  };
}
项目:intellij-ce-playground    文件:HgBranchPopup.java   
/**
 * @param currentRepository Current repository, which means the repository of the currently open or selected file.
 */
public static HgBranchPopup getInstance(@NotNull Project project, @NotNull HgRepository currentRepository) {

  HgRepositoryManager manager = HgUtil.getRepositoryManager(project);
  HgProjectSettings hgProjectSettings = ServiceManager.getService(project, HgProjectSettings.class);
  HgMultiRootBranchConfig hgMultiRootBranchConfig = new HgMultiRootBranchConfig(manager.getRepositories());

  Condition<AnAction> preselectActionCondition = new Condition<AnAction>() {
    @Override
    public boolean value(AnAction action) {
      return false;
    }
  };
  return new HgBranchPopup(currentRepository, manager, hgMultiRootBranchConfig, hgProjectSettings,
                           preselectActionCondition);
}
项目:intellij-ce-playground    文件:VcsPushDialog.java   
@NotNull
private JComponent createForcePushInfoLabel() {
  JPanel text = new JPanel();
  text.setLayout(new BoxLayout(text, BoxLayout.X_AXIS));
  JLabel label = new JLabel("You can enable and configure Force Push in " + ShowSettingsUtil.getSettingsMenuName() + ".");
  label.setEnabled(false);
  label.setFont(JBUI.Fonts.smallFont());
  text.add(label);
  ActionLink here = new ActionLink("Configure", new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      Project project = myController.getProject();
      VcsPushDialog.this.doCancelAction(e.getInputEvent());
      ShowSettingsUtilImpl.showSettingsDialog(project, "vcs.Git", "force push");
    }
  });
  here.setFont(JBUI.Fonts.smallFont());
  text.add(here);
  return JBUI.Panels.simplePanel().addToRight(text).withBorder(JBUI.Borders.emptyBottom(4));
}
项目:intellij-ce-playground    文件:AddElementInCollectionAction.java   
@Override
protected AnAction createAddingAction(final AnActionEvent e,
                                              final String name,
                                              final Icon icon,
                                              final Type type,
                                              final DomCollectionChildDescription description) {

  final DomElement parentDomElement = getParentDomElement(e);

  if (parentDomElement instanceof MergedObject) {
    final List<DomElement> implementations = (List<DomElement>)((MergedObject)parentDomElement).getImplementations();
    final DefaultActionGroup actionGroup = new DefaultActionGroup(name, true);

    for (DomElement implementation : implementations) {
      final XmlFile xmlFile = DomUtil.getFile(implementation);
      actionGroup.add(new MyDefaultAddAction(implementation, xmlFile.getName(), xmlFile.getIcon(0), e, type, description));
    }
    return actionGroup;
  }

  return new MyDefaultAddAction(parentDomElement, name, icon, e, type, description);
}
项目:intellij-ce-playground    文件:LanguageConsoleBuilder.java   
/**
 * todo This API doesn't look good, but it is much better than force client to know low-level details
 */
public static AnAction registerExecuteAction(@NotNull LanguageConsoleView console,
                                             @NotNull final Consumer<String> executeActionHandler,
                                             @NotNull String historyType,
                                             @Nullable String historyPersistenceId,
                                             @Nullable Condition<LanguageConsoleView> enabledCondition) {
  ConsoleExecuteAction.ConsoleExecuteActionHandler handler = new ConsoleExecuteAction.ConsoleExecuteActionHandler(true) {
    @Override
    void doExecute(@NotNull String text, @NotNull LanguageConsoleView consoleView) {
      executeActionHandler.consume(text);
    }
  };

  ConsoleExecuteAction action = new ConsoleExecuteAction(console, handler, enabledCondition);
  action.registerCustomShortcutSet(action.getShortcutSet(), console.getConsoleEditor().getComponent());
  new ConsoleHistoryController(historyType, historyPersistenceId, console).install();
  return action;
}
项目:intellij-ce-playground    文件:PresentationFactory.java   
@NotNull
public final Presentation getPresentation(@NotNull AnAction action){
  Presentation presentation = myAction2Presentation.get(action);
  if (presentation == null || !action.isDefaultIcon()){
    Presentation templatePresentation = action.getTemplatePresentation();
    if (presentation == null) {
      presentation = templatePresentation.clone();
      myAction2Presentation.put(action, presentation);
    }
    if (!action.isDefaultIcon()) {
      presentation.setIcon(templatePresentation.getIcon());
      presentation.setDisabledIcon(templatePresentation.getDisabledIcon());
    }
    processPresentation(presentation);
  }
  return presentation;
}
项目:intellij-ce-playground    文件:ExecutionToolWindowFixture.java   
@TestOnly
public boolean stop() {
  for (ActionButton button : getToolbarButtons()) {
    final AnAction action = button.getAction();
    if (action != null && action.getClass().getName().equals("com.intellij.execution.actions.StopAction")) {
      //noinspection ConstantConditions
      boolean enabled = method("isButtonEnabled").withReturnType(boolean.class).in(button).invoke();
      if (enabled) {
        button.click();
        return true;
      }
      return false;
    }
  }
  return false;
}
项目:intellij-ce-playground    文件:DvcsBranchPopup.java   
protected DvcsBranchPopup(@NotNull Repo currentRepository,
                          @NotNull AbstractRepositoryManager<Repo> repositoryManager,
                          @NotNull DvcsMultiRootBranchConfig<Repo> multiRootBranchConfig,
                          @NotNull DvcsSyncSettings vcsSettings,
                          @NotNull Condition<AnAction> preselectActionCondition) {
  myProject = currentRepository.getProject();
  myCurrentRepository = currentRepository;
  myRepositoryManager = repositoryManager;
  myVcs = currentRepository.getVcs();
  myVcsSettings = vcsSettings;
  myMultiRootBranchConfig = multiRootBranchConfig;
  String title = createPopupTitle(currentRepository);
  myPopup = new BranchActionGroupPopup(title, myProject, preselectActionCondition, createActions());

  initBranchSyncPolicyIfNotInitialized();
  setCurrentBranchInfo();
  warnThatBranchesDivergedIfNeeded();
}
项目:intellij-ce-playground    文件:ShortcutPromoterManager.java   
@Override
public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
  final InputEvent input = event.getInputEvent();
  if (input instanceof MouseEvent) {
    final String id = ActionManager.getInstance().getId(action);
    final ShortcutPromoterEP ep = myExtensions.get(id);
    if (ep != null) {
      PromoterState state = myState.get(id);
      if (state == null) {
        state = new PromoterState();
        myState.put(id, state);
      }
      state.incClicks();
    }
  }
}
项目:react-native-console    文件:ActionUtil.java   
/**
 * Create some actions
 *
 * @param horizontal     is horizontal displayed
 * @return
 */
public static ActionToolbar createToolbarWithActions(boolean horizontal,
                                                     AnAction... actions) {
    DefaultActionGroup group = new DefaultActionGroup();

    if (actions != null) {
        for (AnAction anAction : actions) {
            group.add(anAction);
        }
    }
    //group.addSeparator();
    return ActionManager.getInstance().createActionToolbar("unknown", group, horizontal);// horizontal
}
项目:react-native-console    文件:BaseRunNPMScriptsAction.java   
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
    if (e == null) {
        return EMPTY_ARRAY;
    }
    final Project project = e.getProject();
    if (project == null) {
        return EMPTY_ARRAY;
    }
    return actionList.toArray(new AnAction[0]);
}
项目:react-native-console    文件:BaseRunNPMScriptsAction.java   
/**
 * 子类可以向父类添加多个Action.
 * Add more children actions to this action.
 */
public void addActions(AnAction... actions) {
    if(actions != null && actions.length > 0) {
        for(AnAction anAction : actions) {
            actionList.add(anAction);
        }
    }
}
项目:idea-php-class-templates    文件:PhpNewExceptionClassDialog.java   
@Override
protected void subInit() {
    super.subInit();

    this.myMessageTextField = new EditorTextField("");
    this.myKindUpDownHint      = new JLabel();
    this.myKindUpDownHint.setIcon(PlatformIcons.UP_DOWN_ARROWS);
    this.myKindUpDownHint.setToolTipText(PhpBundle.message("actions.new.php.base.arrows.kind.tooltip"));


    this.myKindComboBox = new ComboBox<String>();
    this.myKindComboBox.setMinimumAndPreferredWidth(400);
    this.myKindComboBox.setRenderer(new ListCellRendererWrapper<Trinity>() {
        public void customize(JList list, Trinity value, int index, boolean selected, boolean hasFocus) {
            this.setText((String)value.first);
            this.setIcon((Icon)value.second);
        }
    });
    ComboboxSpeedSearch var10001 = new ComboboxSpeedSearch(this.myKindComboBox) {
        protected String getElementText(Object element) {
            return (String)((Trinity)element).first;
        }
    };
    KeyboardShortcut up = new KeyboardShortcut(KeyStroke.getKeyStroke(38, 0), (KeyStroke)null);
    KeyboardShortcut down = new KeyboardShortcut(KeyStroke.getKeyStroke(40, 0), (KeyStroke)null);
    AnAction kindArrow = PhpNewFileDialog.getCbArrowAction(this.myKindComboBox);
    kindArrow.registerCustomShortcutSet(new CustomShortcutSet(new Shortcut[]{up, down}), this.myNameTextField);
    List<Trinity> exceptionTypes = this.getExceptionTypes();

    for(Trinity type : exceptionTypes) {
        this.myKindComboBox.addItem(type);
    }
}
项目:jgiven-intellij-plugin    文件:ScenarioStateFilteringRuleProvider.java   
@NotNull
@Override
public AnAction[] createFilteringActions(@NotNull UsageView view) {
    if (isNormalFindUsagesDialogAndNotShowUsages(view)) {
        return new AnAction[]{
                new FilterByJGivenStateAction(scenarioStateAnnotationProvider, view)
        };
    }
    return new AnAction[0];
}
项目:SmartQQ4IntelliJ    文件:ReviewDialog.java   
private void send() {
    String msg = String.format("%s(Reviews: %s)", text.getText(),
            styledText.getText());
    for (IMChatConsole console : consoles) {
        console.send(msg);
    }
    if (openGerritReviewCheckBox.isSelected()) {
        AnAction action = ActionManager.getInstance().getActionOrStub("");

    }
}
项目:watchMe    文件:SlackSettings.java   
@NotNull
@Override
public AnAction[] getChildren(AnActionEvent anActionEvent) {
    final AnAction[] children = new AnAction[4];

    children[0] = new addChannel();
    children[1] = new editChannel();
    children[2] = new removeChannel();
    children[3] = new removeChannels();

    return children;
}
项目:Gherkin-TS-Runner    文件:GherkinIconRenderer.java   
@Nullable
public AnAction getClickAction() {
    return new AnAction() {
        @Override
        public void actionPerformed(AnActionEvent e) {
            callProtractor();
        }
    };
}
项目:intellij-randomness    文件:DataGroupAction.java   
@NotNull
@Override
public final AnAction[] getChildren(final @Nullable AnActionEvent event) {
    return new AnAction[]{
            insertAction,
            insertArrayAction,
            settingsAction
    };
}
项目:intellij-randomness    文件:PopupAction.java   
@NotNull
@Override
public AnAction[] getChildren(final @Nullable AnActionEvent event) {
    return new AnAction[]{
            new IntegerGroupAction(),
            new DecimalGroupAction(),
            new StringGroupAction(),
            new WordGroupAction(),
            new Separator(),
            new ArraySettingsAction()
    };
}
项目:hybris-integration-intellij-idea-plugin    文件:ProjectRefreshAction.java   
public static void triggerAction(final DataContext dataContext) {
    ApplicationManager.getApplication().invokeLater(() -> {
        final AnAction action = new ProjectRefreshAction();
        final AnActionEvent actionEvent = AnActionEvent.createFromAnAction(
            action,
            null,
            ActionPlaces.UNKNOWN,
            dataContext
        );
        action.actionPerformed(actionEvent);
    }, ModalityState.NON_MODAL);
}
项目:Riho    文件:IdeActionListener.java   
@Override
public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
    RihoReactionNotifier publisher = project.getMessageBus().syncPublisher(RihoReactionNotifier.REACTION_NOTIFIER);

    if (action instanceof ShowQuickDocInfoAction || action instanceof ShowParameterInfoAction) {
        publisher.reaction(Reaction.of(FacePattern.NORMAL, Duration.ofSeconds(3), Emotion.QUESTION, Loop.once()));
    }
}
项目:IntelliJ-Key-Promoter-X    文件:KeyPromoterAction.java   
/**
 * Constructor used when we get notified by IDEA through {@link com.intellij.openapi.actionSystem.ex.AnActionListener}
 *
 * @param action action that was performed
 * @param event  event that fired the action
 * @param source the source of the action
 */
KeyPromoterAction(AnAction action, AnActionEvent event, ActionSource source) {
    myMnemonic = event.getPresentation().getMnemonic();
    myIdeaActionID = ActionManager.getInstance().getId(action);
    myDescription = event.getPresentation().getText();
    mySource = source;
    myShortcut = KeyPromoterUtils.getKeyboardShortcutsText(myIdeaActionID);
}
项目:IntelliJ-Key-Promoter-X    文件:KeyPromoterAction.java   
/**
 * Information extraction for buttons on the toolbar
 *
 * @param source source of the action
 */
private void analyzeActionButton(ActionButton source) {
    final AnAction action = source.getAction();
    if (action != null) {
        fixValuesFromAction(action);
    }
    mySource = ActionSource.MAIN_TOOLBAR;
}
项目:IntelliJ-Key-Promoter-X    文件:KeyPromoterAction.java   
/**
 * This method can be used at several places to update shortcut, description and ideaAction from an {@link AnAction}
 *
 * @param anAction action to extract values from
 */
private void fixValuesFromAction(AnAction anAction) {
    myDescription = anAction.getTemplatePresentation().getText();
    myIdeaActionID = ActionManager.getInstance().getId(anAction);
    myShortcut = KeyPromoterUtils.getKeyboardShortcutsText(myIdeaActionID);

}