mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-29 17:57:53 +08:00
[site] "add new wizard step" tutorial
This commit is contained in:
parent
b6268c5c72
commit
c35922aa67
@ -130,6 +130,7 @@
|
|||||||
* [2. Editor Coordinates System. Positions And Offsets](tutorials/editor_basics/coordinates_system.html)
|
* [2. Editor Coordinates System. Positions And Offsets](tutorials/editor_basics/coordinates_system.html)
|
||||||
* [3. Handling Editor Events](tutorials/editor_basics/editor_events.html)
|
* [3. Handling Editor Events](tutorials/editor_basics/editor_events.html)
|
||||||
* [Project Wizard](tutorials/project_wizard.html)
|
* [Project Wizard](tutorials/project_wizard.html)
|
||||||
|
* [Adding New Steps to Project Wizard](tutorials/project_wizard/adding_new_steps.html)
|
||||||
* [Code Inspections](tutorials/code_inspections.html)
|
* [Code Inspections](tutorials/code_inspections.html)
|
||||||
* [Run Configurations](tutorials/run_configurations.html)
|
* [Run Configurations](tutorials/run_configurations.html)
|
||||||
* [Supporting Frameworks](tutorials/framework.html)
|
* [Supporting Frameworks](tutorials/framework.html)
|
||||||
|
@ -7,7 +7,7 @@ This set of tutorials shows how to manipulate the process of project creation.
|
|||||||
Configuring Project Wizard automatically allows you to do the following:
|
Configuring Project Wizard automatically allows you to do the following:
|
||||||
|
|
||||||
|
|
||||||
1. [Adding new steps to the wizard]()
|
1. [Adding New Steps to Project Wizard](tutorials/project_wizard/adding_new_steps.html)
|
||||||
2. [Providing additional setting for project creation]()
|
2. [Providing additional setting for project creation]()
|
||||||
3. [Handling activities during project creation]()
|
3. [Handling activities during project creation]()
|
||||||
4. [Initial environment configuration]()
|
4. [Initial environment configuration]()
|
||||||
|
108
tutorials/project_wizard/adding_new_steps.md
Normal file
108
tutorials/project_wizard/adding_new_steps.md
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
---
|
||||||
|
layout: editable
|
||||||
|
title: Adding New Steps to Project Wizard
|
||||||
|
---
|
||||||
|
|
||||||
|
This tutorial shows how to add a extra-step to the Project Wizard in order to provide additional project configuration settings.
|
||||||
|
|
||||||
|
## Pre-requirements.
|
||||||
|
|
||||||
|
Create an empty plugin project.
|
||||||
|
See
|
||||||
|
[Creating a Plugin Project](basics/getting_started/creating_plugin_project.html)
|
||||||
|
to know how to do it.
|
||||||
|
|
||||||
|
## 1. Register Module Builder
|
||||||
|
|
||||||
|
Project configuration settings depend on the project's module type.
|
||||||
|
Register a new *moduleBuilder* extension point in the
|
||||||
|
[plugin.xml](TODO) configuration file.
|
||||||
|
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
<moduleBuilder builderClass="org.jetbrains.tutorials.project.wizard.DemoModuleWizardStep" id="DEMO_STEP" order="first"/>
|
||||||
|
</extensions>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 2. Create a Custom Module Builder
|
||||||
|
|
||||||
|
Extend
|
||||||
|
[ModuleBuilder](TODO)
|
||||||
|
class to provide custom configuration.
|
||||||
|
|
||||||
|
```java
|
||||||
|
public class DemoModuleWizardStep extends ModuleBuilder {
|
||||||
|
public void setupRootModel(ModifiableRootModel modifiableRootModel) throws ConfigurationException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModuleType getModuleType() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Define Module Type
|
||||||
|
|
||||||
|
Set a module type you want to provide an extra wizard step for. In this example we 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Design and Implement Wizard Steps
|
||||||
|
|
||||||
|
Provide an implementation of a custom UI component to be added to the Wizard.
|
||||||
|
In this case we 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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Checking UI Appearance
|
||||||
|
|
||||||
|
After compiling and running the plugin create a new project using compiled from sources instance of IntelliJ IDEA.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Choose an *Empty Module* type, click next, and you get to the just added extra step.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Modify and tune the UI component depending on your requirements.
|
||||||
|
|
||||||
|
|
BIN
tutorials/project_wizard/img/empty_project.png
Normal file
BIN
tutorials/project_wizard/img/empty_project.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 151 KiB |
BIN
tutorials/project_wizard/img/extra_step.png
Normal file
BIN
tutorials/project_wizard/img/extra_step.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Loading…
x
Reference in New Issue
Block a user