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
MPlaceholder partPlaceholderA1 = AdvancedFactoryImpl.eINSTANCE
				.createPlaceholder();
		partPlaceholderA1.setRef(partA);
		partA.setCurSharedRef(partPlaceholderA1);
		perspectiveA.getChildren().add(partPlaceholderA1);
		perspectiveA.setSelectedElement(partPlaceholderA1);
		MPlaceholder partPlaceholderB1 = AdvancedFactoryImpl.eINSTANCE
				.createPlaceholder();
		partPlaceholderB1.setRef(partB);
		partB.setCurSharedRef(partPlaceholderB1);
		perspectiveA.getChildren().add(partPlaceholderB1);
		MPerspective perspectiveB = AdvancedFactoryImpl.eINSTANCE
				.createPerspective();
		perspectiveStack.getChildren().add(perspectiveB);
		MPlaceholder partPlaceholderA2 = AdvancedFactoryImpl.eINSTANCE
				.createPlaceholder();
		partPlaceholderA2.setRef(partA);
		perspectiveB.getChildren().add(partPlaceholderA2);
		perspectiveB.setSelectedElement(partPlaceholderA2);
		MPlaceholder partPlaceholderB2 = AdvancedFactoryImpl.eINSTANCE
				.createPlaceholder();
		partPlaceholderB2.setRef(partB);
		perspectiveB.getChildren().add(partPlaceholderB2);
		initialize(applicationContext, application);
		getEngine().createGui(window);
		EPartService partService = window.getContext().get(EPartService.class);
		partService.activate(partB);
		partService.switchPerspective(perspectiveB);
		assertEquals(partB, partService.getActivePart());
	}