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/perspectiveswitcher/PerspectiveSwitcher.java
}
				});
			}
			public void menuShown(MenuEvent e) {
				
			}
		});
	}
	private void addCloseItem(final Menu menu) {
		MenuItem menuItem = new MenuItem(menu, SWT.NONE);
		menuItem.setText("&Close");
		menuItem.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				MPerspective persp = (MPerspective) menu.getData();
				if (persp != null)
					closePerspective(persp);
			}
		});
	}
	private void closePerspective(MPerspective persp) {
		IWorkbenchPage page = persp.getContext().get(IWorkbenchPage.class);
		IPerspectiveDescriptor desc = getDescriptorFor(persp.getElementId());
		page.closePerspective(desc, true, false);
		removePerspectiveItem(persp);
	}
	private void addResetItem(final Menu menu) {
		MenuItem menuItem = new MenuItem(menu, SWT.NONE);
		menuItem.setText("&Reset");
		menuItem.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {