Bug 320100 Package Explorer unexpectedly added to Debug perspective
1. Open a fresh e4 workbench 2. Leave the Package Explorer activated 3. Open the Debug perspective Result: The Debug perspective contains the Package Explorer, although this should not be the case. This does not happen when another view is activated before opening the Debug perspective.
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
cti.dispose();
		}
		
		if (parentElement.getSelectedElement() == child) {
			if (ctf.getTopRight() != null) {
				Control curTB = ctf.getTopRight();
				ctf.setTopRight(null);
				MUIElement tbME = (MUIElement) curTB
						.getData(AbstractPartRenderer.OWNING_ME);
				if (tbME instanceof MRenderedToolBar)
					renderer.removeGui(tbME);
				else
					curTB.dispose();
			}
			
			
			MUIElement defaultSel = getFirstVisibleElement(parentElement);
			parentElement.setSelectedElement(defaultSel);
		}
	}
	private MUIElement getFirstVisibleElement(
			MElementContainer<MUIElement> stack) {
		
		for (MUIElement mPart : stack.getChildren()) {
			if (mPart.isToBeRendered())
				return mPart;
		}
		return null;
	}
	@Override