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


Java ActionManager.getAction方法代码示例

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


在下文中一共展示了ActionManager.getAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initComponent

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
@Override
public void initComponent() {
    PluginSettings settings = PluginSettings.getInstance();
    ActionManager am = ActionManager.getInstance();

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

    for (PluginSettings.SearchEngine engine : settings.searchEngines) {
        LaunchSearchAction action = new LaunchSearchAction(engine);

        // Passes an instance of your custom TextBoxes class to the registerAction method of the ActionManager class.
        am.registerAction(getActionId(action), action);

        // Adds a separator and a new menu command to the WindowMenu group on the main menu.
        menuManager.add(action);  //, Constraints.LAST);
    }

    menuManager.addSeparator();
}
 
开发者ID:maddouri,项目名称:IntelliJ-OnlineSearch,代码行数:22,代码来源:LaunchSearchActionRegistration.java

示例2: disposeComponent

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
@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();
}
 
开发者ID:maddouri,项目名称:IntelliJ-OnlineSearch,代码行数:17,代码来源:LaunchSearchActionRegistration.java

示例3: createCopyAction

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
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();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:StatusPanel.java

示例4: createDefaultFileSystemActions

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
public DefaultActionGroup createDefaultFileSystemActions(FileSystemTree fileSystemTree) {
  DefaultActionGroup group = new DefaultActionGroup();
  final ActionManager actionManager = ActionManager.getInstance();
  group.add(actionManager.getAction("FileChooser.GotoHome"));
  group.add(actionManager.getAction("FileChooser.GotoProject"));
  group.addSeparator();
  group.add(actionManager.getAction("FileChooser.NewFolder"));
  group.add(actionManager.getAction("FileChooser.Delete"));
  group.addSeparator();
  SynchronizeAction action1 = new SynchronizeAction();
  AnAction original = actionManager.getAction(IdeActions.ACTION_SYNCHRONIZE);
  action1.copyFrom(original);
  action1.registerCustomShortcutSet(original.getShortcutSet(), fileSystemTree.getTree());
  group.add(action1);
  group.addSeparator();
  group.add(actionManager.getAction("FileChooser.ShowHiddens"));

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

示例5: enableSetIconButton

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CustomizableActionsPanel.java

示例6: processKeymap

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:TraverseUIStarter.java

示例7: executeAction

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:13,代码来源:NavigatorUtil.java

示例8: onTemplateFinished

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
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);
}
 
开发者ID:cesards,项目名称:HakunaMatataIntelliJPlugin,代码行数:8,代码来源:AbstractRichStringBasedPostfixTemplate.java

示例9: initComponent

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
public void initComponent() {
        ActionManager am = ActionManager.getInstance();
        // for debugging
//        Notifications.Bus.notify(new Notification(notificationGroupId, "Loading " + InstantPatchRemotePluginRegistration.shortName, "Loading started...", NotificationType.INFORMATION, NotificationListener.URL_OPENING_LISTENER));

        try {
            final RemoteOperationRootGroup rootAction = new RemoteOperationRootGroup(pluginSettings);

            // Passes an instance of your custom TextBoxes class to the registerAction method of the ActionManager class.
            am.registerAction(RemoteOperationRootGroup.class.getName(), rootAction);

            final AnAction ProjectViewPopupMenuAction = am.getAction("ProjectViewPopupMenu");
            if (!(ProjectViewPopupMenuAction instanceof DefaultActionGroup)) {
                System.err.print("ProjectViewPopupMenu is not instanceof DefaultActionGroup, but " + ProjectViewPopupMenuAction.getClass());
            }
            final DefaultActionGroup ProjectViewPopupMenuGroup = (DefaultActionGroup) ProjectViewPopupMenuAction;

            ProjectViewPopupMenuGroup.add(new Separator(), Constraints.FIRST);
            ProjectViewPopupMenuGroup.add(rootAction, Constraints.FIRST);

            // for debugging
//            Notifications.Bus.notify(new Notification(notificationGroupId, "Loading " + InstantPatchRemotePluginRegistration.shortName, "Loading finished...", NotificationType.INFORMATION, NotificationListener.URL_OPENING_LISTENER));
        } catch (Exception e) {
            System.err.println("Exception happened while registering root action group: " + e);
            Notifications.Bus.notify(new Notification(InstantPatchRemotePluginRegistration.notificationGroupId, "Loading " + InstantPatchRemotePluginRegistration.shortName,
                    "Loading error: " + e.toString(), NotificationType.ERROR, NotificationListener.URL_OPENING_LISTENER));
        }
    }
 
