diff options
author | Eric Moffatt | 2010-10-25 14:21:40 +0000 |
---|---|---|
committer | Eric Moffatt | 2010-10-25 14:21:40 +0000 |
commit | 0b6c7ab0dde742c621f5b5222ef416a8ae224b3a (patch) | |
tree | 8d8b7d0cf217623c8413a04b099344cb3264b076 /bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java | |
parent | b8730b772200b4c9409ea900539edae1ee627576 (diff) | |
download | eclipse.platform.ui-0b6c7ab0dde742c621f5b5222ef416a8ae224b3a.tar.gz eclipse.platform.ui-0b6c7ab0dde742c621f5b5222ef416a8ae224b3a.tar.xz eclipse.platform.ui-0b6c7ab0dde742c621f5b5222ef416a8ae224b3a.zip |
Fix for Bug 328499 - [UI] Tighten up the handling for an MElementContainer's 'selectedElement'
Diffstat (limited to 'bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java')
-rw-r--r-- | bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java index 73a216df6a4..fbb312fb38a 100644 --- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java +++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java @@ -125,6 +125,11 @@ public class PartRenderingEngine implements IPresentationEngine { Activator .trace(Policy.DEBUG_RENDERER, "visible -> false", null); //$NON-NLS-1$ + // Ensure that the element about to be removed is not the + // selected element + if (parent.getSelectedElement() == changedElement) + parent.setSelectedElement(null); + // Note that the 'removeGui' protocol calls 'childRemoved' removeGui(changedElement); } @@ -136,10 +141,6 @@ public class PartRenderingEngine implements IPresentationEngine { public void handleEvent(Event event) { MUIElement changedElement = (MUIElement) event .getProperty(UIEvents.EventTags.ELEMENT); - if (!(changedElement.getWidget() instanceof Control)) - return; - - Control ctrl = (Control) changedElement.getWidget(); MElementContainer<MUIElement> parent = changedElement.getParent(); if (parent == null) return; @@ -150,17 +151,27 @@ public class PartRenderingEngine implements IPresentationEngine { return; // Re-parent the control based on the visible state - if (changedElement.isVisible()) { + if (changedElement.isVisible() + && changedElement.getWidget() instanceof Control) { // Ensure that the control is under its 'real' parent if it's // visible Composite realComp = (Composite) renderer .getUIContainer(changedElement); + Control ctrl = (Control) changedElement.getWidget(); ctrl.setParent(realComp); fixZOrder(changedElement); renderer.childRendered(parent, changedElement); } else { + // Ensure that the element about to be removed is not the + // selected element + if (parent.getSelectedElement() == changedElement) + parent.setSelectedElement(null); + // Put the control under the 'limbo' shell - ctrl.setParent(getLimboShell()); + if (changedElement.getWidget() instanceof Control) { + Control ctrl = (Control) changedElement.getWidget(); + ctrl.setParent(getLimboShell()); + } renderer.hideChild(parent, changedElement); } } @@ -251,6 +262,11 @@ public class PartRenderingEngine implements IPresentationEngine { SWT.CHANGED | SWT.DEFER); } + // Ensure that the element about to be removed is not the + // selected element + if (changedElement.getSelectedElement() == removed) + changedElement.setSelectedElement(null); + if (renderer != null) renderer.hideChild(changedElement, removed); } |