Home

Awesome

SWT Preferences

This project provides a simple preferences dialog for SWT/JFace. Why yet another preferences dialog? Because it is very easy to use and it just works. For alternative implementations you may want to look at JFace's PreferenceDialog or Opal's PreferenceWindow.

Features

  1. Simple and easy to use API
  2. Editors for boolean, numeric, textual and set-valued properties
  3. Provides configurable validators
  4. Supports undo and default values
  5. Only writes back data that has actually been changed in the dialog
  6. Supports internationalization via a configuration object

Screenshot

Example

This basic example displays a dialog with one category containing two preferences:

// Create dialog
DialogPreference dialog = new DialogPreference(shell, "Settings", "Description");

// Create category
dialog.addCategory("category-1", icon1);

// Create integer preference
dialog.addPreference(new PreferenceInteger("setting-1", 0, 1000000) {
                     protected Integer getValue() { return model.getIntegerValue(); }
                     protected void setValue(Object t) { model.setIntegerValue((Integer)t); }});

// Create double preference        
dialog.addPreference(new PreferenceDouble("setting-2", 0d, 1d) {
                     protected Double getValue() { return model.getDoubleValue(); }
                     protected void setValue(Object t) { model.setDoubleValue((Double)t); }});

// Show
dialog.open();

Download

A binary version (JAR file) is available for download here.

The according Javadoc is available for download here.

Dependencies

SWT Preferences depends on SWT (obviously) and JFace. The versions used to build the binaries provided on this page can be found here.

Documentation

Online documentation can be found here.

SWT Preferences in action

Too see SWT Preferences in action, take a look at ARX.

License

EPL 1.0