diff --git a/ijs.tree b/ijs.tree index 60bd2674f..234d5b891 100644 --- a/ijs.tree +++ b/ijs.tree @@ -151,6 +151,10 @@ + + + + diff --git a/topics/tutorials/intro_project_wizard.md b/topics/tutorials/intro_project_wizard.md new file mode 100644 index 000000000..cc8e3dca8 --- /dev/null +++ b/topics/tutorials/intro_project_wizard.md @@ -0,0 +1,16 @@ + + +# Project Wizard Tutorial + +The Project Wizard Tutorial section overview. + +This set of tutorials shows how to manipulate the process of project creation. +Configuring Project Wizard automatically allows you to do the following: + +1. [Adding New Steps to Project Wizard](adding_new_steps.md) +2. [Supporting Module Types](module_types.md) + +**Note:** + +Main utilities to configure a custom project wizard can be found in the package +[lang-api.ide.util.projectWizard](%gh-ic%/platform/lang-api/src/com/intellij/ide/util/projectWizard). diff --git a/topics/tutorials/project_wizard/adding_new_steps.md b/topics/tutorials/project_wizard/adding_new_steps.md new file mode 100644 index 000000000..c0e6d237e --- /dev/null +++ b/topics/tutorials/project_wizard/adding_new_steps.md @@ -0,0 +1,104 @@ + + +# Adding New Steps to Project Wizard + +Tutorial on adding a new step to a custom project wizard. + +This tutorial shows how to add an extra step to the Project Wizard to provide additional project configuration settings. + +## Pre-Requirements + +Create an empty plugin project. +See the [](creating_plugin_project.md) section for details. + +## Register Module Builder + +Project configuration settings depend on the project's module type. +Register a new in the [plugin.xml](plugin_configuration_file.md) configuration file. + +```xml + + + +``` + +## Create a Custom Module Builder + +Extend [`ModuleBuilder`](%gh-ic%/platform/lang-core/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java) class to provide custom configuration. + +```java +public class DemoModuleWizardStep extends ModuleBuilder { + public void setupRootModel(ModifiableRootModel modifiableRootModel) + throws ConfigurationException { + + } +} +``` + +## Define Module Type + +Set a module type for the extra wizard step to provide. +In this example, choose an `EMPTY` module type. + +```java +public class DemoModuleWizardStep extends ModuleBuilder { + public void setupRootModel(ModifiableRootModel modifiableRootModel) + throws ConfigurationException { + + } + + public ModuleType getModuleType() { + return ModuleType.EMPTY; //or it could be any other module type + } +} +``` + +## Design and Implement Wizard Steps + +Provide an implementation of a custom UI component to be added to the Wizard. +In this case, leave it as a label. + +```java +public class DemoModuleWizardStep extends ModuleBuilder { + public void setupRootModel(ModifiableRootModel modifiableRootModel) + throws ConfigurationException { + + } + + public ModuleType getModuleType() { + return ModuleType.EMPTY; + } + + @Override + public ModuleWizardStep[] createWizardSteps( + @NotNull WizardContext wizardContext, + @NotNull ModulesProvider modulesProvider) { + return new ModuleWizardStep[]{new ModuleWizardStep() { + @Override + public JComponent getComponent() { + return new JLabel("Put your content here"); + } + + @Override + public void updateDataModel() { + + } + }}; + } +} +``` + +## Checking UI Appearance + +After compiling and running the plugin, create a new project using a source-compiled instance of IntelliJ IDEA. + +![New Project](empty_project.png) + +Choose an *Empty Module* type, click next, and get to the just added extra step. + +![Extra Step](extra_step.png) + +Modify and tune the UI component depending on requirements. diff --git a/topics/tutorials/project_wizard/module_types.md b/topics/tutorials/project_wizard/module_types.md new file mode 100644 index 000000000..0a3e26410 --- /dev/null +++ b/topics/tutorials/project_wizard/module_types.md @@ -0,0 +1,67 @@ + + +# Supporting Module Types + +Adding custom module types. + +IntelliJ Platform provides a set of standard module types. +However, an application might need a module of a type that isn't supported yet. +This tutorial shows how to register a new module type and link it to the project creation procedure and the UI. + +The source code for the [`module`](%gh-sdk-samples-master%/module) and [`project_wizard`](%gh-sdk-samples-master%/project_wizard) code samples is used throughout this tutorial. + +## Pre-Requirements + +Create an empty plugin project. +See the [](creating_plugin_project.md) section for details. + +> The UI for selecting module types and the creation of modules through project wizard is IntelliJ IDEA-specific. +> +{style="note"} + +## Register a New Module Type + +Add a new `com.intellij.moduleType` implementation with the IntelliJ Platform in the [plugin.xml](plugin_configuration_file.md) configuration file. + +```xml + + + +``` + +## Implement `ModuleType` Interface + +Create the `DemoModuleType` implementation based on [`ModuleType`](%gh-ic%/platform/lang-core/src/com/intellij/openapi/module/ModuleType.java). + +`getNodeIcon()` should return module type specific icon. + +```java +``` +{src="module/src/main/java/org/intellij/sdk/module/DemoModuleType.java" include-symbol="DemoModuleType"} + +## Implement Custom Module Builder + +Create `DemoModuleBuilder` based on [`ModuleBuilder`](%gh-ic%/platform/lang-core/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java). + +```java +``` +{src="module/src/main/java/org/intellij/sdk/module/DemoModuleBuilder.java" include-symbol="DemoModuleBuilder"} + +## Provide Custom Wizard Steps + +Provide a straightforward implementation of UI components for the project creating stage. +Create a generic `DemoModuleWizardStep` based on [`ModuleWizardStep`](%gh-ic%/platform/lang-core/src/com/intellij/ide/util/projectWizard/ModuleWizardStep.java) + +```java +``` +{src="module/src/main/java/org/intellij/sdk/module/DemoModuleWizardStep.java" include-symbol="DemoModuleWizardStep"} + +## Creating a Module of New Type + +After compiling and running the plugin in a development instance, create a new project. +Select File | New | Module.... +A new module type and its settings panel are available in the Project Wizard. + +![New Module Type](new_module_type.png){width="800"}