Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

Tool windows are child windows of IntelliJ IDEA used to display information.
Tool windows generally have their own toolbars (referred to as tool window bars) along the outer edges of the main window containing one or more tool window buttons. For detailed information about tool windows, see IntelliJ IDEA Web Help .

How to Create a Tool Window?

The IntelliJ IDEA core provides the toolWindow extension point that you can use to create and configure your custom tool windows. This extension point is declared using the ToolWindowEP bean class.
To create a tool window, you should develop a plugin that declares an extension to the toolWindow extension point.

Creation of Plugin

To create a plugin that displays a custom tool window, perform the following principal steps:

  1. In your plugin project, create a Java class that implements the ToolWindowFactory interface.
  2. In this class, override the createToolWindowContent method.
    This method specifies the content for your tool window.
  3. In the plugin configuration file plugin.xml, create the <extensions defaultExtensionNs="com.intellij"> </extensions> section.
  4. To this section, add the <toolWindow> element, and for this element, set the following attributes declared in the ToolWindowEP bean class:
    • id (required): specifies the tool window caption.
    • anchor (required): specifies the tool window bar where the tool window button will be displayed. Possible values: "left", "right", "top", "bottom."
    • secondary (optional): when true, the tool window button will be shown on the lower part of the tool window bar. Default value is false.
    • factoryClass (required): specifies the Java class implementing the ToolWindowFactory interface (see Step 1).
    • icon (optional): specifies path to the icon that identifies the tool window, if any.
    • conditionClass (optional): specifies a Java class that implements the com.intellij.openapi.util.Condition interface. Using this class, you can define conditions to be met to display tool window button. In the Condition class, you should override the value method: if this method returns false, the tool window button is not displayed on tool window bar.

To clarify the above procedure, consider the following fragment of the plugin.xml file:

Code Block
<extensions defaultExtensionNs="com.intellij">
    <toolWindow id="My Sample Tool Window" icon="/myPackage/icon.png" anchor="right" factoryClass="myPackage.MyToolWindowFactory">

Sample Plugin

To clarify how to develop your plugins that create tool windows, consider the toolWindow sample plugin available in the <%IDEA Community Edition source code%>/samples/toolWindow> directory. This plugin creates the Sample Calendar tool window that displays the system date, time and time zone.

To run toolWindow plugin

  1. Start IntelliJ IDEA and open the toolWindow project saved into the samples/toolWindow directory in the IntelliJ IDEA Community Edition source code.
  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 , 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 .

The plugin creates the Sample Calendar tool window. When opened, this tool window is similar to the following screen: