From: <tea...@us...> - 2007-05-14 13:18:43
|
Revision: 397 http://svn.sourceforge.net/cishell/?rev=397&view=rev Author: teakettle22 Date: 2007-05-14 06:18:33 -0700 (Mon, 14 May 2007) Log Message: ----------- The modified code for menu construction. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java Modified: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2007-05-10 20:23:36 UTC (rev 396) +++ trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2007-05-14 13:18:33 UTC (rev 397) @@ -1,7 +1,11 @@ package org.cishell.reference.gui.workspace; +import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; @@ -13,7 +17,7 @@ * the actions added to a workbench window. Each window will be populated with * new actions. */ -public class ApplicationActionBarAdvisor extends ActionBarAdvisor { +public class ApplicationActionBarAdvisor extends ActionBarAdvisor{ // Actions - important to allocate these only in makeActions, and then use // them in the fill methods. This ensures that the actions aren't recreated @@ -41,7 +45,42 @@ protected void fillMenuBar(IMenuManager menuBar) { CIShellApplication.setMenuManager(menuBar); - + /* + * If we don't create the File and the Help menus at initialization, they don't show up correctly. I create the file and the help + * menus and add them. Later the default_menu.xml file is parse and the additional menus are added in between + * the File and the Help menus. + * + * The File menu is created normally, as we modify it again in the MenuAdapter code. The Help menu is created as having + * three divisions, start, additions, and end. The File menu later adds these divisions so that additional packages will be added + * between the Test submenu and the Exit item. The Help menu adds additional packages before the configuration and update items. + * + * Modified by: Tim Kelley + * Date: May, 8-9, 2007 + * Additional Code found in: org.cishell.reference.gui.menumanager.MenuAdapter.java + */ + + + + MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); //Create File menu as a normal Menu + menuBar.add(fileMenu); //add it to the MenuBar + MenuManager helpMenu = createMenu("&Help", IWorkbenchActionConstants.M_HELP); //Create the Help Menu with start, end, and additions as divisions + helpMenu.add(new Separator()); //Add a separator and then add the "About" MenuItem. + helpMenu.appendToGroup("end",aboutAction); + menuBar.add(new GroupMarker("start")); //Add divisions to the MenuBar so we can add + //additional menus to the MenuBar between File and Help menus //the File and Help menus. + menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + menuBar.add(new GroupMarker("end")); + + menuBar.add(helpMenu); //Add the Help menu after the divisions. } + + private MenuManager createMenu(String text, String id) { + MenuManager menu = new MenuManager(text, id); + menu.add(new GroupMarker("start")); + menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + menu.add(new GroupMarker("end")); + //System.out.println(IWorkbenchActionConstants.MB_ADDITIONS); + return menu; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |