ApplicationActionBarAdvisor.java
Go to the documentation of this file.
1 package com.generalrobotix.ui.grxui;
2 
3 import org.eclipse.jface.action.IContributionItem;
4 import org.eclipse.jface.action.IMenuManager;
5 import org.eclipse.jface.action.MenuManager;
6 import org.eclipse.ui.IWorkbenchActionConstants;
7 import org.eclipse.ui.IWorkbenchWindow;
8 import org.eclipse.ui.actions.ActionFactory;
9 import org.eclipse.ui.actions.ContributionItemFactory;
10 import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
11 import org.eclipse.ui.application.ActionBarAdvisor;
12 import org.eclipse.ui.application.IActionBarConfigurer;
13 
15 
16 
17 public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
18  private IWorkbenchAction exitAction;
19  private IContributionItem showViewItem;
20  private IWorkbenchAction preferencesAction;
21  private IWorkbenchAction resetAction;
22 
23  public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
24  super(configurer);
25  }
26 
27  protected void makeActions(final IWorkbenchWindow window) {
28  exitAction = ActionFactory.QUIT.create(window);
29  register(exitAction);
30  showViewItem = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
31  preferencesAction = ActionFactory.PREFERENCES.create(window);
32  register(preferencesAction);
33  resetAction = ActionFactory.RESET_PERSPECTIVE.create(window);
34  register(resetAction);
35  }
36 
37  protected void fillMenuBar(IMenuManager menuBar) {
38  MenuManager fileMenu = new MenuManager(MessageBundle.get("ApplicationActionBarAdvisor.menu.file"), //$NON-NLS-1$
39  IWorkbenchActionConstants.M_FILE);
40  menuBar.add(fileMenu);
41  fileMenu.add(exitAction);
42  MenuManager windowMenu = new MenuManager(MessageBundle.get("ApplicationActionBarAdvisor.menu.window"), //$NON-NLS-1$
43  IWorkbenchActionConstants.M_WINDOW);
44 
45  menuBar.add(windowMenu);
46  MenuManager showViewMenu = new MenuManager(MessageBundle.get("ApplicationActionBarAdvisor.menu.view")); //$NON-NLS-1$
47  showViewMenu.add(showViewItem);
48  windowMenu.add(showViewMenu);
49  windowMenu.add(preferencesAction);
50  windowMenu.add(resetAction);
51 
52  }
53 
54 }
static final String get(String key)
org


openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Sat May 8 2021 02:42:36