|
If you have some Eclipse plug-in development experience, you may be asking yourself why we have not used any of the Workbench's extension points for defining actions. After all, Eclipse is all about declarative contributions. This is a common questionwhen should an RCP application use the declarative Workbench extension points as opposed to simply creating the actions programmatically as in Hyperbola?
The short answer is that within the context of a single small application, there is usually no need to use the extension point approach. In fact, an RCP application must minimally define a top-level menu structure using programmatic actions because without this, there would be no place to contribute actions declaratively.
However, there are advantages to using declarative actions. These are detailed later in the book but summarized here:
They allow lazy loading of plug-ins by being shown in the UI without loading their associated plug-in. In large applications with many plug-ins, this is very important. Declarative actions can be associated with perspectives and easily allow dynamic reconfiguration of top-level menus and toolbars based on the active perspective. They allow users to configure top-level menus and toolbars via the perspective customization dialog (refer to the ActionFactory.EDIT_ACTION_SETS class for more details). Declarative action contributions can easily be filtered out of the application using capabilities.
Refer to Chapter 17, "Actions," for examples on how to use declarative actions in Hyperbola. Programmatic actions are used for the remainder of the Hyperbola tutorial.
|