IDEA Plugin Dev - Project level components



Manual Creation

  • A project level component’s implementation class may implement the ProjectComponent interface.
  • The constructor of a project level component can have a parameter of the Project type, if it needs the project instance. It can also specify other application-level or project-level components as parameters, if it depends on those components.
  • Registration: in the <project-components> section of the plugin.xml file.

Wizard Creation

In your project:

  • open the context menu of the destination package and click New (or press Alt+Insert).
  • In the New menu, click Project Component.
  • In the New Project Component dialog box that opens, enter the project component name, and then click OK.

The IntelliJ Platform will:

  • generate a new Java class that implements the ProjectComponent interface;
  • register the newly created component
  • add a node to the module tree view;
  • and open the created application component class file in the editor.

State Persistence

When implemeting JDOMExternalizable (deprecated) interface, the project component save their state to the project (.ipr) file. However, if the workspace option in the plugin.xml file is set to true, the component saves its configuration to the workspace (.iws) file instead.

See Idea Plugin Dev - Component

Powered by ComboStrap