Action class, Actiongroup class, Menumanager class introduction
The menu in SWT is the mean class, and the use of the menu class has been described in the previous section.
Menu items are implemented using the Meauitem class. But in actual development, the same function will have a multi-medium representation,
For example: "New" feature in Eclipse, he will appear in main menu, main toolbar, right-click menu,
If you are using Meanuitem to achieve, you need to write three code, and then maintain three code. Of course you can handle the time
It is inconvenient to write external classes to share code, but names, images, and some other information are written as external classes to share.
The JFace package already provides a solution to the above problems, JFace provides an action class that will name,
Images, action handlers, and so on, so you can share these actions to form menu items, toolbar buttons, and so on.
Of course at the bottom of the end for the menu or MenuItem object, the action is converted to MenuItem is by the
Menumanager (menu manager) to complete. Menumanager simplifies the creation of menus, once a
The Menumanager object can be generalized to the menu bar, pop-up menu, and toolbar drop-down menu.
Other than that. An action written in one class can be messy. JFace also provides a Actiongroup class for unified management of action.
Then let the outside program access the action via Actiongroup. Of course, Actiongroup is not the class that is required to use action. Just use it to be better.
About the right-click menu in JFace Action class, Actgiongroup class, Menumanager class