JFaceis a UI toolkit with classes for handling many common UI programming tasks. JFace is window-system-independent in both its API and implementation, and is designed to work with SWT without hiding it. JFace includes the usual UI toolkit components of image and font registries, text, dialog, preference and wizard frameworks, and progress reporting for long running operations. Two of its more interesting features are actions and viewers. The action mechanism allows user commands to be defined independently from their exact whereabouts in the UI. Viewers are model based adapters for certain SWT widgets, simplifying the presentation of application data structured as lists, tables or trees.
The JFace data binding framework was introduced in Eclipse 3.2. Data binding allows linking UI elements and models so that users can edit or view the data in the model. The framework makes it easy to connect data sources to widgets such as text fields, combos, tables and trees, for viewing and editing. Using it relieves developers from writing and registering listeners with widgets and model objects.
JFace can be used in standalone SWT+JFace apps, without requiring the Eclipse Runtime or other parts of the Eclipse Platform. This was made easier to do in 3.2, with the only prerequisites for JFace being reduced to SWT, the new org.eclipse.equinox.common plug-in, and org.eclipse.core.commands plug-in.
In 3.3 an optional dependency on the org.osgi.framework package was added which is defined in the org.eclipse.osgi. If this plug-in is absent JFace will continue to function but without the benefit of internationalization support for its images.
A JFace project requires the SWT classes, JFace classes, and other Eclipse classes that JFace is dependent on. The SWT classes will be provided in the file we download from the SWT Project Website. The JFace file, and the files the JFace is dependent upon, need to be added to the project manually.
The first step is to identify the required JAR files for JFace. The primary file is called org.eclipse.jface, followed by specific version information. In addition, this file requires classes from other Eclipse JAR files. For Eclipse version 3.3.1.1, the required JAR files for JFace are as follows (where is the specific version information):
The file org.eclipse.ui.workbench_.jar is not required to run the standard JFace classes. However, since it adds a number of very useful Dialogs (such as ListDialog, ListSelectionDialog, and others), it is included here as well.
Deploying a SWT / JFace application is similar to deploying any Java application that uses external JAR libraries, with one important difference. Starting with Eclipse version 3.3, the SWT JAR file (e.g., swt.jar in the org.eclipse.swt project referenced above), contains platform-specific executable files (e.g., *.DLL files for Windows, *.so files for Linux) as well as Java classes. For this reason, the SWT JAR file must be matched to the target runtime platform. If you want to target more than one platform (e.g., Windows and Linux), you will need a separate SWT JAR file for each target platform.
Eclipse JFace is a set of plug-ins based upon the user interface toolkit SWT.JFace provides classes and frameworks which simplify common SWT use cases.JFace does not hide the SWT API; therefore, SWT knowledge is still required.
JFace Data Bindingis a framework which connects properties ofobjects. It is typicallyused to synchronize fields of the userinterfacewith properties ofmodel objects and allows you to includevalidation and conversion inthissynchronization process.
SWT is based on the native widgets of the OS.Whenever an SWT widget is allocated, a corresponding OS specific widget is created.The Java garbage collector cannot automatically clean-up these OS-specific widget references.
Fortunately all widgets which are created based on a parent widget are automatically disposed when the parent Composite is disposed.If you develop Eclipse plug-ins, the Composite of a part is automatically disposed once the part is closed.Therefore, these SWT widgets are handled automatically in Eclipse plug-in projects.
This rule does not apply for colors, fonts and images, as these may be reused in other places.For this reason, they need to be explicitly disposed.JFace provides the ResourceManager and its derived classes for managing such resources automatically.
To create disabled images you can create an ImageDescriptor with the org.eclipse.jface.resource.ImageDescriptor.createWithFlags(ImageDescriptor, SWT.IMAGE_DISABLE).Afterwards use the LocalResourceManager to create the Image from this new descriptor.
The correct place to change the filter behavior is in the IContentProposalProvider#getProposals() method.The following code shows an implementation of IContentProposalsProvider that takes the caret position into consideration when applying the filter.
3a8082e126