Wizard dialogs

The previous example supplied a wizard for a specified extension point. Another, perhaps more common, case is that you want to launch your own plug-in's wizard from some action that you have defined. (In Workbench menu contributions, we discuss the ways you can contribute actions to the workbench.)

Wizards are displayed in the UI by placing them in a containing dialog.  This detail is handled for you when you contribute to a wizard extension.  When you are launching your own wizard, you must display it yourself by wrapping it in a WizardDialog.

For example, the ReadmeCreationWizard could be launched independently by creating a wizard dialog and associating it with the ReadmeCreationWizard. The following code snippet shows how this could be done from some action delegate. (The method assumes that we know the workbench and the selection.)

   public void run(IAction action) {
      // Create the wizard
      ReadmeCreationWizard wizard = new ReadmeCreationWizard();
      wizard.init(getWorkbench(), selection);

      // Create the wizard dialog
      WizardDialog dialog = new WizardDialog
      // Open the wizard dialog

If you need to embed a wizard anywhere else in your plug-in's user interface, the interface IWizardContainer defines the necessary protocol for hosting a wizard.