]> git.argeo.org Git - lgpl/argeo-commons.git/blob - security/eclipse/plugins/org.argeo.security.ui.rcp/src/main/java/org/argeo/security/ui/rcp/SecureActionBarAdvisor.java
Adapt Security to RCP
[lgpl/argeo-commons.git] / security / eclipse / plugins / org.argeo.security.ui.rcp / src / main / java / org / argeo / security / ui / rcp / SecureActionBarAdvisor.java
1 package org.argeo.security.ui.rcp;
2
3 import org.eclipse.jface.action.GroupMarker;
4 import org.eclipse.jface.action.IMenuManager;
5 import org.eclipse.jface.action.MenuManager;
6 import org.eclipse.jface.action.Separator;
7 import org.eclipse.ui.IWorkbenchActionConstants;
8 import org.eclipse.ui.IWorkbenchWindow;
9 import org.eclipse.ui.actions.ActionFactory;
10 import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
11 import org.eclipse.ui.application.ActionBarAdvisor;
12 import org.eclipse.ui.application.IActionBarConfigurer;
13
14 public class SecureActionBarAdvisor extends ActionBarAdvisor {
15 private IWorkbenchAction exitAction;
16 // private IWorkbenchAction aboutAction;
17 private IWorkbenchAction newWindowAction;
18 private IWorkbenchAction preferences = null;
19
20 public SecureActionBarAdvisor(IActionBarConfigurer configurer) {
21 super(configurer);
22 }
23
24 protected void makeActions(IWorkbenchWindow window) {
25 preferences = ActionFactory.PREFERENCES.create(window);
26 register(preferences);
27 exitAction = ActionFactory.QUIT.create(window);
28 register(exitAction);
29
30 // aboutAction = ActionFactory.ABOUT.create(window);
31 // register(aboutAction);
32
33 newWindowAction = ActionFactory.OPEN_NEW_WINDOW.create(window);
34 register(newWindowAction);
35 }
36
37 protected void fillMenuBar(IMenuManager menuBar) {
38 MenuManager fileMenu = new MenuManager("&File",
39 IWorkbenchActionConstants.M_FILE);
40 MenuManager editMenu = new MenuManager("&Edit",
41 IWorkbenchActionConstants.M_EDIT);
42 MenuManager helpMenu = new MenuManager("&Help",
43 IWorkbenchActionConstants.M_HELP);
44
45 menuBar.add(fileMenu);
46 menuBar.add(editMenu);
47 // Add a group marker indicating where action set menus will appear.
48 menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
49 menuBar.add(helpMenu);
50
51 // File
52 fileMenu.add(newWindowAction);
53 fileMenu.add(new Separator());
54 fileMenu.add(exitAction);
55
56 // Edit
57 editMenu.add(preferences);
58
59 // Help
60 // helpMenu.add(aboutAction);
61 }
62
63 }