Bug 329184 Detached view that is an activation target candidate can prevent perspective switching
1. Detach the 'Outline' view. 2. Window > Open Perspective > Debug 3. Window > Open Perspective > Java 4. The perspective switch doesn't actually happen. You see the 'Debug' perspective's content with an 'Outline' view detached. Closing the 'Outline' view in the 'Debug' perspective will workaround this problem.
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
assertEquals(perspectiveA.getContext(), window2.getContext()
				.getActiveChild());
		EPartService partService = window2.getContext().get(EPartService.class);
		partService.switchPerspective(perspectiveB);
		assertEquals(window1.getContext(), application.getContext()
				.getActiveChild());
		assertEquals(perspectiveB.getContext(), window2.getContext()
				.getActiveChild());
	}
	/**
	 * Tests that a perspective will automatically select another part as the
	 * active part after the originally active part that's being shown across
	 * multiple perspectives has been removed.
	 */
	public void testSwitchPerspective05() {
		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);
		MArea area = AdvancedFactoryImpl.eINSTANCE.createArea();
		window2.getSharedElements().add(area);
		MPart sharedPart = BasicFactoryImpl.eINSTANCE.createPart();
		window2.getSharedElements().add(sharedPart);
		area.getChildren().add(sharedPart);
		area.setSelectedElement(sharedPart);
		MPerspectiveStack perspectiveStack = AdvancedFactoryImpl.eINSTANCE
				.createPerspectiveStack();