Bug 318645 Duplicate menu contributions after editor switching
Build Identifier: Build id: I20100630-1856 Steps to reproduce: 1. Open a Java file 2. Make sure the 'Source' menu is okay 3. Open a text file 4. Switch back to the Java file 5. Open the 'Source' menu again: all contributions are duplicated Additional switching back and forth will add even more duplicates to the 'Source' menu. Reproducible: Always
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/workbench/swt/modeling/MenuServiceFilter.java
ParameterizedCommand cmd = item.getWbCommand();
		if (cmd == null) {
			return;
		}
		final IEclipseContext lclContext = modelService
				.getContainingContext(item);
		EHandlerService service = lclContext.get(EHandlerService.class);
		item.setEnabled(service.canExecute(cmd));
	}
	private void unrender(final List<MMenuElement> menuModel) {
		trace("unrender", null, null);
		for (MMenuElement element : menuModel) {
			renderer.removeGui(element);
		}
	}
	private void removeMenuContributions(final MMenu menuModel,
			final ArrayList<MMenuElement> menuContributionsToRemove) {
		for (MMenuElement item : menuContributionsToRemove) {
			trace("removeMenuContributions " + item,
					(Widget) menuModel.getWidget(), menuModel);
			menuModel.getChildren().remove(item);
		}
	}
	private void handlerRenderedMenu(final Event event, final Menu menu,
			final MRenderedMenu menuModel) {
		
		switch (event.type) {
		case SWT.Show:
			trace("handlerRenderedMenu.Show", menu, menuModel);
			cleanUp(menu);