You can add a wizard to the command link File > New menu options in the workbench using the org.eclipse.ui.newWizards extension point. The readme tool example uses this extension point definition to add the Readme File wizard:

      point = "org.eclipse.ui.newWizards">
	   id = ""
	   id = ""
      	   name = ""
	   <selection class="org.eclipse.core.resources.IResource"/>

The category describes the grouping for the wizard.  An optional parentCategory establishes the new category as a child of an existing category.

Top level categories will appear in the File > New menu.  In this example, the parentCategory is set to an "Examples" category.  Where did the parent category come from?  The org.eclipse.ui plug-in defines a standard examples category in its markup:


This category appears in the File > New menu.

New menu with Examples category


The readme tool's category name defines the label that is used for the next layer of grouping underneath the parent category.  These categories are shown as the second level in the tree shown in the New Example wizard.  The wizard's name and icon are shown underneath when you expand the category.  The description of the selected wizard is shown at the top of the wizard when you select it.

New example wizard with readme entries

This information about the wizard appears solely because of the markup in the plugin.xml file.  None of the plug-in code runs until the user chooses the Next button.  Once this happens, the workbench will instantiate the wizard class specified in the markup and pass it an expected selection class.

The class identified in this extension (ReadmeCreationWizard) must implement the INewWizard interface.  Most wizards do so by extending the platform Wizard class although this is an implementation mechanism and not required by the extension point.

The wizard itself does little but create the pages inside of it. Let's look at the implementation of the page first, and then come back to the wizard.


The workbench provides base wizard page classes that support the type of processing performed for each wizard extension point. You can use these pages, or extend them to add additional processing.

The goal of the ReadmeCreationWizard is to create a new file, add the required content to the file, and as an option, open an editor on the file. Our page needs to define the controls that let the user specify what content goes in the file and whether an editor should be launched.

We create the wizard page, ReadmeCreationPage, by extending WizardNewFileCreationPage. The controls for a wizard page are defined in a fashion similar to the definition of the controls for a view or an editor. The page implements a createControl method, creating the necessary SWT widgets as children of the supplied Composite. Since the superclass already adds widgets that support new file processing, we need only extend the createControl method in our wizard page to add the additional checkboxes that control generation of sections and opening of the editor.

   public void createControl(Composite parent) {
      // inherit default container and name specification widgets
      Composite composite = (Composite)getControl();
      // sample section generation group
      Group group = new Group(composite,SWT.NONE);
      group.setLayout(new GridLayout());
      group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL |
      // sample section generation checkboxes
      sectionCheckbox = new Button(group,SWT.CHECK);

      subsectionCheckbox = new Button(group,SWT.CHECK);
      // open file for editing checkbox
      openFileCheckbox = new Button(composite,SWT.CHECK);

You should be able to follow this code if you understand the concepts in Standard Widget Toolkit.

The basic patterns for implementing a page include:

The ReadmeCreationPage class inherits a lot of this behavior from the WizardNewFileCreationPage.  Browse the implementation of these classes for further information.

Now that we understand what a page does, let's look again at the wizard.


The wizard is responsible for creating the pages and providing the "finish" logic.

The basic patterns for implementing a wizard include:

The completed wizard looks like this:

Readme file creation wizard page