Eclipse icon

Direct Wizard Invocation

Wizards can be created and directly opened by your programming logic.

Running the Solution

To run the example, launch the run-time instance of Eclipse (Run > Run As > Run-time Workbench).

  1. Select any project or folder in the Navigator or Package Explorer view, and use then select its Soln: Dialogs > Soln: Launch Project Structure Wizard context menu choice to open the Project Structure Wizard. The action implemented by the MyWizardAction class creates a wizard dialog and uses it to open the required wizard.
  2. You can use the wizard to add as many folders or files as you want.

Roadmap to the Solution

This is a straightforward solution. The action is implemented as a standard object contribution that is available from a project, folder, or any other object that adapts to IContainer. The action definition can be found in the plugin.xml.

The action is implemented by the MyWizardAction class. The run() method logic wraps the StructureWizard in a WizardDialog, as shown in this code snippet:

StructureWizard wizard = new StructureWizard();
wizard.init(getWorkbench(), mySelection);
WizardDialog dialog =
new WizardDialog(
getWorkbench().getActiveWorkbenchWindow().getShell(),
wizard);
dialog.open();

© Copyright International Business Machines Corporation, 2003.
All rights reserved.