1 package eu
.etaxonomy
.taxeditor
;
3 import org
.eclipse
.jface
.action
.IMenuManager
;
4 import org
.eclipse
.jface
.action
.MenuManager
;
5 import org
.eclipse
.ui
.IWorkbenchActionConstants
;
6 import org
.eclipse
.ui
.IWorkbenchWindow
;
7 import org
.eclipse
.ui
.actions
.ActionFactory
;
8 import org
.eclipse
.ui
.actions
.ActionFactory
.IWorkbenchAction
;
9 import org
.eclipse
.ui
.application
.ActionBarAdvisor
;
10 import org
.eclipse
.ui
.application
.IActionBarConfigurer
;
12 import eu
.etaxonomy
.taxeditor
.controller
.ActionOpenNameEditor
;
15 * An action bar advisor is responsible for creating, adding, and disposing of
16 * the actions added to a workbench window. Each window will be populated with
19 public class ApplicationActionBarAdvisor
extends ActionBarAdvisor
{
21 // Actions - important to allocate these only in makeActions, and then use
23 // in the fill methods. This ensures that the actions aren't recreated
24 // when fillActionBars is called with FILL_PROXY.
25 private IWorkbenchAction exitAction
;
26 private ActionOpenNameEditor newNameAction
;
27 private IWorkbenchAction saveAction
;
29 public ApplicationActionBarAdvisor(IActionBarConfigurer configurer
) {
33 protected void makeActions(final IWorkbenchWindow window
) {
34 // Creates the actions and registers them.
35 // Registering is needed to ensure that key bindings work.
36 // The corresponding commands keybindings are defined in the plugin.xml
38 // Registering also provides automatic disposal of the actions when
39 // the window is closed.
41 saveAction
= ActionFactory
.SAVE
.create(window
);
43 exitAction
= ActionFactory
.QUIT
.create(window
);
46 newNameAction
= new ActionOpenNameEditor();
47 register(newNameAction
);
50 protected void fillMenuBar(IMenuManager menuBar
) {
51 MenuManager fileMenu
= new MenuManager("&File",
52 IWorkbenchActionConstants
.M_FILE
);
53 menuBar
.add(fileMenu
);
54 fileMenu
.add(newNameAction
);
55 fileMenu
.add(saveAction
);
56 fileMenu
.add(exitAction
);