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 gothe 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 Run 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 Figure 11-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 Run Run As Run-time Workbench.) Figure 11-8. Setting a launch configuration for the Run-time Workbench This starts the Run-time Workbench, but we're not done yet. To see the results of this plug-in, select Window Customize Perspective 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 Figure 11-9. Figure 11-9. The Run-time Workbench When you select the Sample Menu 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 Figure 11-10. Figure 11-10. The plug-in's message box Congratulationsyou've created a working Eclipse plug-in that's running. To end the example, close the 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 . |