Configuring Extensions to the IntelliJ IDEA Core
This topic explains how you can create a plugin that contributes to extension points declared in the IntelliJ IDEA core.
From this page, you can also download a sample plugin illustrating how to contribute to the applicationConfigurable extenstion point.
How to Get the Extension Points List?
To get a list of extension points available in the IntelliJ IDEA core, consult the <extensionPoints> section of the following XML configuration files:
How to Create an Extension in Your Plugin?
To create an extension that contributes to the specified extension point, perform the following steps:
- In your plugin project, create a Java class that implements a bean class or an interface that is allowed to access the extension point.
- In the plugin configuration file plugin.xml, create the <extensions defaultExtensionNs="com.intellij"> </extensions> section.
- To this section, add the child element similar to the following syntax: <extensionPointName implementation=implementation class name></extensionPointName>.
Where the extensionPointName refers to the extension point name, and the implementation class name refers to the newly created Java class.
Sample Plugin: Extension to the applicationConfigurable Extension Point
To clarify the extension creation procedure, consider a sample plugin that contributes to the applicationConfigurable extension point. The applicationConfigurable extension point is designed to configure IDEA settings pertaining to your workspace. The IntelliJ IDEA UI provides the Settings dialog you can display by clicking on the IDEA toolbar. The settings pertaining to your workspace are displayed under IDE Settings (see the sample screenshot below). A plugin that contributes to the applicationConfigurable extension point can add new menu command(s) under IDE Settings.
applicationConfigurable Sample Plugin
The applicationConfigurable sample plugin adds the new menu command "Menu Font" to the IDE Settings area. Clicking this commands causes IntelliJ IDEA to display a UI designed to specify a font used for the IntelliJ IDEA menus. This UI is similar to the following screen:
To run this sample plugin
- Start IntelliJ IDEA and open the applicationConfigurable project saved into the <%IDEA Installation folder%>/community/applicationConfigurable directory.
- 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 , and then complete the Project Structure dialog box that opens.
- Run the plugin by choosing the Run | Run on the main menu.
If necessary, change the Run/Debug Configurations .
- On the toolbar menu, click .
The Settings dialog box opens.
- In the Settings dialog box, under IDE Settings, click Menu Font.
The plugin displays UI designed to change the IDEA menu font.