2.8 UI Workbench
Just as JFace adds structure to SWT, the Workbench adds presentation and coordination to JFace. To the user, the Workbench consists of some views and editors arranged in a particular layout. In particular, the Workbench
- Provides contribution-based UI extensibility
- Defines a powerful UI paradigm with windows, perspectives, views, editors, and actions
2.8.1 Contribution-Based Extensibility
Whereas JFace introduces actions, preferences, wizards, windows, and so on, the Workbench provides extension points that allow plug-ins to define such UI elements declaratively. For example, the wizard and preference page extension points are just thin veneers over the related JFace constructs.
More than this, however, the use of extensions to build a UI has a fundamental impact on the scalability of the UI in terms of both complexity and performance. Declarative extensions enable the description and manipulation of sets of contributions such as the action sets we discussed earlier. For example, the Workbench's capabilities mechanism supports progressive disclosure of functionality by filtering actions until their defining action sets are triggered. Your application may have a huge number of actions, but users see only the ones in which they are interested—the UI grows with users' needs.
Since all of these extensions are handled lazily, applications also scale better. As your UI gets richer, it includes more views, editors, and actions. Without declarative extensibility, such growth requires additional loading and execution of code. This increases code bulk and startup time, and the application does not scale. With extensions, no code is loaded before its time.
2.8.2 Perspectives, Views, and Editors
The Workbench appears to the user as a collection of windows. Within each window the Workbench allows users to organize their work in much the same way as you would organize your desk—you put similar documents in folders and stack them in piles on a desk. A perspective is a visual container for a set of views and content editors—everything shown to the user is in a view or an editor and is laid out by a perspective.
Users organize content in perspectives in the following ways:
- Stack editors with other editors.
- Stack views with other views.
- Detach views from the main Workbench window.
- Resize views and editors and minimize/maximize editor and view stacks.
- Create fast views that are docked on the side of the window.
A perspective supports a particular set of tasks by providing a restricted set of views and supporting action sets as well as shortcuts to relevant content creation wizards, other related views, and other related perspectives. Users can switch between perspectives, for example, to change between developing code, trading stocks, working on documents, and instant messaging. Each of these tasks may have unique layouts and content.