13.4. Creating a Plug-in That Supports Views

Problem

You need your plug-in to support a view.

Solution

Use the PDE template “Plug-in with a view.”

Discussion

This next example will build a plug-in that supports a view—in this case, a clickable tree of items. To follow along, create a new plug-in project named org.cookbook.ch13.ViewPlugIn. In the Plug-in Code Generators dialog, shown in Figure 13-9, select “Plug-in with a view” and click Next.

Configuring a plug-in with a view

Figure 13-9. Configuring a plug-in with a view

In the next dialog, set the provider name to Eclipse Cookbook, as shown in Figure 13-10.

Setting the provider name

Figure 13-10. Setting the provider name

Clicking Next brings up the Main View Settings dialog shown in Figure 13-11. Here’s where you customize the view, setting its name, as well as a whether it should be a tree-based view or a table-based view. Name the view Item View, and make it a tree-based view, as shown in the figure. Click Next again to bring up the final dialog of this wizard.

Setting view options

Figure 13-11. Setting view options

In the last dialog, you configure the view’s actions. Leave the defaults selected, and click Finish to create the template for this plug-in (see Figure 13-12).

Figure 13-12. Configuring the view’s actions

After ...

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.