Bug 335889 E4Application#stop cannot shutdown the workbench
E4Application#stop() currently does nothing. As a result, if you trigger a shutdown of the OSGi runtime programmatically (e.g., getBundle(0).stop()), the UI workbench is not closed. Any subsequent clicking or interaction with the UI workbench triggers a cascade of errors. I think E4Application should hold onto the workbench in a field. The stop() method should call workbench.close().
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java
}
				
				MUIElement window = (MUIElement) current.get(MWindow.class
						.getName());
				if (window == null) {
					IEclipseContext ctxt = appContext.getActiveChild();
					if (ctxt == null) {
						return null;
					}
					log();
					return ctxt.get(MWindow.class);
				}
				MElementContainer<?> parent = window.getParent();
				while (parent != null && !(parent instanceof MApplication)) {
					window = parent;
					parent = parent.getParent();
				}
				return window;
			}
		});
		
		
		appContext.set(IExceptionHandler.class.getName(), exceptionHandler);
		appContext.set(IExtensionRegistry.class.getName(), registry);