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
case SWT.Dispose:
			trace("handleMenu.Dispose", menu, menuModel);
			cleanUp(menu);
			break;
		}
	}
	public void showMenu(final Event event, final Menu menu,
			final MMenu menuModel) {
		final IEclipseContext parentContext = modelService
				.getContainingContext(menuModel);
		final ArrayList<MMenuContribution> toContribute = new ArrayList<MMenuContribution>();
		final ArrayList<MMenuElement> menuContributionsToRemove = new ArrayList<MMenuElement>();
		ExpressionContext eContext = new ExpressionContext(parentContext);
		ContributionsAnalyzer.gatherMenuContributions(menuModel,
				application.getMenuContributions(), menuModel.getElementId(),
				toContribute, eContext, false);
		if (toContribute.size() > 0) {
			List<MMenuElement> items = menuModel.getChildren();
			if (!items.isEmpty()
					&& "menu.placeholder".equals(items.get(0).getElementId())) {
				MMenuElement item = items.get(0);
				trace("removed " + item, menu, menuModel);
				renderer.removeGui(item);
				items.remove(0);
			}
		}
		ContributionsAnalyzer.addMenuContributions(menuModel, toContribute,
				menuContributionsToRemove);
		
		pendingCleanup.put(menu, new Runnable() {