Bug 327522 Several main menus gone
I20101007-1949. 1. start new workspace 2. paste this snippet into Package Explorer: "class A {}" 3. close the editor (doesn't matter if you save or not) ==> several main menus (e.g. 'Refactor') are gone. ==> selecting another element in the view does not bring it back Nothing in .log.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessContextPresentationEngine.java
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MGenericStack;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
public class HeadlessContextPresentationEngine implements IPresentationEngine {
	@Inject
	private IEventBroker eventBroker;
	@Inject
	private IContributionFactory contributionFactory;
	private EventHandler childHandler;
	private EventHandler activeChildHandler;
	private EventHandler toBeRenderedHandler;
	private boolean createContributions = true;
	@Inject
	private EModelService modelService;
	protected IEclipseContext getParentContext(MUIElement element) {
		return modelService.getContainingContext(element);
	}
	private static void populateModelInterfaces(MContext contextModel,
			IEclipseContext context, Class<?>[] interfaces) {