Bug 318363 [UI] Closing Perspectives changes others
If you open the Debug perspective and then close it the Package Explorer disappears. Root cause was that I opened the second perspective using the perspective switcher which performed the operation 'locally' rather than going through the WorkbenchPage#setPerspective code. This meant that the 'openPerspectives' list wasn't updated which meant that the 'closePerspective' call delegated to 'closeAllPerspectives' since it thought there was only one open.
bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/minmax/TrimStack.java
loc.x = caRect.x;
		else
			loc.x = (caRect.x + caRect.width) - paneSize.x;
		if (isFixed(SWT.TOP))
			loc.y = caRect.y;
		else
			loc.y = (caRect.y + caRect.height) - paneSize.y;
		someShell.setLocation(loc);
	}
	private void updateSelection(MStackElement selectedElement) {
		
		ToolItem[] items = trimStackTB.getItems();
		for (ToolItem item : items) {
			CTabItem cti = (CTabItem) item.getData();
			if (cti == null || cti.isDisposed())
				continue;
			item.setSelection(cti.getData(AbstractPartRenderer.OWNING_ME) == selectedElement);
		}
	}
	private Composite getHostPane() {
		if (hostPane != null)
			return hostPane;
		
		hostPane = new Composite(trimStackTB.getShell(), SWT.NONE);
		hostPane.setData(ShellActivationListener.DIALOG_IGNORE_KEY, Boolean.TRUE);
		int xSize = 600;
		String xSizeStr = toolControl.getPersistedState().get("XSize");
		if (xSizeStr != null)
			xSize = Integer.parseInt(xSizeStr);
		int ySize = 400;