Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel

This document is a work in progress.

This topic describes the actions sample plugin that adds a new action group to the IDEA main menu and toolbar. Basing on this information, you can develop your own plugins using similar techniques.

About Actions

The system of actions allows plugins to add their own items to IDEA menus and toolbars. An action is a class, derived from the AnAction class, whose actionPerformed method is called when the menu item or toolbar button is selected.
Actions are organized into groups, which, in turn, can contain other groups. A group of actions can form a toolbar or a menu. Subgroups of the action group can form submenus of the menu.
For more information about actions, see IntelliJ IDEA Action System and Getting Started with Plugin Development .

Used Techniques

The actions plugin uses the following techniques:

  • Registering actions in the <actions> section of the plugin configuration file plugin.xml.
  • Adding the same actions to the action groups on the IDEA main menu and toolbar.
  • Adding icons to display on the toolbar or next to the menu items.

Sample Plugin

The actions sample plugin is available in the <%IDEA project folder%>/community/samples/actions> directory. When launched, this plugin adds the new group Sample Menu to the IDEA main menu and two toolbar buttons Image Removed and Image Removed to the IDEA toolbar:

Image Removed

To run the sample plugin

  1. Start IntelliJ IDEA and open the actions project saved into the <%IDEA project folder%>/community/samples/actions directory.
  2. Ensure that the project settings are valid for your environment. If necessary, modify the project settings.
    To view or modify the project settings, on the toolbar, click Image Removed, and then complete the Project Structure dialog box that opens.
  3. Run the plugin by choosing the Run | Run on the main menu.
    If necessary, change the Run/Debug Configurations .

Redirect
locationhttp://www.jetbrains.org/intellij/sdk/docs/basics/action_system.html