Bug 349331 [Compatibility] Closing non-active perspectives will remove
all views from the shared area

The code for closing a perspective was also removing
placeholders from the shared area. This code should only be
invoked when a perspective is reset.
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
index 634c6af..dc1b3a3 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java
@@ -740,6 +740,11 @@
 	}
 
 	public void resetPerspectiveModel(MPerspective persp, MWindow window) {
+		resetPerspectiveModel(persp, window, true);
+	}
+
+	private void resetPerspectiveModel(MPerspective persp, MWindow window,
+			boolean removeSharedPlaceholders) {
 		if (persp == null)
 			return;
 
@@ -749,24 +754,26 @@
 		}
 		persp.getWindows().clear();
 
-		// Remove any views (Placeholders) from the shared area
-		EPartService ps = window.getContext().get(EPartService.class);
-		List<MArea> areas = findElements(window, null, MArea.class, null);
-		if (areas.size() == 1) {
-			MArea area = areas.get(0);
+		if (removeSharedPlaceholders) {
+			// Remove any views (Placeholders) from the shared area
+			EPartService ps = window.getContext().get(EPartService.class);
+			List<MArea> areas = findElements(window, null, MArea.class, null);
+			if (areas.size() == 1) {
+				MArea area = areas.get(0);
 
-			// Strip out the placeholders in visible stacks
-			List<MPlaceholder> phList = findElements(area, null, MPlaceholder.class, null);
-			for (MPlaceholder ph : phList) {
-				ps.hidePart((MPart) ph.getRef());
-				ph.getParent().getChildren().remove(ph);
-			}
+				// Strip out the placeholders in visible stacks
+				List<MPlaceholder> phList = findElements(area, null, MPlaceholder.class, null);
+				for (MPlaceholder ph : phList) {
+					ps.hidePart((MPart) ph.getRef());
+					ph.getParent().getChildren().remove(ph);
+				}
 
-			// Prevent shared stacks ids from clashing with the ones in the perspective
-			List<MPartStack> stacks = findElements(area, null, MPartStack.class, null);
-			for (MPartStack stack : stacks) {
-				String generatedId = "PartStack@" + Integer.toHexString(stack.hashCode()); //$NON-NLS-1$
-				stack.setElementId(generatedId);
+				// Prevent shared stacks ids from clashing with the ones in the perspective
+				List<MPartStack> stacks = findElements(area, null, MPartStack.class, null);
+				for (MPartStack stack : stacks) {
+					String generatedId = "PartStack@" + Integer.toHexString(stack.hashCode()); //$NON-NLS-1$
+					stack.setElementId(generatedId);
+				}
 			}
 		}
 
@@ -819,7 +826,7 @@
 		}
 
 		// Remove transient elements (minimized stacks, detached windows)
-		resetPerspectiveModel(persp, window);
+		resetPerspectiveModel(persp, window, false);
 
 		// unrender the perspective and remove it
 		persp.setToBeRendered(false);