Java Code Examples for com.intellij.openapi.actionSystem.ActionManager#registerAction()
The following examples show how to use
com.intellij.openapi.actionSystem.ActionManager#registerAction() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AppComponent.java From PackageTemplates with Apache License 2.0 | 5 votes |
@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); } }
Example 2
Source File: ReplaceActionHelper.java From intellij with Apache License 2.0 | 5 votes |
/** * Registers a new action against the provided action ID, unregistering any existing action with * this ID, if one exists. */ public static void replaceAction(String actionId, AnAction newAction) { ActionManager actionManager = ActionManager.getInstance(); AnAction oldAction = actionManager.getAction(actionId); if (oldAction != null) { newAction.getTemplatePresentation().setIcon(oldAction.getTemplatePresentation().getIcon()); ActionManager.getInstance().replaceAction(actionId, newAction); } else { actionManager.registerAction(actionId, newAction); } }
Example 3
Source File: PantsActionConfigurationCustomizer.java From intellij-pants-plugin with Apache License 2.0 | 5 votes |
@Override public void customize(@NotNull ActionManager manager) { // Registers the rebuild action to Pants rebuild action. // Registers Make module action to 'Make all targets in module' action. // Disables compile action AnAction pantsCompileAllTargetAction = new PantsOverrideAction( PantsConstants.ACTION_MAKE_PROJECT_DESCRIPTION, new PantsCompileAllTargetsAction(), manager.getAction(PantsConstants.ACTION_MAKE_PROJECT_ID), PantsIcons.Icon ); AnAction pantsMakeModuleAction = new PantsOverrideAction( new PantsCompileAllTargetsInModuleAction(Optional.empty()), manager.getAction(PANTS_COMPILE_MODULE_ACTION_NAME) ); AnAction pantsRebuildAction = new PantsOverrideAction( PantsConstants.REBUILD_PROJECT_DESCRIPTION, new PantsRebuildAction(), manager.getAction(PANTS_REBUILD_ACTION_NAME) ); manager.registerAction(PANTS_COMPILE_PROJECT_ACTION_NAME, pantsCompileAllTargetAction); manager.registerAction(PANTS_COMPILE_MODULE_ACTION_NAME, pantsMakeModuleAction); manager.registerAction(PANTS_REBUILD_ACTION_NAME, pantsRebuildAction); }
Example 4
Source File: ShortcutStartupActivity.java From StringManipulation with Apache License 2.0 | 5 votes |
protected static void registerAction(ActionManager actionManager, DefaultActionGroup group, CustomActionModel customActionModel) { if (StringUtils.isNotBlank(customActionModel.getId()) && StringUtils.isNotBlank(customActionModel.getName())) { CustomAction action = new CustomAction(customActionModel); LOG.info("Registering " + action + " id:" + customActionModel.getId()); actionManager.registerAction(customActionModel.getId(), action, PluginId.getId("String Manipulation")); group.add(action, Constraints.FIRST); CustomActionModel reverse = customActionModel.reverse(); CustomAction reverseAction = new CustomAction(reverse); LOG.info("Registering " + reverseAction + " id:" + reverse.getId()); actionManager.registerAction(reverse.getId(), reverseAction, PluginId.getId("String Manipulation")); // group.add(reverseAction, Constraints.FIRST); } }