Eclipse Wizard UI

On this page we create a wizard UI extension point, it assumes you have already created a new Plug-in Project (If you have not allready done this you can go back to this page for a guide to doing this).

Creating a Wizard UI Extension Point.

If it is not already selected then select the MANIFEST.MF file

Select the org.eclipse.ui.newWizards extension but do not choose any templates.

wizard project

Click Finish.

We now need to create the place under the file->new menu where the wizard is called. The first level is called the category and inside that is the menu item for the wizard. When we click file->new we want to see somthing similar to that shown on the right:
Right click on org.eclipse.ui.newWizards and select New –> Category wizard project

With the “name (category)” selected enter:

  • id* of com.euclideanspace.spad.
    builder.category.wizards
  • name*: SPAD

Save the file

wizard project

Right click on org.eclipse.ui.newWizards and select New –> Wizard

With the 'name (wizard)' selected, under 'Extension Element Details' enter:

  • id: builder.wizard.new.custom
  • name: SPAD import wizard
  • class: customplugin.
    wizards.BuilderNewWizard
  • category: com.euclideanspace.spad.
    builder.category.wizards

Save the file

builder wizard

Create the BuilderWizard class

Click on the class link for customplugin.wizards.BuilderNewWizard to open the New Class Wizard.

In the New Class Wizard click Finish. build wizard

Add WizardNewProjectCreationPage to the BuilderNewWizard

Add a private field to the BuilderNewWizard:
private WizardNewProjectCreationPage _pageOne;
You will get a compile error. Return to the plugin.xml file and select the Dependencies tab.
Click Add and select org.eclipse.ui.ide. Click Finish.
Return to CustomProjectWizard. Press Ctrl+Shift+O to add any missing imports.
Save the file. The compile error should disappear.
 
Override addPages() (defined in the parent Wizard class):
	@Override
	public void addPages() {
	    super.addPages();
 
	    _pageOne = new WizardNewProjectCreationPage 
("From Scratch Project Wizard"); _pageOne.setTitle("From Scratch Project"); _pageOne.setDescription("Create something from scratch."); addPage(_pageOne); }
Have performFinish() return true.  
Have the constructor set the title field.
public CustomProjectNewWizard() {
    setWindowTitle("my window title");
}
Save the file.  

Add a wizard creation page

plugin.xml file

So what has the above done to the project code?

Running the code from the extensions page, as described above, creates entries in the plugin.xmi which create extensions to the Eclipse UI.

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
  <extension
        point="org.eclipse.ui.newWizards">
  <category
        id="com.euclideanspace.modelText.category.wizards"
        name="textOut">
  </category>
  <wizard
        category="com.euclideanspace.modelText.textOut.category.wizards"
        class="com.euclideanspace.modelText.TextOutNewWizard"
        id="textOut.wizard.new.custom"
        name="TextOut">
  </wizard>
  </extension>
</plugin>

Calling the Wizard

The wizard is called from:

File -> new -> SPAD -> SPAD project

as defined in:

/com.euclideanspace.spad.builder/OSGI-INF/l10n/bundle.properties

#Properties file for com.euclideanspace.spad.builder
category.name = SPAD
wizard.name = SPAD project
Bundle-Vendor = EUCLIDEANSPACE
Bundle-Name = SPAD Builder

Further Reading

How do we create menu entries. That is described on the next page.


metadata block
see also:
Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

 

 

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to this site, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2017 Martin John Baker - All rights reserved - privacy policy.