Fix for Bug 347471 - Shared area disappears and then Eclipse becomes unusable
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java
index b01bf4b..310214f 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java
@@ -19,6 +19,7 @@
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
+import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
@@ -105,6 +106,15 @@
IEclipseContext curContext = modelService.getContainingContext(ph);
if (refs.size() == 0) {
+ // Ensure that the image is the 'original' image for this
+ // part. See bug 347471 for details
+ if (refElement instanceof MPart) {
+ MPart thePart = (MPart) refElement;
+ String imageURI = thePart.getIconURI();
+ thePart.setIconURI(null);
+ thePart.setIconURI(imageURI);
+ }
+
renderingEngine.removeGui(refElement);
} else {
// Ensure that the dispose of the element reference doesn't cascade
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index b7807c3..302bf19 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
@@ -208,10 +208,14 @@
// Do we have any stacks with place holders for the element
// that's changed?
- List<MPlaceholder> refs = ElementReferenceRenderer
- .getRenderedPlaceholders(element);
+ MWindow win = modelService.getTopLevelWindowFor(part);
+ List<MPlaceholder> refs = modelService.findElements(win, null,
+ MPlaceholder.class, null);
if (refs != null) {
for (MPlaceholder ref : refs) {
+ if (ref.getRef() != part)
+ continue;
+
MElementContainer<MUIElement> refParent = ref
.getParent();
// can be null, see bug 328296