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

项目: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);
        }
    }
}
项目:random_image_background_any_jetbrains_plugin    文件:Settings.java   
@Override
public void apply() throws ConfigurationException {
   PropertiesComponent prop = PropertiesComponent.getInstance();
   prop.setValue(FOLDER, imageFolder.getText());

   String timeExecutionValue = timeExecution.getText();
   prop.setValue(TIME_EXECUTION, timeExecutionValue);

   int opcity = opacity.getValue();
   prop.setValue(OPACITY, String.valueOf(opcity));

   boolean isDisabled = disabled.isSelected();
   prop.setValue(DISABLED, isDisabled);

   ScheduledExecutorServiceHandler.shutdownExecution();

   if(isDisabled) {
      ActionManager.getInstance().getAction("clearBackgroundImage").actionPerformed(null);
   }else {
      ActionManager.getInstance().getAction("randomBackgroundImage").actionPerformed(null);
   }
}
项目: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;
}
项目:educational-plugin    文件:EduPluginConfigurator.java   
@NotNull
default DefaultActionGroup getTaskDescriptionActionGroup() {
  final DefaultActionGroup group = new DefaultActionGroup();
  String[] ids = new String[]{
    StudyCheckAction.ACTION_ID,
    StudyPreviousTaskAction.ACTION_ID,
    StudyNextTaskAction.ACTION_ID,
    StudyRefreshTaskFileAction.ACTION_ID,
    StudyShowHintAction.ACTION_ID
  };
  ActionManager actionManager = ActionManager.getInstance();
  Arrays.stream(ids)
    .map(actionManager::getAction)
    .filter(Objects::nonNull)
    .forEach(group::add);

  group.add(new StudyEditInputAction());
  return group;
}
项目: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-OnlineSearch    文件:ShowSearchEnginesAction.java   
@Override
public void actionPerformed(AnActionEvent e) {

    ActionManager am = ActionManager.getInstance();
    DefaultActionGroup actionGroup = (DefaultActionGroup) am.getAction(LaunchSearchActionRegistration.COMPONENT_GROUP);

    // https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+Popups
    // https://github.com/linux-china/idea-string-manipulation/blob/master/src/main/java/osmedile/intellij/stringmanip/PopupChoiceAction.java#L23
    JBPopupFactory
            .getInstance()
            .createActionGroupPopup("OnlineSearch",
                                    actionGroup,
                                    e.getDataContext(),
                                    JBPopupFactory.ActionSelectionAid.NUMBERING,
                                    false)
            .showInBestPositionFor(e.getDataContext());
}
项目:intellij-ce-playground    文件:CheckoutActionGroup.java   
@NotNull
@Override
protected AnAction[] computeChildren(@NotNull ActionManager manager) {
  CheckoutProvider[] providers = CheckoutProvider.EXTENSION_POINT_NAME.getExtensions();
  if (providers.length == 0) {
    return EMPTY_ARRAY;
  }

  Arrays.sort(providers, new CheckoutProvider.CheckoutProviderComparator());
  AnAction[] children = new AnAction[providers.length];
  for (int i = 0; i < providers.length; i++) {
    CheckoutProvider provider = providers[i];
    children[i] = createAction(provider);
  }
  return children;
}
项目:intellij-ce-playground    文件:GitQuickListContentProvider.java   
@Override
protected void addVcsSpecificActions(@NotNull ActionManager manager, @NotNull List<AnAction> actions) {
  add("Git.Branches", manager, actions);
  add("Vcs.Push", manager, actions);
  add("Git.Stash", manager, actions);
  add("Git.Unstash", manager, actions);

  add("ChangesView.AddUnversioned", manager, actions);
  add("Git.ResolveConflicts", manager, actions);

  // Github
  addSeparator(actions);
  final AnAction githubRebase = manager.getAction("Github.Rebase");
  if (githubRebase != null) {
    actions.add(new Separator(GitBundle.message("vcs.popup.git.github.section")));
    actions.add(githubRebase);
  }
}
项目:intellij-ce-playground    文件:ConsoleManager.java   
private void createConsole(@NotNull final NetService netService) {
  TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(netService.getProject());
  netService.configureConsole(consoleBuilder);
  console = consoleBuilder.getConsole();

  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      ActionGroup actionGroup = netService.getConsoleToolWindowActions();
      ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actionGroup, false);

      SimpleToolWindowPanel toolWindowPanel = new SimpleToolWindowPanel(false, true);
      toolWindowPanel.setContent(console.getComponent());
      toolWindowPanel.setToolbar(toolbar.getComponent());

      ToolWindow toolWindow = ToolWindowManager.getInstance(netService.getProject())
        .registerToolWindow(netService.getConsoleToolWindowId(), false, ToolWindowAnchor.BOTTOM, netService.getProject(), true);
      toolWindow.setIcon(netService.getConsoleToolWindowIcon());

      Content content = ContentFactory.SERVICE.getInstance().createContent(toolWindowPanel, "", false);
      Disposer.register(content, console);

      toolWindow.getContentManager().addContent(content);
    }
  }, netService.getProject().getDisposed());
}
项目:intellij-ce-playground    文件:AssignShortcutAction.java   
@Nullable
private static String getGoalActionId(DataContext context) {
  final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
  if (goals == null || goals.size() != 1) {
    return null;
  }

  MavenProject project = MavenActionUtil.getMavenProject(context);
  if (project == null) return null;

  String goal = goals.get(0);

  final MavenShortcutsManager shortcutsManager = getShortcutsManager(context);
  String actionId = shortcutsManager != null ? shortcutsManager.getActionId(project.getPath(), goal) : null;
  if (actionId != null) {
    AnAction action = ActionManager.getInstance().getAction(actionId);
    if (action == null) {
      MavenKeymapExtension.getOrRegisterAction(project, actionId, goal);
    }
  }
  return actionId;
}
项目:intellij-ce-playground    文件:StatusPanel.java   
private Action createCopyAction() {
  ActionManager actionManager = ActionManager.getInstance();
  if (actionManager == null) return null;
  AnAction action = actionManager.getAction(IdeActions.ACTION_COPY);
  if (action == null) return null;
  return new AbstractAction(action.getTemplatePresentation().getText(), action.getTemplatePresentation().getIcon()) {
    @Override
    public void actionPerformed(ActionEvent e) {
      StringSelection content = new StringSelection(getText());
      ClipboardSynchronizer.getInstance().setContent(content, content);
    }

    @Override
    public boolean isEnabled() {
      return !getText().isEmpty();
    }
  };
}
项目:intellij-ce-playground    文件:ProjectProfileSelectionDialog.java   
@NotNull static JPanel createTreePanel(@NotNull CheckboxTreeView tree) {
  JPanel treePanel = new JPanel(new BorderLayout());

  DefaultActionGroup group = new DefaultActionGroup();
  CommonActionsManager actions = CommonActionsManager.getInstance();
  group.addAll(actions.createExpandAllAction(tree, treePanel), actions.createCollapseAllAction(tree, treePanel));

  ActionToolbar actionToolBar = ActionManager.getInstance().createActionToolbar("", group, true);
  JPanel buttonsPanel = new JPanel(new BorderLayout());
  buttonsPanel.add(actionToolBar.getComponent(), BorderLayout.CENTER);
  buttonsPanel.setBorder(new SideBorder(JBColor.border(), SideBorder.TOP | SideBorder.LEFT | SideBorder.RIGHT, 1));

  treePanel.add(buttonsPanel, BorderLayout.NORTH);
  treePanel.add(ScrollPaneFactory.createScrollPane(tree), BorderLayout.CENTER);

  return treePanel;
}
项目:intellij-ce-playground    文件:RunnerLayoutUiImpl.java   
public RunnerLayoutUiImpl(@NotNull Project project,
                          @NotNull Disposable parent,
                          @NotNull String runnerId,
                          @NotNull String runnerTitle,
                          @NotNull String sessionName) {
  myLayout = RunnerLayoutSettings.getInstance().getLayout(runnerId);
  Disposer.register(parent, this);

  myContentUI = new RunnerContentUi(project, this, ActionManager.getInstance(), IdeFocusManager.getInstance(project), myLayout,
                                    runnerTitle + " - " + sessionName);
  Disposer.register(this, myContentUI);

  myViewsContentManager = getContentFactory().createContentManager(myContentUI.getContentUI(), false, project);
  myViewsContentManager.addDataProvider(this);
  Disposer.register(this, myViewsContentManager);
}
项目: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();
    }
  }
}
项目:intellij-ce-playground    文件:CustomActionsSchema.java   
public AnAction getCorrectedAction(String id) {
  if (! myIdToNameList.contains(new Pair(id, ""))){
    return ActionManager.getInstance().getAction(id);
  }
  if (myIdToActionGroup.get(id) == null) {
    for (Pair pair : myIdToNameList) {
      if (pair.first.equals(id)){
        final ActionGroup actionGroup = (ActionGroup)ActionManager.getInstance().getAction(id);
        if (actionGroup != null) { //J2EE/Commander plugin was disabled
          myIdToActionGroup.put(id, CustomizationUtil.correctActionGroup(actionGroup, this, pair.second, pair.second));
        }
      }
    }
  }
  return myIdToActionGroup.get(id);
}
项目:intellij-ce-playground    文件:CustomizableActionsPanel.java   
private void editToolbarIcon(String actionId, DefaultMutableTreeNode node) {
  final AnAction anAction = ActionManager.getInstance().getAction(actionId);
  if (isToolbarAction(node) && anAction.getTemplatePresentation().getIcon() == null) {
    final int exitCode = Messages.showOkCancelDialog(IdeBundle.message("error.adding.action.without.icon.to.toolbar"),
                                                     IdeBundle.message("title.unable.to.add.action.without.icon.to.toolbar"),
                                                     Messages.getInformationIcon());
    if (exitCode == Messages.OK) {
      mySelectedSchema.addIconCustomization(actionId, null);
      anAction.getTemplatePresentation().setIcon(AllIcons.Toolbar.Unknown);
      anAction.getTemplatePresentation().setDisabledIcon(IconLoader.getDisabledIcon(AllIcons.Toolbar.Unknown));
      anAction.setDefaultIcon(false);
      node.setUserObject(Pair.create(actionId, AllIcons.Toolbar.Unknown));
      myActionsTree.repaint();
      CustomActionsSchema.setCustomizationSchemaForCurrentProjects();
    }
  }
}
项目:intellij-ce-playground    文件:CustomizableActionsPanel.java   
@Override
protected void doOKAction() {
  if (myNode != null) {
    if (!doSetIcon(myNode, myTextField.getText(), getContentPane())) {
      return;
    }
    final Object userObject = myNode.getUserObject();
    if (userObject instanceof Pair) {
      String actionId = (String)((Pair)userObject).first;
      final AnAction action = ActionManager.getInstance().getAction(actionId);
      final Icon icon = (Icon)((Pair)userObject).second;
      action.getTemplatePresentation().setIcon(icon);
      action.setDefaultIcon(icon == null);
      editToolbarIcon(actionId, myNode);
    }
    myActionsTree.repaint();
  }
  CustomActionsSchema.setCustomizationSchemaForCurrentProjects();
  super.doOKAction();
}
项目:intellij-ce-playground    文件:CustomizableActionsPanel.java   
@Override
protected void doOKAction() {
  final ActionManager actionManager = ActionManager.getInstance();
  TreeUtil.traverseDepth((TreeNode)myTree.getModel().getRoot(), new TreeUtil.Traverse() {
    @Override
    public boolean accept(Object node) {
      if (node instanceof DefaultMutableTreeNode) {
        final DefaultMutableTreeNode mutableNode = (DefaultMutableTreeNode)node;
        final Object userObject = mutableNode.getUserObject();
        if (userObject instanceof Pair) {
          String actionId = (String)((Pair)userObject).first;
          final AnAction action = actionManager.getAction(actionId);
          Icon icon = (Icon)((Pair)userObject).second;
          action.getTemplatePresentation().setIcon(icon);
          action.setDefaultIcon(icon == null);
          editToolbarIcon(actionId, mutableNode);
        }
      }
      return true;
    }
  });
  super.doOKAction();
  CustomActionsSchema.setCustomizationSchemaForCurrentProjects();
}
项目: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
}
项目:reasonml-idea-plugin    文件:BsConsole.java   
public ActionToolbar createToolbar() {
    DefaultActionGroup group = new DefaultActionGroup();
    group.add(new ScrollToTheEndToolbarAction(this.getEditor()));
    group.add(new ClearLogAction(this));
    group.add(new StartAction(this, getProject()));

    ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar("left", group, false);
    toolbar.setTargetComponent(this.getComponent());

    return toolbar;
}
项目: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("");

    }
}
项目:nullability-annotations-inspection    文件:AddPackageInfoWithNullabilityDefaultsFix.java   
@Nullable
private PsiJavaFile createPackageInfoFile(PsiFile file, PsiPackage target) {
    DataManager.getInstance().getDataContextFromFocus().doWhenDone((Consumer<DataContext>) context -> {
        AnActionEvent event =
                new AnActionEvent(null, context, "", new Presentation(), ActionManager.getInstance(), 0);
        new CreatePackageInfoAction().actionPerformed(event);
    });
    return packageInfoFile(target, file.getContainingDirectory());
}
项目:jfrog-idea-plugin    文件:ComponentUtils.java   
public static ActionToolbar createActionToolbar(Tree componentsTree) {
    DefaultActionGroup defaultActionGroup = new DefaultActionGroup();
    defaultActionGroup.addAction(ActionManager.getInstance().getAction("Xray.Refresh"));
    defaultActionGroup.addAction(new CollapseAllAction(componentsTree));
    defaultActionGroup.addAction(new ExpandAllAction(componentsTree));
    return ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, defaultActionGroup, true);
}
项目: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   
/**
 * 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);

}
项目:IntelliJ-Key-Promoter-X    文件:SuppressedList.java   
@Override
public Component getListCellRendererComponent(JList<? extends StatisticsItem> list, StatisticsItem value, int index, boolean isSelected, boolean cellHasFocus) {
    final Color foreground = list.getForeground();
    final Color background = list.getBackground();
    final String message = KeyPromoterBundle.message(
            "kp.list.suppressed.item",
            value.getShortcut(),
            value.description
    );
    if (isSelected) {
        setBackground(JBColor.GRAY);
    } else {
        setBackground(background);
    }

    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;
}
项目:educational-plugin    文件:StudyTypeHandlerDelegate.java   
private static void activatePlaceholder(TaskFile taskFile, AnswerPlaceholder placeholder, PsiFile file, Editor editor, Project project) {
  AnAction action = ActionManager.getInstance().getAction(CCActivatePlaceholder.ACTION_ID);
  if (action != null) {
    CCAnswerPlaceholderAction.CCState state =
      new CCAnswerPlaceholderAction.CCState(taskFile, placeholder, file, editor, project);
    ((CCActivatePlaceholder)action).performAnswerPlaceholderAction(state);
  }
}
项目:educational-plugin    文件:EduKotlinPluginConfigurator.java   
@NotNull
@Override
public DefaultActionGroup getTaskDescriptionActionGroup() {
  DefaultActionGroup taskDescriptionActionGroup = super.getTaskDescriptionActionGroup();
  taskDescriptionActionGroup.remove(ActionManager.getInstance().getAction(StudyShowHintAction.ACTION_ID));
  StudyFillPlaceholdersAction fillPlaceholdersAction = new StudyFillPlaceholdersAction();
  fillPlaceholdersAction.getTemplatePresentation().setIcon(EduKotlinIcons.FILL_PLACEHOLDERS_ICON);
  fillPlaceholdersAction.getTemplatePresentation().setText("Fill Answer Placeholders");
  taskDescriptionActionGroup.add(fillPlaceholdersAction);
  return taskDescriptionActionGroup;
}
项目:intellij-plugin    文件:SeedStackNavigator.java   
private void initToolWindow() {
    initTree();
    JPanel panel = new SeedStackNavigatorPanel(myProject, tree);

    final ToolWindowManagerEx manager = ToolWindowManagerEx.getInstanceEx(myProject);
    toolWindow = (ToolWindowEx) manager.registerToolWindow(TOOL_WINDOW_ID, false, ToolWindowAnchor.LEFT, myProject, true);
    toolWindow.setIcon(SeedStackIcons.LOGO);
    final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
    final Content content = contentFactory.createContent(panel, "", false);
    ContentManager contentManager = toolWindow.getContentManager();
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);

    final ToolWindowManagerAdapter listener = new ToolWindowManagerAdapter() {
        boolean wasVisible = false;

        @Override
        public void stateChanged() {
            if (toolWindow.isDisposed()) return;
            boolean visible = toolWindow.isVisible();
            if (!visible) {
                return;
            }
            scheduleStructureUpdate(null);
        }
    };
    manager.addToolWindowManagerListener(listener, myProject);

    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup group = new DefaultActionGroup();
    toolWindow.setAdditionalGearActions(group);
}
项目:intellij-plugin    文件:SeedStackNavigatorPanel.java   
SeedStackNavigatorPanel(Project project, SimpleTree tree) {
    super(true, true);
    this.project = project;
    this.tree = tree;

    final ActionManager actionManager = ActionManager.getInstance();
    ActionToolbar actionToolbar = actionManager.createActionToolbar(
            "SeedStack Navigator Toolbar",
            (DefaultActionGroup) actionManager.getAction("SeedStack.NavigatorActionsToolbar"),
            true
    );
    actionToolbar.setTargetComponent(tree);
    setToolbar(actionToolbar.getComponent());
    setContent(ScrollPaneFactory.createScrollPane(tree));
}
项目:intellij-plugin    文件:NavigatorUtil.java   
public static void executeAction(String actionId, InputEvent e) {
    ActionManager actionManager = ActionManager.getInstance();
    AnAction action = actionManager.getAction(actionId);
    if (action != null) {
        Presentation presentation = new Presentation();
        AnActionEvent event = new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation, actionManager, 0);
        action.update(event);
        if (presentation.isEnabled()) {
            action.actionPerformed(event);
        }
    }
}
项目:ValueClassGenerator    文件:GenerateValueClassHandlerTest.java   
private void setupAction() {
    try {
        ActionManager.getInstance().registerAction("GenerateValueClass", new GenerateValueClass());
    } catch (Throwable e) {
        e.printStackTrace();
    }
}
项目:intellij-ce-playground    文件:ExportTestResultsAction.java   
public static ExportTestResultsAction create(String toolWindowId, RunConfiguration runtimeConfiguration) {
  ExportTestResultsAction action = new ExportTestResultsAction();
  action.copyFrom(ActionManager.getInstance().getAction(ID));
  action.myToolWindowId = toolWindowId;
  action.myRunConfiguration = runtimeConfiguration;
  return action;
}
项目:intellij-ce-playground    文件:NavigateAction.java   
public NavigateAction(@NotNull String text,
                      @NotNull LineMarkerInfo<T> info,
                      @Nullable String originalActionId) {
  super(text);
  myInfo = info;
  if (originalActionId != null) {
    ShortcutSet set = ActionManager.getInstance().getAction(originalActionId).getShortcutSet();
    setShortcutSet(set);
  }
}
项目: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);
}
项目:PackageTemplates    文件:AppComponent.java   
@Override
public void initComponent() {
    checkAndCreateRootDir();

    ActionManager am = ActionManager.getInstance();
    ArrayList<PackageTemplate> listPackageTemplate = PackageTemplateHelper.getListPackageTemplate();

    for (PackageTemplate pt : listPackageTemplate) {
        if (!pt.isShouldRegisterAction()) {
            continue;
        }
        RunTemplateAction action = new RunTemplateAction(pt.getName(), pt);
        am.registerAction(Const.ACTION_PREFIX + action.getName(), action);
    }
}
项目:intellij-ce-playground    文件:SelectCreateExternalTargetDialog.java   
protected JPopupMenu createPopup(boolean toolWindow) {
  DefaultActionGroup group = new DefaultActionGroup();
  DefaultActionGroup newGroup = new DefaultActionGroup("_New", true);
  final RepositoryBrowserComponent browser = getRepositoryBrowser();
  newGroup.add(new AddLocationAction(browser));
  newGroup.add(new MkDirAction(browser));
  group.add(newGroup);
  group.addSeparator();
  group.add(new RefreshAction(browser));
  group.add(new DiscardLocationAction(browser));
  ActionPopupMenu menu = ActionManager.getInstance().createActionPopupMenu("", group);
  return menu.getComponent();
}
项目:intellij-ce-playground    文件:IncomingChangesViewProvider.java   
public JComponent initContent() {
  myBrowser = new CommittedChangesTreeBrowser(myProject, Collections.<CommittedChangeList>emptyList());
  myBrowser.getEmptyText().setText(VcsBundle.message("incoming.changes.not.loaded.message"));
  ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction("IncomingChangesToolbar");
  final ActionToolbar toolbar = myBrowser.createGroupFilterToolbar(myProject, group, null, Collections.<AnAction>emptyList());
  myBrowser.setToolBar(toolbar.getComponent());
  myBrowser.setTableContextMenu(group, Collections.<AnAction>emptyList());
  myConnection = myBus.connect();
  myConnection.subscribe(CommittedChangesCache.COMMITTED_TOPIC, new MyCommittedChangesListener());
  loadChangesToBrowser(false, true);

  JPanel contentPane = new JPanel(new BorderLayout());
  contentPane.add(myBrowser, BorderLayout.CENTER);
  return contentPane;
}
项目:intellij-ce-playground    文件:AlienChangeListBrowser.java   
public void addToolbarActions(final DialogWrapper dialogWrapper) {
  final ActionGroup group = (ActionGroup) ActionManager.getInstance().getAction("AlienCommitChangesDialog.AdditionalActions");
  final AnAction[] children = group.getChildren(null);
  if (children != null) {
    for (AnAction anAction : children) {
      super.addToolbarAction(anAction);
    }
  }
}
项目:react-css-modules-intellij-plugin    文件:CssModulesCreateClassIntention.java   
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
    final PsiElement intentionElement = getIntentionElement(element);
    for (PsiReference psiReference : intentionElement.getReferences()) {
        if (psiReference instanceof CssModulesUnknownClassPsiReference) {
            final String className = psiReference.getRangeInElement().substring(intentionElement.getText());
            final StylesheetFile stylesheetFile = ((CssModulesUnknownClassPsiReference) psiReference).getStylesheetFile();
            stylesheetFile.navigate(true);
            PsiElement ruleset = CssElementFactory.getInstance(project).createRuleset("." + className + " {\n\n}", stylesheetFile.getLanguage());
            ruleset = stylesheetFile.add(ruleset);
            final int newCaretOffset = ruleset.getTextOffset() + ruleset.getText().indexOf("{") + 2; // after '{\n'
            final FileEditor[] editors = FileEditorManager.getInstance(project).getEditors(stylesheetFile.getVirtualFile());
            for (FileEditor fileEditor : editors) {
                if (fileEditor instanceof TextEditor) {
                    final Editor cssEditor = ((TextEditor) fileEditor).getEditor();
                    cssEditor.getCaretModel().moveToOffset(newCaretOffset);
                    AnAction editorLineEnd = ActionManager.getInstance().getAction("EditorLineEnd");
                    if (editorLineEnd != null) {
                        final AnActionEvent actionEvent = AnActionEvent.createFromDataContext(
                                ActionPlaces.UNKNOWN,
                                null,
                                new DataManagerImpl.MyDataContext(cssEditor.getComponent())
                        );
                        PsiDocumentManager.getInstance(project).doPostponedOperationsAndUnblockDocument(cssEditor.getDocument());
                        editorLineEnd.actionPerformed(actionEvent);
                    }
                }
            }
            return;
        }
    }
}