IntelliJ Community . WizardPluginDev

 
WizardPluginDev 

HOME INDEX SEARCH CHANGES GO  


Development of WizardPlugin

OpenAPI documentation

You can create your own WizardComponents. The Wizard - is set of WizardComponents. In your extension for WizardPlugin you may define one or more Wizards. To control init and finish events you must also assign WizardListener to your Wizard.

WizardComponent interface desription

If you look from Wizard visual side, then implementation of WizardComponent - is one tab (or screen) of Wizard.

You must have implemented follow method:

  • getName, this method return text to be show in Wizard tab title.
null if you wish no icon in tab.
  • getComponent, this is main root pane of Wizard tab. The visual presentation of WizardComponent.
  • init(Map properties), this is event method. It fires then wizard is runned. Purpose of this method initialize WizardComponent. Additionaly, to this method passed properties from wizardry.xml descriptor, associated with it WizardComponent.
  • update, this is event method. It fires then user see component step in Wizard expert dialog.
  • save, this is event method. It fires then user change tab (clicking on other tab or using navigation buttons "Back" and "Next") and wizard must perform saving parameters from UI.
  • validate, this is event method. It fires right after save method event. Purpose of this method - check saved parameters in WizardComponent and return false if something wrong, also in this method you can highlight changes.

WizardListener interface desription

This listener need for performing initializing task of wizard, and also for finish task (then user press button "Finish").

  • init(WizardEvent e), method invoked then Wizard is runned, but before showing Wizard dialog.
  • finish(WizardEvent e),method invoked, then user closed Wizard dialog by pressing on "Finish" button. In this method Wizard must perform all wizardry logic of Wizard, for example generate IPR file and open it.

Shared standard WizardComponents

You can use already created WizardComponent in your Wizards

org.intellij.wizard.impl.standard.components.WelcomeComponent

This is "Welcome" screen component. It have properties:

  • welcome.title, the title of 'welcome' tab
  • wecome.text, the Welcome Message text
Example:
...
      <component
        id="welcome"
        next="project"
        class-name="org.intellij.wizard.impl.standard.components.WelcomeComponent">
        <properties>
          <property name="welcome.title" value="Info"/>
          <property name="welcome.text"><![CDATA[
           <html>
             <p><b>Simple IDEA project Wizard</b></p>
             <p>
               This wizard help you to create simple IDEA project.
             </p>
           </html>
          ]]></property>
        </properties>
      </component>
...

org.intellij.wizard.impl.standard.components.ProjectComponent

tip.gif This component is under development.

This is component of setting properties from "Project Settings->Main Module".

Example:

...
      <component
        id="project"
        class-name="org.intellij.wizard.impl.standard.components.ProjectComponent" />
...

Wizardry documenation

To create wizard you must link your components into wizard. For this must used file META-INF/wizardry.xml in one of jar files of your extension, or in classes directory of your extension. This wizard structure look like IDEA plugins structure organization.

Structure of wizardry directories

The plugin have follow folders:

[%PLUGINS_HOME%]
+ [wizard], this is home folder of WizardPlugin
  + [wizardry], this is Wizardry Home folder

The Wizardry Home may have follow structure:

[wizardry]
+ YourWizard-01.jar, Single jar file of your Wizards with META-INF/wizardry.xml within it.
+ *.jar
+ [YourWizard-02], Directory of your Wizards
  + [classes], Classes directory - added to Wizards classpath
  + [lib], Wizards jars directory
    + *.jar, All jars added to class path. In one of them, or in "classes" directory must be META-INF/wizardry.xml file.

Sample of wizardry.xml


<wizardry> 
  <wizard category="project"> 
    <name>Empty Project</name> 
    <description> 
      Wizard provided only common project settings for basic IDEA project. 
    </description> 
    <vendor>Alexey Efimov</vendor> 
 
    <wizard-components start-component="welcome"> 
      <component 
        id="welcome" 
        next="project" 
        class-name="org.intellij.wizard.impl.standard.components.WelcomeComponent"> 
        <properties> 
          <property name="welcome.title" value="Info"/> 
          <property name="welcome.text"><![CDATA[ 
           <html> 
             <p><b>Simple IDEA project Wizard</b></p> 
             <p> 
               This wizard help you to create simple IDEA project with out any 
               modules assigned. After project creation you can attach modules 
               to it. 
             </p> 
           </html> 
          ]]></property> 
        </properties> 
      </component> 
      <component 
        id="project" 
        class-name="org.intellij.wizard.impl.standard.components.ProjectComponent"/> 
    </wizard-components> 
 
    <wizard-listeners> 
      <listener class-name="org.intellij.wizard.impl.project.WizardAdapter"/> 
    </wizard-listeners> 
  </wizard> 
</wizardry> 

Document Type Definition


<!ELEMENT wizardry (wizard)*> 
<!ELEMENT wizard (name, description?, vendor?, wizard-components, wizard-listeners)> 
<!-- 
Category may be one of follow values: project, module, code 
--> 
<!ATTLIST wizard 
    category CDATA #IMPLIED 
    icon CDATA #IMPLIED> 
<!ELEMENT name (#PCDATA)> 
<!ELEMENT description (#PCDATA)> 
<!ELEMENT vendor (#PCDATA)> 
 
<!ELEMENT wizard-components (component+)> 
<!ATTLIST wizard-components 
    start-component CDATA #REQUIRED> 
<!ELEMENT component (properties?)> 
<!ATTLIST component 
    class-name CDATA #REQUIRED 
    id ID #REQUIRED 
    next CDATA #IMPLIED> 
<!ELEMENT properties (property+)> 
<!ELEMENT property (#PCDATA)> 
<!ATTLIST property 
    name CDATA #REQUIRED 
    value CDATA #IMPLIED> 
 
<!ELEMENT wizard-listeners (listener+)> 
<!ELEMENT listener (#PCDATA)> 
<!ATTLIST listener 
    class-name CDATA #REQUIRED> 

Variations in wizardry.xml

You can use wizardry.xml to describe only one wizard - then you must use root tag "wizard", instead of "wizardry".

If you use "wizardry" as root tag, you may define multiwizards in your wizardry package.

Localizarion of wizardry.xml

You can use same wizardry.xml for different languages. To enable localization in your wizardry package, you must clone wizardry.xml to wizardry_<language>_<country>_<variant>.xml and translate it.

To define encoding, please specify it in XML header:

<?xml version="1.0" encoding="UTF-8" ?>

Searching will be performed by looking at default system locale, and then try find the corresponding by locale file.

For example, wizardry_ru.xml will be taken if default system locale is Russian, etc.

e d i t a t t a c h r e f - b y d i f f s m o r e
Have ideas, requests, problems regarding this site? Send feedback.
Copyright © 2000-2003 by the contributing authors. All materials at intellij.org are the property of the contributing authors.