开发者ID:sanchouss,项目名称:InstantPatchIdeaPlugin,代码行数:29,代码来源:InstantPatchRemotePluginRegistration.java

示例10: createToolbarFromGroupId

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
private static ActionToolbar createToolbarFromGroupId(final String groupId) {
    final ActionManager actionManager = ActionManager.getInstance();

    if (!actionManager.isGroup(groupId)) {
        throw new IllegalStateException(groupId + " should have been a group");
    }
    final ActionGroup group = ((ActionGroup)actionManager.getAction(groupId));
    final ActionToolbarImpl editorToolbar =
            ((ActionToolbarImpl)actionManager.createActionToolbar(ActionPlaces.EDITOR_TOOLBAR, group, true));
    editorToolbar.setOpaque(false);
    editorToolbar.setBorder(new JBEmptyBorder(0, 2, 0, 2));

    return editorToolbar;
}
 
开发者ID:zalando,项目名称:intellij-swagger,代码行数:15,代码来源:SwaggerUIToolbar.java

示例11: getOrRegisterAction

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
public static ExternalSystemAction getOrRegisterAction(Project project, String group, TaskData taskData) {
  ExternalSystemTaskAction action = new ExternalSystemTaskAction(project, group, taskData);
  ActionManager manager = ActionManager.getInstance();
  AnAction anAction = manager.getAction(action.getId());
  if (anAction instanceof ExternalSystemTaskAction && action.equals(anAction)) {
    return (ExternalSystemAction)anAction;
  }
  manager.unregisterAction(action.getId());
  manager.registerAction(action.getId(), action);
  return action;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ExternalSystemKeymapExtension.java

示例12: unregisterAction

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
private static void unregisterAction(String actionId, String groupId) {
  ActionManager actionManager = ActionManager.getInstance();
  AnAction action = actionManager.getAction(actionId);
  if (action != null) {
    AnAction actionGroup = actionManager.getAction(groupId);
    if (actionGroup != null && actionGroup instanceof DefaultActionGroup) {
      ((DefaultActionGroup)actionGroup).remove(action);
      actionManager.unregisterAction(actionId);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PyCharmEduInitialConfigurator.java

示例13: executeAction

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
public static void executeAction(final String actionId, final InputEvent e) {
  final ActionManager actionManager = ActionManager.getInstance();
  final AnAction action = actionManager.getAction(actionId);
  if (action != null) {
    final Presentation presentation = new Presentation();
    final AnActionEvent event =
      new AnActionEvent(e, DataManager.getInstance().getDataContext(e.getComponent()), "", presentation, actionManager, 0);
    action.update(event);
    if (presentation.isEnabled()) {
      action.actionPerformed(event);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:MavenUIUtil.java

示例14: swipedLeft

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
@Override
public void swipedLeft(SwipeEvent event) {
  ActionManager actionManager = ActionManager.getInstance();
  AnAction forward = actionManager.getAction("Forward");
  if (forward == null) return;

  actionManager.tryToExecute(forward, createMouseEventWrapper(myFrame), null, null, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MacGestureAdapter.java

示例15: swipedRight

import com.intellij.openapi.actionSystem.ActionManager; //导入方法依赖的package包/类
@Override
public void swipedRight(SwipeEvent event) {
  ActionManager actionManager = ActionManager.getInstance();
  AnAction back = actionManager.getAction("Back");
  if (back == null) return;

  actionManager.tryToExecute(back, createMouseEventWrapper(myFrame), null, null, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:MacGestureAdapter.java


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