[RCP][M7] Menus created in WorkbenchAdvisor's fillActionBars are not displayed anymore [message #197605] |
Thu, 19 February 2004 05:32  |
Eclipse User |
|
|
|
Hi NG,
I am just about porting a rcp app from M6 to M7 and have now noticed, that
the menus which are created by the method fillActionBars are not shown
anymore except the "File"-Menu... I have tried to use
IWorkbenchWindowConfigurer.setShowMenuBar(boolean), but that didn't change
anything...
Does anyone have an idea what's wrong there?
Here the code snippet for the menu creation:
/* (non-javadoc)
* @see
org.eclipse.ui.application.WorkbenchAdvisor#fillActionBars(o rg.eclipse.ui.IW
orkbenchWindow, org.eclipse.ui.application.IActionBarConfigurer, int)
*/
public void fillActionBars(IWorkbenchWindow window,
IActionBarConfigurer configurer, int flags)
{
super.fillActionBars(window, configurer, flags);
if ((flags & FILL_MENU_BAR) != 0)
{
fillMenuBar(window, configurer);
}
}
private void fillMenuBar(IWorkbenchWindow window,
IActionBarConfigurer configurer)
{
IMenuManager menuBar = configurer.getMenuManager();
menuBar.add(createFileMenu(window));
menuBar.add(createSearchMenu(window));
menuBar.add(createHelpMenu(window));
}
private MenuManager createFileMenu(IWorkbenchWindow window)
{
MenuManager menu = new MenuManager("File",
IWorkbenchActionConstants.M_FILE);
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(ActionFactory.QUIT.create(window));
menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
return menu;
}
private MenuManager createSearchMenu(IWorkbenchWindow window)
{
MenuManager menu = new MenuManager("Search", SEARCH_MENU);
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator(RADIS_MENU_ADDITIONS));
return menu;
}
private MenuManager createHelpMenu(IWorkbenchWindow window)
{
MenuManager menu = new MenuManager("Help",
IWorkbenchActionConstants.M_HELP);
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menu.add(new Separator(RADIS_MENU_ADDITIONS));
menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
return menu;
}
|
|
|
Re: [RCP][M7] Menus created in WorkbenchAdvisor's fillActionBars are not displayed anymore [message #197670 is a reply to message #197605] |
Thu, 19 February 2004 08:52   |
Eclipse User |
|
|
|
Ok, in between I found out that a menu is only displayed if you
programmatically add at least one action to it. Otherwise it is simply
ignored, even if you try to contribute actions to it using your plugin.xml.
Is there any flag or something that I haven't seen yet in any of these
configurers?
"Martin Klinke" <martin-klinke@gmx.de> schrieb im Newsbeitrag
news:c1232s$boo$1@eclipse.org...
> Hi NG,
>
> I am just about porting a rcp app from M6 to M7 and have now noticed, that
> the menus which are created by the method fillActionBars are not shown
> anymore except the "File"-Menu... I have tried to use
> IWorkbenchWindowConfigurer.setShowMenuBar(boolean), but that didn't change
> anything...
>
> Does anyone have an idea what's wrong there?
>
> Here the code snippet for the menu creation:
>
> /* (non-javadoc)
> * @see
>
org.eclipse.ui.application.WorkbenchAdvisor#fillActionBars(o rg.eclipse.ui.IW
> orkbenchWindow, org.eclipse.ui.application.IActionBarConfigurer, int)
> */
> public void fillActionBars(IWorkbenchWindow window,
> IActionBarConfigurer configurer, int flags)
> {
> super.fillActionBars(window, configurer, flags);
> if ((flags & FILL_MENU_BAR) != 0)
> {
> fillMenuBar(window, configurer);
> }
> }
>
> private void fillMenuBar(IWorkbenchWindow window,
> IActionBarConfigurer configurer)
> {
> IMenuManager menuBar = configurer.getMenuManager();
> menuBar.add(createFileMenu(window));
> menuBar.add(createSearchMenu(window));
> menuBar.add(createHelpMenu(window));
> }
>
> private MenuManager createFileMenu(IWorkbenchWindow window)
> {
> MenuManager menu = new MenuManager("File",
> IWorkbenchActionConstants.M_FILE);
> menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
> menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
> menu.add(ActionFactory.QUIT.create(window));
> menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
> return menu;
> }
>
> private MenuManager createSearchMenu(IWorkbenchWindow window)
> {
> MenuManager menu = new MenuManager("Search", SEARCH_MENU);
> menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
> menu.add(new Separator(RADIS_MENU_ADDITIONS));
> return menu;
> }
> private MenuManager createHelpMenu(IWorkbenchWindow window)
> {
> MenuManager menu = new MenuManager("Help",
> IWorkbenchActionConstants.M_HELP);
> menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
> menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
> menu.add(new Separator(RADIS_MENU_ADDITIONS));
> menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
> return menu;
> }
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03291 seconds