p2izing the editor
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor.designproposal2 / src / eu / etaxonomy / taxeditor / designproposal2 / ApplicationActionBarAdvisor.java
1 package eu.etaxonomy.taxeditor.designproposal2;
2
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;
11
12 import eu.etaxonomy.taxeditor.designproposal2.controller.OpenNameEditorAction;
13
14 /**
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
17 * new actions.
18 */
19 public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
20
21 // Actions - important to allocate these only in makeActions, and then use
22 // them
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 OpenNameEditorAction newNameAction;
27
28 public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
29 super(configurer);
30 }
31
32 protected void makeActions(final IWorkbenchWindow window) {
33 // Creates the actions and registers them.
34 // Registering is needed to ensure that key bindings work.
35 // The corresponding commands keybindings are defined in the plugin.xml
36 // file.
37 // Registering also provides automatic disposal of the actions when
38 // the window is closed.
39
40 exitAction = ActionFactory.QUIT.create(window);
41 register(exitAction);
42
43 newNameAction = new OpenNameEditorAction();
44 register(newNameAction);
45 }
46
47 protected void fillMenuBar(IMenuManager menuBar) {
48 MenuManager fileMenu = new MenuManager("&File",
49 IWorkbenchActionConstants.M_FILE);
50 menuBar.add(fileMenu);
51 fileMenu.add(newNameAction);
52 fileMenu.add(exitAction);
53 }
54
55 }