Using the Run-time Workbench

At this point, you could create Ch11_01.jar, and install that JAR file, plugin.xml, and so on in the plugins directory and you'd be ready to go—the new plug-in would support a menu item and a toolbar button. But for testing purposes, Eclipse offers a shortcut: the Run-time Workbench. This is a workbench that you can launch from Eclipse and use to test plug-ins. To run the Run-time Workbench, select the plug-in project in the Package Explorer, select RunScreenshot Run, open the Run-time Workbench node in the left box, and select the Run-time Workbench item under that node, as you can see in Screenshot-8. Then select the JRE you want to use when working with the Run-time Workbench (you don't need to do this step if you have an installed JRE you've named JRE2, which is what the Run-time Workbench seaches for by default). Then click Run. (The next time, you can simply select RunScreenshot Run AsScreenshot Run-time Workbench.)

Screenshot-8. Setting a launch configuration for the Run-time Workbench
Java figs/ecps_1108.gif

This starts the Run-time Workbench, but we're not done yet. To see the results of this plug-in, select WindowScreenshot Customize PerspectiveScreenshot Other and select the checkbox for the Sample Action Set item, which is defined by our plug-in, and click OK. This adds the menu defined by the new plug-in, Sample Menu, to the menu bar and a button with the Eclipse icon to the toolbar just under that menu, as you can see in the Run-time Workbench in Screenshot-9.

Screenshot-9. The Run-time Workbench
Java figs/ecps_1109.gif

When you select the Sample MenuScreenshot Sample Action item or click the New button, the plug-in displays a message box with the message "Hello, Eclipse World", as you see in Screenshot-10.

Screenshot-10. The plug-in's message box
Java figs/ecps_1110.gif

Congratulations—you've created a working Eclipse plug-in that's running. To end the example, close the Run-time Workbench.

Screenshot

You can debug your code as you would any other. Just select RunScreenshot Debug AsScreenshot Run-time Workbench.


In this case, the PDE wizards created the needed code for this sample plug-in. In the next example, we're going to build the code ourselves.

      
Comments