Bug 329482 Uninstantiated part may be rendered when closing another part in the same stack
1. Activate the 'Javadoc' view. 2. Activate the 'Package Explorer' view. 3. Shutdown. 4. Restart. 5. Ctrl+3 > Properties 6. Hide the 'Properties' view. 7. Now the 'Problems' view is the selected element. It should be the 'Javadoc' view.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
perspectiveB1.setSelectedElement(partB1);
		MPerspective perspectiveB2 = AdvancedFactoryImpl.eINSTANCE
				.createPerspective();
		perspectiveStackB.getChildren().add(perspectiveB2);
		MPart partB2 = BasicFactoryImpl.eINSTANCE.createPart();
		perspectiveB2.getChildren().add(partB2);
		perspectiveB2.setSelectedElement(partB2);
		initialize(applicationContext, application);
		getEngine().createGui(windowA);
		getEngine().createGui(windowB);
		EPartService windowPartServiceB = windowB.getContext().get(
				EPartService.class);
		assertEquals(windowA.getContext(), application.getContext()
				.getActiveChild());
		assertEquals(perspectiveB1.getContext(), windowB.getContext()
				.getActiveChild());
		windowPartServiceB.switchPerspective(perspectiveB2);
		assertEquals(windowA.getContext(), application.getContext()
				.getActiveChild());
		assertEquals(perspectiveB2.getContext(), windowB.getContext()
				.getActiveChild());
	}
	public void testSwitchPerspective04() {
		MApplication application = ApplicationFactoryImpl.eINSTANCE
				.createApplication();
		MWindow window1 = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window1);
		application.setSelectedElement(window1);
		MWindow window2 = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window2);