Project Wizard

Detail about implementing

If you are just looking for example code see the tutorials section

Project Type

There seems to be two different ways to create a new project type. In the official docs this is done using the moduleType, and the moduleBuilderextension points. Some of the official IntelliJ plugins create project types in another way using the directoryProjectGenerator, and projectTemplatesFactory extension points.

Both methods are about the same amount of work to implement and both methods wind up using a subclass of the ModuleBuilder class so I'm not sure when you would prefer one method over the other.

The plugin.xml file for the Dart plugin suggests that moduleBuilder only works in IDEA while directoryProjectGenerator will work with all other IDE's in addition to IDEA. I haven't tested this yet, but you could pull the Module Type Sample plugin and modify the build.gradle to use PY for the value of intellij.type and see if you are still able to see the new module.

To confuse things even more this post seems to suggest that projectTemplatesFactory is used for IDEA too. Diagramming a couple of examples might help a bit to figure out the difference.

Project Generators and Project Templates

One of the ways to add something to the new project wizard is to use the directoryProjectGenerator and projectTemplatesFactory extension points. Doing this requires 4 Classes.

Class Description

Notes

Settings

Used to store project settings Often this is a subclass of DataHolder but this is not a requirement and your settings can be modeled using any type of object. (FIXME not completely sure if things other than JS plugins use DataHolder. Most things seems to just use a POJO)

ProjectTemplateFactory

projectTemplatesFactory extension point implementation

DirectoryProjectGenerator

directoryProjectGenerator extension point implementation

should also implement the ProjectTemplate interface

ProjectGeneratorPeer

Provides the settings form for that is displayed when selecting your project type

Existing Implementations

This is not meant to be a full list of everything that implements the DirectoryProjectGenerator extension point's interface, but rather calls out the most common types of Classes/Interfaces that you will want to use for implementation.

  • AbstractGithubTagDownloadedProjectGenerator

    • can look through github tags to show a specific version of something to install (ex. bootstrap project generator)

  • WebProjectTemplate

    • used more like a generic base class even if something isn't "web" specific (FIXME show example usage of this)

  • TemplateProjectDirectoryGenerator

Recommendations

Package layout

A consensus about the directory layout for project wizard files does not exist. A quick search on GitHub reveals a few conventions that exist for the package structure. To keep things simple you I have removed the root package prefix from all of these package names. For example if my main namespace is com.example.my.plugin then package.name would translate to the full package name com.example.my.plugin.package.name.

  • no package - probably prefer this one. It tends to be used more often in IntelliJ code.

  • cli - often used when a project type exists for some sort of command line application variant

  • projectWizard

  • project

  • project.generator

  • module

  • ProjectBuilder

  • ui.wizard

Internationalization

For internationalization purposes it is recommended that you add the following to your message bundle. We recommend using action.new-project as a part of your message bundle

  • description

  • name

Additionally you will also want to add the field labels for any settings you use in your project generator.

Example Properties File

# STRONGLY Recommended
example.action.new-project.name=Example Module
example.action.new-project.description=A description of a new Example project type.

# Other settings
example.action.new-project.label-additional-parameters=Additional parameters:
example.action.new-project.label-defaults=Use the &default project setup
example.action.new-project.label-content-root-folder=Content root folder
example.action.new-project.label-project-name=Project

Frameworks

https://www.jetbrains.org/intellij/sdk/docs/tutorials/framework.html

Reference

Plugins with Examples

Extension Points

TODO

  • Do a more complete lookup of types of modules and template generators and do a tutorial on each

  • document differences between module and project template/generator

Last updated

Was this helpful?