This topic explains how you can create a plugin that customize the system dialog box Settings displayed when you click on the IDEA toolbar. This dialog box (see the screenshot below) allows you to specify both the project-specific and IDE-specific settings.
To customize this dialog, your plugin must contribute to the applicationConfigurable (IDE settings) or projectConfigurable (project settings) extenstion points available in the IDEA core.
This topic considers a sample plugin that customizes the IDE-specific settings. However, you can create your own plugin for customization of the project-scpecific settings using the similar technique.
Creation of Extension to applicationConfigurable
To create a plugin that contributes to the applicationConfigurable extension point and customizes the IDE Settings area of the Setting dialog box, perform the following principal steps:
- In your plugin project, create a Java class that implements the Configurable interface.
- In this class, override the following methods:
createComponent: creates the UI visual form and returns its root element.
apply: this method is called when the user clicks the OK or Apply button.
reset: this method is called when the user clicks the Cancel button.
isModified: this method is regularly called to check the form for changes. If the method returns
false, the Apply button is disabled.
disposeUIResources: this method is called when the user closes the form. In this method, you can, for example, release the resources used by the form.
- In the plugin configuration file plugin.xml, create the <extensions defaultExtensionNs="com.intellij"> </extensions> section.
- To this section, add the <applicationConfigurable instance=%MyJavaClassName%></applicationConfigurable> section, where the %MyJavaClassName% refers to the name of your Java class implementing the
Configurableinterface (see Step 1).
To clarify the above procedure, consider the applicationConfigurable sample plugin that adds the new menu command "Menu Font" to the IDE Settings area. Clicking this commands causes IntelliJ IDEA to display a visual form designed to specify a font 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 project folder%>/community/samples/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.