Project: Eclipse_Platform_UI
Bug 54779 [RCP] Problem updating menus, menu not appearing
Reported: 2004-03-14 18:53:12 | Status: verified fixed

I'm using 3.0 M7. I have an application, implementing workbench advisor, that creates a placeholder Help menu in the top level menu. Since the Help menu has no items other than separators and group items a swt menu is not created. Later on an item, Help Contents, is contributed to the Help menu. When getMenuBarManager().updateAll(false); is called from updateActionBars() in WorkbenchWindow the help menu will not be updated for two reasons: 1) The top level menu is not dirty, so it can't fill the help menu can create the swt menu. 2) The swt menu for the Help menu does not exist, so the swt menu can not be created. I have an sample application to demonstrate the problem as well as a fix to MenuManager.java in jface to solve the problem. The fix is to override markDirty()in MenuManager.java with the following code. /* (non-Javadoc) * @see org.eclipse.jface.action.IContributionManager#markDirty() */ public void markDirty() { super.markDirty(); // if we do not have a menu yet, then we need to mark our parent as dirty so our parent will // have the chance to create our menu when it gets updated. if (!menuExist()) { IContributionManager parent = getParent(); if (parent != null && !parent.isDirty()) { parent.markDirty(); } } }

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/AllTests.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/AllTests.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/ContributionManagerTest.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/action/MenuManagerTest.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/images/AllTests.java tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AllTests.java