1 package eu
.etaxonomy
.taxeditor
;
3 import org
.eclipse
.jface
.action
.Action
;
4 import org
.eclipse
.jface
.action
.GroupMarker
;
5 import org
.eclipse
.jface
.action
.IAction
;
6 import org
.eclipse
.jface
.action
.ICoolBarManager
;
7 import org
.eclipse
.jface
.action
.IMenuManager
;
8 import org
.eclipse
.jface
.action
.IToolBarManager
;
9 import org
.eclipse
.jface
.action
.MenuManager
;
10 import org
.eclipse
.jface
.action
.Separator
;
11 import org
.eclipse
.jface
.action
.ToolBarContributionItem
;
12 import org
.eclipse
.jface
.action
.ToolBarManager
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.ui
.IWorkbenchActionConstants
;
15 import org
.eclipse
.ui
.IWorkbenchWindow
;
16 import org
.eclipse
.ui
.actions
.ActionFactory
;
17 import org
.eclipse
.ui
.actions
.ActionFactory
.IWorkbenchAction
;
18 import org
.eclipse
.ui
.application
.ActionBarAdvisor
;
19 import org
.eclipse
.ui
.application
.IActionBarConfigurer
;
22 * An action bar advisor is responsible for creating, adding, and disposing of the
23 * actions added to a workbench window. Each window will be populated with
26 public class ApplicationActionBarAdvisor
extends ActionBarAdvisor
{
28 // Actions - important to allocate these only in makeActions, and then use them
29 // in the fill methods. This ensures that the actions aren't recreated
30 // when fillActionBars is called with FILL_PROXY.
31 private IWorkbenchAction exitAction
;
32 private IWorkbenchAction aboutAction
;
33 private IWorkbenchAction newWindowAction
;
34 private OpenViewAction openViewAction
;
35 private Action messagePopupAction
;
38 public ApplicationActionBarAdvisor(IActionBarConfigurer configurer
) {
42 protected void makeActions(final IWorkbenchWindow window
) {
43 // Creates the actions and registers them.
44 // Registering is needed to ensure that key bindings work.
45 // The corresponding commands keybindings are defined in the plugin.xml file.
46 // Registering also provides automatic disposal of the actions when
47 // the window is closed.
49 exitAction
= ActionFactory
.QUIT
.create(window
);
52 aboutAction
= ActionFactory
.ABOUT
.create(window
);
53 register(aboutAction
);
55 newWindowAction
= ActionFactory
.OPEN_NEW_WINDOW
.create(window
);
56 register(newWindowAction
);
59 openViewAction
= new OpenViewAction(window
, "Open Another Message View", View
.ID
);
60 register(openViewAction
);
62 /*IAction newMasterDetailEditorAction = new IAction(window, "Testy Poo", "eu.etaxonomy.taxeditor.simple");
63 register(newMasterDetailEditorAction);*/
65 messagePopupAction
= new MessagePopupAction("Open Message", window
);
66 register(messagePopupAction
);
69 protected void fillMenuBar(IMenuManager menuBar
) {
70 MenuManager fileMenu
= new MenuManager("&File", IWorkbenchActionConstants
.M_FILE
);
71 MenuManager helpMenu
= new MenuManager("&Help", IWorkbenchActionConstants
.M_HELP
);
73 MenuManager testMenu
= new MenuManager("&Names Demo", IWorkbenchActionConstants
.M_HELP
);
75 menuBar
.add(fileMenu
);
76 // Add a group marker indicating where action set menus will appear.
77 menuBar
.add(new GroupMarker(IWorkbenchActionConstants
.MB_ADDITIONS
));
78 menuBar
.add(helpMenu
);
79 //menuBar.add(testMenu);
82 // fileMenu.add(newWindowAction);
83 // fileMenu.add(new Separator());
84 // fileMenu.add(messagePopupAction);
85 // fileMenu.add(openViewAction);
86 // //testMenu.add(openViewAction);
87 // fileMenu.add(new Separator());
88 fileMenu
.add(exitAction
);
91 helpMenu
.add(aboutAction
);
94 protected void fillCoolBar(ICoolBarManager coolBar
) {
95 IToolBarManager toolbar
= new ToolBarManager(SWT
.FLAT
| SWT
.RIGHT
);
96 coolBar
.add(new ToolBarContributionItem(toolbar
, "main"));
97 //toolbar.add(openViewAction);
98 toolbar
.add(messagePopupAction
);