Child pages
  • Implementing Run Configurations in IntelliJ IDEA

Versions Compared

Key

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

A run configuration provides the user with the possibility to run a certain type of external process (script, application server etc.) from within the IDE. You can provide UI for the user to specify execution options, as well as the possibility to create run configuration based on a specific location in the source code.

In this document, we'll start with explaining the core concepts used by the run configuration API and then will proceed to look at the sequence of steps required to implement a typical run configuration.

Executor

The Executor interface describes a specific way of executing any possible run configuration. The three default executors provided by the IntelliJ Platform by default are Run, Debug and (in IntelliJ IDEA Ultimate and certain platform-based IDEs) Run with Coverage. Each executor gets its own toolbar button, which starts the selected run configuration using this executor, and its own context menu item for starting a configuration using this executor.

As a plugin developer, you normally don't need to implement the Executor interface. However, it can be useful, for example, if you're implementing a profiler integration and want to provide the possibility to execute any configuration with profiling.

ConfigurationType

The starting point for implementing any run configuration type is the ConfigurationType interface. Your implementation of that interface needs to be registered in the <configurationType> extension point in plugin.xml.

The easiest way to implement this interface is to use the ConfigurationTypeBase base class. In order to use it, you need to inherit from it and to provide the configuration type parameters (ID, name, description and icon) as constructor parameters. In addition to that, you need to call the addFactory() method to add a configuration factory.

ConfigurationFactory

Each run configuration type needs to provide at least one ConfigurationFactory. One is normally enough, but you can provide more than one if your run configuration can be created in multiple variants (for example, local and remote for an application server).

The key API of ConfigurationFactory, and the only method that you're required to implement, is the createTemplateConfiguration method. This method is called once per project to create the template run configuration. All real run configurations (loaded from the workspace or created by the user) are called by cloning the template through the createConfiguration method.

You can customize additional aspects of your configuration factory by overriding the getIcon, getAddIcon, getName and the default settings methods. These additional overrides are optional.

Note

to be continued

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