Operation history implemented for ChangeCompositeToMisappliedName.
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor / src / eu / etaxonomy / taxeditor / ApplicationActionBarAdvisor.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
8 */
9
10 package eu.etaxonomy.taxeditor;
11
12 import org.apache.log4j.Logger;
13 import org.eclipse.jface.action.IMenuManager;
14 import org.eclipse.jface.action.MenuManager;
15 import org.eclipse.ui.IWorkbenchActionConstants;
16 import org.eclipse.ui.IWorkbenchWindow;
17 import org.eclipse.ui.actions.ActionFactory;
18 import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
19 import org.eclipse.ui.application.ActionBarAdvisor;
20 import org.eclipse.ui.application.IActionBarConfigurer;
21
22 import eu.etaxonomy.taxeditor.actions.ActionOpenNameEditor;
23
24 /**
25 * An action bar advisor is responsible for creating, adding, and disposing of
26 * the actions added to a workbench window. Each window will be populated with
27 * new actions.
28 *
29 * @author p.ciardelli
30 * @created 02.06.2008
31 * @version 1.0
32 */
33 public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
34 private static final Logger logger = Logger
35 .getLogger(ApplicationActionBarAdvisor.class);
36
37 // Actions - important to allocate these only in makeActions, and then use
38 // them
39 // in the fill methods. This ensures that the actions aren't recreated
40 // when fillActionBars is called with FILL_PROXY.
41 private IWorkbenchAction exitAction;
42 private ActionOpenNameEditor newNameAction;
43 private IWorkbenchAction saveAction;
44 private IWorkbenchAction preferencesAction;
45 private IWorkbenchAction undoAction;
46
47 public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
48 super(configurer);
49 }
50
51 protected void makeActions(final IWorkbenchWindow window) {
52 // Creates the actions and registers them.
53 // Registering is needed to ensure that key bindings work.
54 // The corresponding commands keybindings are defined in the plugin.xml
55 // file.
56 // Registering also provides automatic disposal of the actions when
57 // the window is closed.
58
59 saveAction = ActionFactory.SAVE.create(window);
60 register(saveAction);
61
62 undoAction = ActionFactory.UNDO.create(window);
63 // undoAction.setEnabled(true);
64 register(undoAction);
65
66 exitAction = ActionFactory.QUIT.create(window);
67 register(exitAction);
68
69 newNameAction = new ActionOpenNameEditor();
70 register(newNameAction);
71
72 preferencesAction = ActionFactory.PREFERENCES.create(window);
73 }
74
75 protected void fillMenuBar(IMenuManager menuBar) {
76 MenuManager fileMenu = new MenuManager("&File",
77 IWorkbenchActionConstants.M_FILE);
78 menuBar.add(fileMenu);
79 fileMenu.add(newNameAction);
80 fileMenu.add(saveAction);
81 fileMenu.add(undoAction);
82 fileMenu.add(exitAction);
83
84 MenuManager preferencesMenu = new MenuManager("&Preferences",
85 null);
86 menuBar.add(preferencesMenu);
87 preferencesMenu.add(preferencesAction);
88 }
89
90 }