/** @param parent */
 private void setStackVisibility(MElementContainer<MUIElement> parent) {
   for (MUIElement child : parent.getChildren()) {
     if (child.isToBeRendered() && child.isVisible()) {
       parent.setToBeRendered(true);
       return;
     }
   }
   parent.setToBeRendered(false);
   // continue modifying the visibility as the parent's parent may also
   // need to be hidden from the user
   setStackVisibility(parent.getParent());
 }
  private void createElement(MUIElement element) {
    if (modelService.isHostedElement(element, workbenchWindow)) {
      // assume the client has full control
      return;
    }

    MPlaceholder placeholder = element.getCurSharedRef();
    if (placeholder != null) {
      element.setToBeRendered(true);
      element = placeholder;
    }

    // render this element
    element.setToBeRendered(true);

    // render all of its parents
    MUIElement parentWindow = workbenchWindow;
    // determine the top parent that needs to be forcibly created
    MUIElement target = null;
    MElementContainer<MUIElement> parent = element.getParent();
    while (parent != null && parent != parentWindow) {
      parent.setToBeRendered(true);
      if (parent.getWidget() == null) {
        target = parent;
      }
      parent = parent.getParent();
    }
    if (target != null) {
      // force the element's parent hierarchy to be created
      engine.createGui(target);
    }
    // ask the engine to create the element
    if (element.getWidget() == null) engine.createGui(element);

    parent = element.getParent();
    if (parent != null && parent.getChildren().size() == 1) {
      // if we're the only child, set ourselves as the selected element
      parent.setSelectedElement(element);
    }
  }