13.1. Creating a Plug-in That Supports Wizards and Editors

Problem

You want to create a plug-in that uses a wizard to create files and an editor to edit them.

Solution

Use a PDE Wizard template. Create a new plug-in project, select the “Plug-in with a multi-page editor” template, and follow the onscreen directions to create a skeletal template, ready to be customized.

Discussion

In this example, we’re going to create a plug-in that Eclipse will associate with the file extension .new. The plug-in’s wizard will enable the user to create files with this extension, and when the user double-clicks those files, they’ll appear in the plug-in’s editor.

The PDE can help us out here by creating a template for our plug-in. Select New Project. In the New Project dialog, select Plug-in Development in the left box and Plug-in Project in the right box, and click Next. Specify the name of the project as org.cookbook.ch13.EditorPlugIn in the following dialog, as shown in Figure 13-1.

Naming the plug-in

Figure 13-1. Naming the plug-in

Click Next once again to bring up the Plug-in Code Generators dialog shown in Figure 13-2. Select the “Plug-in with a multi-page editor” template, as shown in the figure, and click Next.

Creating a plug-in with a multipage editor

Figure 13-2. Creating a plug-in with a multipage editor

In the next dialog, give the provider name as Eclipse ...

Get Eclipse Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.