plug-in provides action and model classes that simplify programming with SWTEX by enabling you to manage contributions to the user interface.
plug-in provides a collection of JFace style action and contribution classes that enable clients to implement shared behaviors between two or more widgets components such as toolbars and menu bars. The API for these action and contribution classes are similar if not compatible with the standard Eclipse action classes. The contribution API lends itself well to implementing extension point-driven user interface components.
action classes are provided in the com.ibm.rcp.jfaceex
plug-in, which has dependencies on the org.eclipse.jface plug-in.
To manage contributions using JFace actions, perform the following steps:
- Create the action manager classes used to manage contributions to things like toolbars and menu bars using one of the following constructors:
Use a JFaceEX action to add the same action object to a toolbar and a menu bar. The action is rendered as a tool item in a toolbar and a menu item in a menu bar.
- A constructor that allows you to pass the toolbar or menu bar that may have been created externally.
// create a toolbar manager with a toolbar created externally
SToolBar toolbar = new SToolBar(parent, SWT.NONE);
SToolBarManager toolbarManager = new SToolBarManager(toolbar);
- A constructor that takes no parameters or just a style parameter and the toolbar or menu bar is later created internally.
// create a toolbar manager with a toolbar created internally
SToolBarManager toolbarManager = new SToolBarManager(SWT.NONE);
SToolBar toolbar = toolbarManager.createControl(parent);
When it is not longer needed, dispose of the JFaceEx action manager.
Action exitAction = new ExitAction();
The dispose method disposes of the toolbar or menu bar that it manages so clients must remember not to reference those objects after the manager has been disposed.
// dispose of the toolbar manager when it is no longer needed
Parent topic: Extending the capabilities of your application: XPD621