Bug 440789 - MWindow should support dynamic add/remove of children
windows/components

Fix handleChildRemove()

Change-Id: I823b0cb31c5f240523cf8471108e1ab40397935b
Signed-off-by: Sun Volland <sun.volland@free.fr>
diff --git a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseWindowRenderer.java b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseWindowRenderer.java
index 0399b9f..2ea030d 100755
--- a/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseWindowRenderer.java
+++ b/bundles/runtime/org.eclipse.fx.ui.workbench.renderers.base/src/org/eclipse/fx/ui/workbench/renderers/base/BaseWindowRenderer.java
@@ -26,7 +26,6 @@
 import org.eclipse.e4.ui.model.application.MApplication;
 import org.eclipse.e4.ui.model.application.MApplicationElement;
 import org.eclipse.e4.ui.model.application.ui.MContext;
-import org.eclipse.e4.ui.model.application.ui.MElementContainer;
 import org.eclipse.e4.ui.model.application.ui.MUIElement;
 import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 import org.eclipse.e4.ui.model.application.ui.basic.MTrimBar;
@@ -182,7 +181,7 @@
                     if (element instanceof MWindow) {
                         handleWindowRemove(window, (MWindow) element);
                     } else if (element instanceof MWindowElement) {
-                        handleChildRemove((MWindowElement) element);
+                        handleChildRemove(window, (MWindowElement) element);
                     }
                 }
             }
@@ -208,14 +207,9 @@
 	    }
 	}
 
-	void handleChildRemove(MWindowElement element) {
+	void handleChildRemove(@NonNull MWindow window, MWindowElement element) {
 		if (element.isToBeRendered() && element.isVisible() && element.getWidget() != null) {
-			MElementContainer<MUIElement> parent = element.getParent();
-			if( parent != null ) {
-				hideChild((MWindow) (MUIElement) parent, element);	
-			} else {
-				getLogger().error("Unable to find parent for '"+element+"'");  //$NON-NLS-1$//$NON-NLS-2$
-			}
+			hideChild(window, element);
 		}
 	}