Bug 341273 ESS will not work without parts
While windows without any parts probably isn't a very interesting shape, it is still possible to create such a thing. In this scenario, the ESS may not work properly because we rely solely on the active part for selection information. It should be possible to have a selection at the window level as-is.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
Object selection;
		@Inject
		void setSelection(
				@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Target selection) {
			this.selection = selection;
		}
	}
	public void testInjection() {
		MApplication application = ApplicationFactoryImpl.eINSTANCE
				.createApplication();
		MWindow window = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window);
		application.setSelectedElement(window);
		MPart partA = BasicFactoryImpl.eINSTANCE.createPart();
		window.getChildren().add(partA);
		MPart partB = BasicFactoryImpl.eINSTANCE.createPart();
		window.getChildren().add(partB);
		window.setSelectedElement(partA);
		initialize(applicationContext, application);
		getEngine().createGui(window);
		IEclipseContext windowContext = window.getContext();
		IEclipseContext partContextA = partA.getContext();
		IEclipseContext partContextB = partB.getContext();
		EPartService partService = windowContext.get(EPartService.class);
		partService.activate(partA);
		ESelectionService selectionServiceA = partContextA
				.get(ESelectionService.class);