Revert "Delete outdated module type and module builder docs"

This reverts commit 2ab231f0
This commit is contained in:
Karol Lewandowski 2025-04-24 14:23:07 +02:00 committed by Karol Lewandowski
parent 262822e9e1
commit 3ecc8f13e0
4 changed files with 191 additions and 0 deletions

View File

@ -151,6 +151,10 @@
<toc-element topic="trusted_projects.md"/> <toc-element topic="trusted_projects.md"/>
<toc-element topic="new_project_wizard.md"/> <toc-element topic="new_project_wizard.md"/>
<toc-element topic="project_wizard.md"/> <toc-element topic="project_wizard.md"/>
<toc-element topic="intro_project_wizard.md" accepts-web-file-names="project_wizard.html">
<toc-element topic="adding_new_steps.md"/>
<toc-element topic="module_types.md"/>
</toc-element>
<toc-element topic="framework.md"/> <toc-element topic="framework.md"/>
</toc-element> </toc-element>
<toc-element topic="module.md"/> <toc-element topic="module.md"/>

View File

@ -0,0 +1,16 @@
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Project Wizard Tutorial
<link-summary>The Project Wizard Tutorial section overview.</link-summary>
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).

View File

@ -0,0 +1,104 @@
<!-- Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Adding New Steps to Project Wizard
<link-summary>Tutorial on adding a new step to a custom project wizard.</link-summary>
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 <include from="snippets.topic" element-id="ep"><var name="ep" value="com.intellij.moduleBuilder"/></include> in the <path>[plugin.xml](plugin_configuration_file.md)</path> configuration file.
```xml
<extensions defaultExtensionNs="com.intellij">
<moduleBuilder
builderClass="org.intellij.sdk.project.wizard.DemoModuleWizardStep"
id="DEMO_STEP"
order="first"/>
</extensions>
```
## 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.

View File

@ -0,0 +1,67 @@
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
# Supporting Module Types
<link-summary>Adding custom module types.</link-summary>
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 <path>[plugin.xml](plugin_configuration_file.md)</path> configuration file.
```xml
<extensions defaultExtensionNs="com.intellij">
<moduleType
id="DEMO_MODULE_TYPE"
implementationClass="org.intellij.sdk.module.DemoModuleType"/>
</extensions>
```
## 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 <ui-path>File | New | Module...</ui-path>.
A new module type and its settings panel are available in the Project Wizard.
![New Module Type](new_module_type.png){width="800"}