Applications, Workbenches, and Workbench Windows

The Application is a class you create that acts as your RCP program's main routine. You can think of it as the controller for the program. Just like the controller in a Model2 architecture, it is short and sweet and doesn't change significantly for different projects. All it does is create a Workbench and attach another class called a Workbench Advisor to it.

The Workbench is declared and maintained for you as part of the RCP framework. There is only one Workbench but it can have more than one visible top-level Workbench Window. For example, in the Eclipse IDE, when you first start Eclipse you will see one Workbench Window, but if you select Window > New Window a second window pops up -- two Workbench Windows, but only one Workbench.

Workbench Advisor

Methods in this class are called from the platform to notify you at every point in the lifecycle of the Workbench. They also provide a way to handle exceptions in the event loop, and provide important parameters to the Workbench such as the default perspective. With the exception of createWorkbenchWindowAdvisor() and getInitialWindowPerspectiveId(), the methods on WorkbenchAdvisor do not have to be overridden.

Workbench Window Advisor

This class is used to control the status line, toolbar, title, window size, and other things you'll almost certainly want to customize. You can also use it to hook into all the various lifecycle events of the Workbench Windows.

Methods on WorkbenchWindowAdvisor will all need access to a Configurer interface (in this case, IWorkbenchWindowConfigurer) in order to do anything so they're expected to call getWindowConfigurer() to fetch it. You call methods on the Configurer interfaces to actually change the options.

ActionBar Advisor

In Eclipse jargon, "action bar" is a catch-all term for menus, toolbars, and status bars. The ActionBar Advisor handles creating Actions within these locations.A plug-in can also contribute actions dynamically with its plugin.xml file.

 

A fixed perspective makes all of the views it contains unclosable, plus it prevents any of them from being moved or resized. To make a perspective fixed, you could call the setFixed(true) method on the layout inside createInitialLayout(), or simply add the fixed="true" attribute to its definition in plugin.xml.

By using a fixed perspective and turning off the shortcut bar, you can lock the user into one perspective and hide the concept of perspectives from them altogether.