Project: Eclipse_Platform_UI
Bug 405471 Incorrectly handling of MMenu element contributions in DynamicMenuContribution
Reported: 2013-04-11 09:41:17 | Status: verified fixed

Hello, When I use a MDynamicMenuContribution and I populate it with MMenu objects, these are not cleaned (In the renderer?). To reproduce: 1. Add a Dynamic Menu Contribution to a Part. 2. Create a class with this implementation. @AboutToHide public void aboutToHide(List<MMenuElement> items) { // Clearing items here, has no effect. items.clear(); } @AboutToShow public void aboutToShow(List<MMenuElement> items) { MMenu menu = MMenuFactory.INSTANCE.createMenu(); menu.setLabel("Test");//$NON-NLS-1$ menu.setElementId("test.menu.id"); MDirectMenuItem createDirectMenuItem = MMenuFactory.INSTANCE.createDirectMenuItem(); createDirectMenuItem.setElementId("test.id.whatever"); createDirectMenuItem.setLabel("test"); createDirectMenuItem.setContributorURI("platform://...."); createDirectMenuItem.setContributionURI("bundleclass://..."); createChildMenuManager.getChildren().add(createDirectMenuItem); items.add(createChildMenuManager); } will try to diagnose, if this is indeed recognized as a bug. Note, no response on the forum, hence the bug report.

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java