Bug 326177 EPartService's getActivePart() does not appear to work properly for an application with multiple windows
Based on the code in PartServiceCreationFunction, the EPartService implementation being returned when an application's context is queried seems to be a window-level EPartService implementation.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
EPartService partService = (EPartService) window.getContext().get(
				EPartService.class.getName());
		partService.activate(partA);
		assertEquals(partA, partService.getActivePart());
		MPart partB = partService.showPart("partB",
				EPartService.PartState.VISIBLE);
		assertEquals(2, partStack.getChildren().size());
		assertEquals(
				"The part is in the same stack as the active part, so the active part should not have changed",
				partA, partService.getActivePart());
		assertNotNull("The shown part should have a context",
				partB.getContext());
		assertTrue(partService.isPartVisible(partA));
		assertFalse(partService.isPartVisible(partB));
	}
	public void testShowPart_Id_VISIBLE3() {
		MApplication application = ApplicationFactoryImpl.eINSTANCE
				.createApplication();
		MWindow window = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window);
		MPartDescriptor partDescriptor = org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicFactoryImpl.eINSTANCE
				.createPartDescriptor();
		partDescriptor.setElementId("partB");
		partDescriptor.setCategory("aCategory");
		application.getDescriptors().add(partDescriptor);
		MPartStack partStackA = BasicFactoryImpl.eINSTANCE.createPartStack();
		window.getChildren().add(partStackA);
		MPartStack partStackB = BasicFactoryImpl.eINSTANCE.createPartStack();
		partStackB.getTags().add("aCategory");
		window.getChildren().add(partStackB);