Eclipse icon

The Dialogs and Wizards lecture discussed implementation of dialogs as Eclipse extensions, and as components directly opened by your tool logic. The code in this project demonstrates the implementation of these tool extensions:

Preference Pages
The plug-in contributes two preferences pages. The user interface for the first page is constructed using SWT widgets and values are stored using the Preferences class for preference value management. The second page is implemented using the FieldEditorPreferencePage and FieldEditor framework.

The example includes a property change listener that reports when preference changes occur.

Properties Pages
The plug-in contains a properties page that is contributed to any IFile resource type. The page supports the creating and manipulation of two keyed property values that are stored for the selected resource.

Resource Creation Wizards
The plug-in contributes two resource creation wizards. The first is a simple file creation wizard that adds a file with custom content to the selected container.

The second is a more complex resource creation wizard that dynamically adds pages based on the user input. Each page added can support the creation of a file or folder, allowing one wizard invocation to create any number of files and folders in the project.

Note: Extensions can also be used to define Import and Export wizards. See the Eclipse code base for classes that implement IImportWizard or IExportWizard for examples

Direct Wizard Invocation
Not all wizards will be implemented by extension, you may need wizards to support other guided tasks in your tool. An example of direct wizard invocation as part of an action contribution is also included to demonstrate how you can open up a wizard as part of your tool logic. This action opens one of the previously discussed resource creation wizards.

All code is in the com.ibm.lab.soln.dialogs package.

Project Structure

The plug-in defines actions, wizards, preference pages, and properties pages. These definitions can be reviewed in the plugin.xml file:


One package is used to organize the code included in this project.

The IDialogsIDs class defines common strings and global control fields used in many of the other classes:

A global trace setting exists in IDialogsIDs; if TRACE_ENABLED is set to true, trace messages are written regardless of the local traceEnabled value.

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