Go to the documentation of this file.00001 package com.generalrobotix.ui.grxui;
00002
00003 import org.eclipse.jface.action.IContributionItem;
00004 import org.eclipse.jface.action.IMenuManager;
00005 import org.eclipse.jface.action.MenuManager;
00006 import org.eclipse.ui.IWorkbenchActionConstants;
00007 import org.eclipse.ui.IWorkbenchWindow;
00008 import org.eclipse.ui.actions.ActionFactory;
00009 import org.eclipse.ui.actions.ContributionItemFactory;
00010 import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
00011 import org.eclipse.ui.application.ActionBarAdvisor;
00012 import org.eclipse.ui.application.IActionBarConfigurer;
00013
00014 import com.generalrobotix.ui.util.MessageBundle;
00015
00016
00017 public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
00018 private IWorkbenchAction exitAction;
00019 private IContributionItem showViewItem;
00020 private IWorkbenchAction preferencesAction;
00021 private IWorkbenchAction resetAction;
00022
00023 public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
00024 super(configurer);
00025 }
00026
00027 protected void makeActions(final IWorkbenchWindow window) {
00028 exitAction = ActionFactory.QUIT.create(window);
00029 register(exitAction);
00030 showViewItem = ContributionItemFactory.VIEWS_SHORTLIST.create(window);
00031 preferencesAction = ActionFactory.PREFERENCES.create(window);
00032 register(preferencesAction);
00033 resetAction = ActionFactory.RESET_PERSPECTIVE.create(window);
00034 register(resetAction);
00035 }
00036
00037 protected void fillMenuBar(IMenuManager menuBar) {
00038 MenuManager fileMenu = new MenuManager(MessageBundle.get("ApplicationActionBarAdvisor.menu.file"),
00039 IWorkbenchActionConstants.M_FILE);
00040 menuBar.add(fileMenu);
00041 fileMenu.add(exitAction);
00042 MenuManager windowMenu = new MenuManager(MessageBundle.get("ApplicationActionBarAdvisor.menu.window"),
00043 IWorkbenchActionConstants.M_WINDOW);
00044
00045 menuBar.add(windowMenu);
00046 MenuManager showViewMenu = new MenuManager(MessageBundle.get("ApplicationActionBarAdvisor.menu.view"));
00047 showViewMenu.add(showViewItem);
00048 windowMenu.add(showViewMenu);
00049 windowMenu.add(preferencesAction);
00050 windowMenu.add(resetAction);
00051
00052 }
00053
00054 }