The JFace UI framework

We've seen that the workbench defines extension points for plug-ins to contribute UI functionality to the platform. Many of these extension points, particularly wizard extensions, are implemented using classes in the org.eclipse.jface.* packages. What's the distinction?

JFace is a UI toolkit that provides helper classes for developing UI features that can be tedious to implement. JFace operates above the level of a raw widget system. It includes classes for handling common UI programming tasks:

JFace frees you up to focus on the implementation of your specific plug-in's function, rather than focusing on the underlying widget system or solving problems that are common in almost any UI application.

JFace and the workbench

Where does JFace end and the workbench begin? Sometimes the lines aren't so obvious. In general, the JFace APIs (from the packages org.eclipse.jface.*) are independent of the workbench extension points and APIs. Conceivably, a JFace program could be written without using any workbench code at all.

The workbench makes use of JFace but attempts to reduce dependencies where possible. For example, the workbench part model (IWorkbenchPart) is designed to be independent of JFace. We saw earlier that views and editors can be implemented using SWT widgets directly without using any JFace classes. The workbench attempts to remain "JFace neutral" wherever possible, allowing programmers to use the parts of JFace they find useful. In practice, the workbench uses JFace for much of its implementation and there are references to JFace types in API definitions. (For example, the JFace interfaces for IMenuManager, IToolBarManager, and IStatusLineManager show up as types in the workbench IActionBar methods.)

When using JFace API, it's a good idea to keep in mind the rules of engagement for using background threads. See The workbench and threads for more information.

JFace and SWT

The lines between SWT and JFace are much cleaner. SWT does not depend on any JFace or platform code at all. Many of the SWT examples show how you can build a standalone application.

JFace is designed to provide common application UI functionality on top of the SWT library. JFace does not try to "hide" SWT or replace its function. It provides classes and interfaces that handle many of the common tasks associated with programming a dynamic UI using SWT.

The relationship between JFace and SWT is most clearly demonstrated by looking at viewers and their relationship to SWT widgets.