/*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer#createWidget
   * (org.eclipse.e4.ui.model.application.ui.MUIElement, java.lang.Object)
   */
  @Override
  public Object createWidget(final MUIElement element, Object parent) {
    if (!(element instanceof MToolBar) || !(parent instanceof Composite)) return null;

    final MToolBar toolbarModel = (MToolBar) element;
    ToolBar newTB = createToolbar(toolbarModel, (Composite) parent);
    bindWidget(element, newTB);
    processContribution(toolbarModel, toolbarModel.getElementId());

    Control renderedCtrl = newTB;
    MUIElement parentElement = element.getParent();
    if (parentElement instanceof MTrimBar) {
      element.getTags().add("Draggable"); // $NON-NLS-1$

      setCSSInfo(element, newTB);

      boolean vertical = false;
      MTrimBar bar = (MTrimBar) parentElement;
      vertical = bar.getSide() == SideValue.LEFT || bar.getSide() == SideValue.RIGHT;
      IEclipseContext parentContext = getContextForParent(element);
      CSSRenderingUtils cssUtils = parentContext.get(CSSRenderingUtils.class);
      if (cssUtils != null) {
        renderedCtrl = (Composite) cssUtils.frameMeIfPossible(newTB, null, vertical, true);
      }
    }

    return renderedCtrl;
  }
  @Override
  public int countRenderableChildren(MUIElement element) {
    if (!(element instanceof MElementContainer<?>)) {
      return 0;
    }

    @SuppressWarnings("unchecked")
    MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) element;
    int count = 0;
    List<MUIElement> kids = container.getChildren();
    for (MUIElement kid : kids) {
      if (kid.isToBeRendered()) {
        count++;
      }
    }

    if (element instanceof MPerspective) {
      MPerspective perspective = (MPerspective) element;
      for (MWindow window : perspective.getWindows()) {
        if (window.isToBeRendered()) {
          count++;
        }
      }
    }
    return count;
  }
  @Override
  public boolean isLastEditorStack(MUIElement stack) {
    if (!(stack instanceof MPartStack)) {
      return false;
    }

    // is it in the shared area?
    MUIElement parent = stack.getParent();
    while (parent != null && !(parent instanceof MArea)) {
      parent = parent.getParent();
    }
    if (parent == null) {
      return false;
    }

    // OK, it's in the area, is it the last TBR one ?
    MArea area = (MArea) parent;
    List<MPartStack> stacks = findElements(area, null, MPartStack.class, null);
    int count = 0;
    for (MPartStack aStack : stacks) {
      if (aStack.isToBeRendered()) {
        count++;
      }
    }
    return count < 2 && stack.isToBeRendered();
  }
  @Override
  public boolean isPartVisible(MPart part) {
    if (isInContainer(part)) {
      MUIElement element = part;
      MElementContainer<?> parent = part.getParent();
      if (parent == null) {
        // might be a shared part
        element = part.getCurSharedRef();
        if (element == null) {
          return false;
        }

        parent = element.getParent();
        if (parent == null) {
          return false;
        }
      }

      if (parent instanceof MPartStack) {
        return parent.getSelectedElement() == element;
      }

      return element.isVisible();
    }
    return false;
  }
  @Override
  public MPlaceholder createSharedPart(String id, boolean force) {
    MWindow sharedWindow = getWindow();
    // Do we already have the part to share?
    MPart sharedPart = null;

    // check for existing parts if necessary
    if (!force) {
      for (MUIElement element : sharedWindow.getSharedElements()) {
        if (element.getElementId().equals(id)) {
          sharedPart = (MPart) element;
          break;
        }
      }
    }

    if (sharedPart == null) {
      MPartDescriptor descriptor = modelService.getPartDescriptor(id);
      sharedPart = createPart(descriptor);
      if (sharedPart == null) {
        return null;
      }

      // Replace the id to ensure that multi-instance parts work correctly
      sharedPart.setElementId(id);

      sharedWindow.getSharedElements().add(sharedPart);
    }

    return createSharedPart(sharedPart);
  }
  private void resetPerspectiveModel(
      MPerspective persp, MWindow window, boolean removeSharedPlaceholders) {
    if (persp == null) {
      return;
    }

    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);
        }

        // 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);
        }

        // Also remove any min/max tags on the area (or its placeholder)
        MUIElement areaPresentation = area;
        if (area.getCurSharedRef() != null) {
          areaPresentation = area.getCurSharedRef();
        }

        areaPresentation.getTags().remove(IPresentationEngine.MAXIMIZED);
        areaPresentation.getTags().remove(IPresentationEngine.MINIMIZED);
        areaPresentation.getTags().remove(IPresentationEngine.MINIMIZED_BY_ZOOM);
      }
    }

    // Remove any minimized stacks for this perspective
    List<MTrimBar> bars = findElements(window, null, MTrimBar.class, null);
    List<MToolControl> toRemove = new ArrayList<>();
    for (MTrimBar bar : bars) {
      for (MUIElement barKid : bar.getChildren()) {
        if (!(barKid instanceof MToolControl)) {
          continue;
        }
        String id = barKid.getElementId();
        if (id != null && id.contains(persp.getElementId())) {
          toRemove.add((MToolControl) barKid);
        }
      }
    }

    for (MToolControl toolControl : toRemove) {
      // Close any open fast view
      toolControl.setToBeRendered(false);
      toolControl.getParent().getChildren().remove(toolControl);
    }
  }
Ejemplo n.º 7
0
  // -------------------------------------------------------
  // -------------------------------------------------------
  private void hideElementRecursive(MUIElement element) {
    if (element == null || element.getWidget() == null) return;

    if (element instanceof MPlaceholder) {
      MPlaceholder ph = (MPlaceholder) element;
      element = ph.getRef();
    }

    // Hide any floating windows
    if (element instanceof MWindow && element.getWidget() != null) {
      element.setVisible(false);
    }

    if (element instanceof MElementContainer<?>) {
      MElementContainer<?> container = (MElementContainer<?>) element;
      for (MUIElement childElement : container.getChildren()) {
        hideElementRecursive(childElement);
      }

      // OK, now process detached windows
      if (element instanceof MWindow) {
        for (MWindow w : ((MWindow) element).getWindows()) {
          hideElementRecursive(w);
        }
      } else if (element instanceof MPerspective) {
        for (MWindow w : ((MPerspective) element).getWindows()) {
          hideElementRecursive(w);
        }
      }
    }
  }
Ejemplo n.º 8
0
  public static int getPositionIndex(
      String positionInList, MElementContainer<MUIElement> container) {
    if (positionInList == null || positionInList.trim().length() == 0) {
      return -1;
    }
    PositionInfo posInfo = PositionInfo.parse(positionInList);
    if (posInfo == null) {
      return -1;
    }
    switch (posInfo.getPosition()) {
      case FIRST:
        return 0;

      case INDEX:
        return posInfo.getPositionReferenceAsInteger();

      case BEFORE:
      case AFTER:
        String elementId = posInfo.getPositionReference();
        List<MUIElement> siblings = container.getChildren();
        for (int i = 0; i < siblings.size(); i++) {
          MUIElement sibling = siblings.get(i);
          if (elementId.equals(sibling.getElementId())) {
            return posInfo.getPosition() == Position.BEFORE ? i : i + 1;
          }
        }

      case LAST:
      default:
        return -1;
    }
  }
  @Override
  public MUIElement cloneElement(MUIElement element, MSnippetContainer snippetContainer) {
    EObject eObj = (EObject) element;
    MUIElement clone = (MUIElement) EcoreUtil.copy(eObj);

    // null out all the references
    List<MPlaceholder> phList = findElements(clone, null, MPlaceholder.class, null);
    for (MPlaceholder ph : phList) {
      // Skip placeholders in the sharedArea
      int location = getElementLocation(ph);
      if ((location & IN_SHARED_AREA) != 0) {
        continue;
      }

      ph.setRef(null);
    }

    if (snippetContainer != null) {
      MUIElement snippet = findSnippet(snippetContainer, element.getElementId());
      if (snippet != null) {
        snippetContainer.getSnippets().remove(snippet);
      }
      snippetContainer.getSnippets().add(clone);
    }

    // Cache the original element in the clone's transientData
    clone.getTransientData().put(CLONED_FROM_KEY, element);

    return clone;
  }
 private String getContextName(MUIElement element) {
   StringBuilder builder = new StringBuilder(element.getClass().getSimpleName());
   String elementId = element.getElementId();
   if (elementId != null && elementId.length() != 0) {
     builder.append(" (").append(elementId).append(") ");
   }
   builder.append("Context");
   return builder.toString();
 }
Ejemplo n.º 11
0
  protected Command computeCommand() {
    MUIElement selectedPart = model;

    if (selectedPart instanceof MPart) {
      MGenericStack<MUIElement> partStack = findParentStack();
      if (partStack != null) {
        selectedPart = partStack;
      }
    }

    MElementContainer<MUIElement> parent = partStack.getParent();
    List<MUIElement> children = parent.getChildren();
    int index = children.indexOf(partStack);
    if (parent instanceof MGenericTile<?>) {
      MGenericTile<?> genericTile = (MGenericTile<?>) parent;
      int modelIndex = children.indexOf(selectedPart);
      if (modelIndex == 0 && index == 1 && children.size() == 2 && genericTile.isHorizontal()) {
        return UnexecutableCommand.INSTANCE;
      }
    }

    CompoundCommand result = new CompoundCommand();

    MPartSashContainer newSash = MBasicFactory.INSTANCE.createPartSashContainer();
    String preferData = partStack.getContainerData();
    newSash.setContainerData(preferData);
    newSash.setHorizontal(true);

    if (selectedPart instanceof MPartStack) {
      if (selectedPart.getParent() == null) {
        selectedPart.setContainerData(preferData);
        result.add(CommandFactory.createAddChildCommand(newSash, selectedPart, 0));
      } else {
        result.add(new ChangeParentCommand(newSash, selectedPart, 0));
        if (!preferData.equals(selectedPart.getContainerData())) {
          result.add(
              new ApplyAttributeSettingCommand(
                  (EObject) selectedPart, "containerData", preferData));
        }
      }
    } else if (selectedPart instanceof MPart) {
      MPart part = (MPart) selectedPart;
      MPartStack createPartStack = MBasicFactory.INSTANCE.createPartStack();
      createPartStack.setContainerData(preferData);
      if (part.getParent() != null) {
        result.add(new ChangeParentCommand(createPartStack, part, 0));
      } else {
        result.add(CommandFactory.createAddChildCommand(createPartStack, part, 0));
      }
      result.add(CommandFactory.createAddChildCommand(newSash, createPartStack, 0));
    }

    result.add(new ChangeParentCommand(newSash, partStack, 1));

    result.add(CommandFactory.createAddChildCommand(parent, newSash, index));
    return result.unwrap();
  }
 @Override
 public int toBeRenderedCount(MElementContainer<?> container) {
   int count = 0;
   for (MUIElement child : container.getChildren()) {
     if (child.isToBeRendered()) {
       count++;
     }
   }
   return count;
 }
 /** @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());
 }
 /**
  * Returns the parent container of the specified element. If one cannot be found, a check will be
  * performed to see whether the element is being represented by a placeholder, if it is, the
  * placeholder's parent will be returned, if any.
  *
  * @param element the element to query
  * @return the element's parent container, or the parent container of the specified element's
  *     current placeholder, if it has one
  */
 private MElementContainer<MUIElement> getParent(MUIElement element) {
   MElementContainer<MUIElement> parent = element.getParent();
   if (parent == null) {
     MPlaceholder placeholder = element.getCurSharedRef();
     if (placeholder == null) {
       @SuppressWarnings("unchecked")
       MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) getContainer();
       return findContainer(container, element);
     }
     return placeholder.getParent();
   }
   return parent;
 }
Ejemplo n.º 15
0
  @Override
  public Image getImage(Object element, Display display) {
    if (element instanceof MUIElement) {
      MUIElement uiElement = (MUIElement) element;
      if (uiElement.isToBeRendered() && uiElement.isVisible()) {
        return createImage(ResourceProvider.IMG_WizardDialog);
      } else {
        return createImage(ResourceProvider.IMG_Tbr_WizardDialog);
      }
    }

    return null;
  }
Ejemplo n.º 16
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.e4.ui.workbench.renderers.AbstractPartRenderer#getUIContainer
   * (org.eclipse.e4.ui.model.application.MUIElement)
   */
  @Override
  public Object getUIContainer(MUIElement element) {
    if (!(element instanceof MMenuElement)) return null;

    if (element.getParent().getWidget() instanceof MenuItem) {
      MenuItem mi = (MenuItem) element.getParent().getWidget();
      if (mi.getMenu() == null) {
        mi.setMenu(new Menu(mi));
      }
      return mi.getMenu();
    }

    return super.getUIContainer(element);
  }
  @Override
  public MUIElement findSnippet(MSnippetContainer snippetContainer, String id) {
    if (snippetContainer == null || id == null || id.length() == 0) {
      return null;
    }

    List<MUIElement> snippets = snippetContainer.getSnippets();
    for (MUIElement snippet : snippets) {
      if (id.equals(snippet.getElementId())) {
        return snippet;
      }
    }

    return null;
  }
 @Override
 public Object getUIContainer(MUIElement element) {
   if (element instanceof MToolBar) {
     MUIElement container = (MUIElement) ((EObject) element).eContainer();
     MUIElement parent = container.getParent();
     if (parent == null) {
       MPlaceholder placeholder = container.getCurSharedRef();
       if (placeholder != null) {
         return placeholder.getParent().getWidget();
       }
     } else {
       return parent.getWidget();
     }
   }
   return super.getUIContainer(element);
 }
        public void handleEvent(Event event) {
          Object changedObj = event.getProperty(UIEvents.EventTags.ELEMENT);
          if (!(changedObj instanceof MTrimmedWindow)) return;

          MTrimmedWindow window = (MTrimmedWindow) changedObj;
          if (window.getWidget() == null) return;

          String eventType = (String) event.getProperty(UIEvents.EventTags.TYPE);
          if (UIEvents.EventTypes.ADD.equals(eventType)) {
            MUIElement added = (MUIElement) event.getProperty(UIEvents.EventTags.NEW_VALUE);
            if (added.isToBeRendered()) createGui(added, window.getWidget(), window.getContext());
          } else if (UIEvents.EventTypes.REMOVE.equals(eventType)) {
            MUIElement removed = (MUIElement) event.getProperty(UIEvents.EventTags.OLD_VALUE);
            if (removed.getRenderer() != null) removeGui(removed);
          }
        }
  private ToolBar createToolbar(final MUIElement element, Composite parent) {
    int orientation = getOrientation(element);

    ToolBarManager manager = getManager((MToolBar) element);
    if (manager == null) {
      manager = new ToolBarManager(orientation | SWT.WRAP | SWT.FLAT | SWT.RIGHT);
      IContributionManagerOverrides overrides = null;
      MApplicationElement parentElement = element.getParent();
      if (parentElement == null) {
        parentElement = (MApplicationElement) ((EObject) element).eContainer();
      }

      if (parentElement != null) {
        overrides =
            (IContributionManagerOverrides)
                parentElement.getTransientData().get(IContributionManagerOverrides.class.getName());
      }

      manager.setOverrides(overrides);
      linkModelToManager((MToolBar) element, manager);
    }
    ToolBar bar = manager.createControl(parent);
    bar.setData(manager);
    bar.setData(AbstractPartRenderer.OWNING_ME, element);
    bar.getShell().layout(new Control[] {bar}, SWT.DEFER);
    bar.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            cleanUp((MToolBar) element);
          }
        });
    return bar;
  }
  private MContext getParentWithContext(MUIElement part) {
    MElementContainer<MUIElement> parent = part.getParent();
    MUIElement intermediate = parent;
    if (intermediate == null) {
      intermediate = part;
    } else {
      while (parent != null) {
        if (parent instanceof MContext) {
          if (((MContext) parent).getContext() != null) return (MContext) parent;
        }
        intermediate = parent;
        parent = parent.getParent();
      }
    }

    MPlaceholder placeholder = modelService.findPlaceholderFor(getWindow(), intermediate);
    parent = placeholder.getParent();
    while (parent != null) {
      if (parent instanceof MContext) {
        if (((MContext) parent).getContext() != null) return (MContext) parent;
      }
      parent = parent.getParent();
    }
    return null;
  }
  @Override
  public boolean isHostedElement(MUIElement element, MWindow hostWindow) {
    MUIElement curElement = element;
    while (curElement != null && !curElement.getTags().contains(HOSTED_ELEMENT)) {
      if (curElement.getCurSharedRef() != null) {
        curElement = curElement.getCurSharedRef();
      } else {
        curElement = curElement.getParent();
      }
    }

    if (curElement == null) {
      return false;
    }

    return hostWindow.getSharedElements().contains(curElement);
  }
        public void handleEvent(Event event) {
          MUIElement changedElement = (MUIElement) event.getProperty(UIEvents.EventTags.ELEMENT);
          MUIElement parent = changedElement.getParent();
          if (parent == null) {
            parent = (MUIElement) ((EObject) changedElement).eContainer();
            if (parent == null) {
              return;
            }
          }

          AbstractPartRenderer renderer = (AbstractPartRenderer) parent.getRenderer();
          if (renderer == null || parent instanceof MToolBar) return;

          // Re-parent the control based on the visible state
          if (changedElement.isVisible()) {
            if (changedElement.isToBeRendered()) {
              if (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);
              }

              if (parent instanceof MElementContainer<?>) {
                renderer.childRendered((MElementContainer<MUIElement>) parent, changedElement);
              }
            }
          } else {
            // Put the control under the 'limbo' shell
            if (changedElement.getWidget() instanceof Control) {
              Control ctrl = (Control) changedElement.getWidget();

              if (!(ctrl instanceof Shell)) {
                ctrl.getShell().layout(new Control[] {ctrl}, SWT.DEFER);
              }

              ctrl.setParent(getLimboShell());
            }

            if (parent instanceof MElementContainer<?>) {
              renderer.hideChild((MElementContainer<MUIElement>) parent, changedElement);
            }
          }
        }
  @Override
  public boolean canDrop(MUIElement dragElement, DnDInfo info) {
    if (!(dragElement instanceof MStackElement) && !(dragElement instanceof MPartStack))
      return false;

    dropStack = null;

    // Hack! allow splitting the 'empty' editor area stack
    if (info.curElement instanceof MPartStack) {
      MPartStack stack = (MPartStack) info.curElement;
      if (dndManager.getModelService().isLastEditorStack(stack)) dropStack = stack;
    }

    if (dropStack == null) {
      if (!(info.curElement instanceof MStackElement)
          && !dndManager.getModelService().isLastEditorStack(info.curElement)) return false;

      // Detect placeholders
      MUIElement parent = info.curElement.getParent();
      if (info.curElement instanceof MPart && info.curElement.getCurSharedRef() != null)
        parent = info.curElement.getCurSharedRef().getParent();

      if (!(parent instanceof MPartStack) || !(parent.getWidget() instanceof CTabFolder))
        return false;

      dropStack = (MPartStack) parent;
    }

    // You can only drag MParts from window to window
    if (!(dragElement instanceof MPart)) {
      EModelService ms = dndManager.getModelService();
      MWindow dragElementWin = ms.getTopLevelWindowFor(dragElement);
      MWindow dropWin = ms.getTopLevelWindowFor(dropStack);
      if (dragElementWin != dropWin) return false;
    }

    // We can't split ourselves with if the element being dragged is the only element in the
    // stack (we check for '2' because the dragAgent puts a Drag Placeholder in the stack)
    MUIElement dragParent = dragElement.getParent();
    if (dragParent == dropStack && dropStack.getChildren().size() == 2) return false;

    dropCTF = (CTabFolder) dropStack.getWidget();

    return true;
  }
  private Object safeCreateGui(MUIElement element) {
    // Obtain the necessary parent widget
    Object parent = null;
    MUIElement parentME = element.getParent();
    if (parentME == null) parentME = (MUIElement) ((EObject) element).eContainer();
    if (parentME != null) {
      AbstractPartRenderer renderer = getRendererFor(parentME);
      if (renderer != null) {
        if (!element.isVisible()) {
          parent = getLimboShell();
        } else {
          parent = renderer.getUIContainer(element);
        }
      }
    }

    // Obtain the necessary parent context
    IEclipseContext parentContext = null;
    if (element.getCurSharedRef() != null) {
      MPlaceholder ph = element.getCurSharedRef();
      parentContext = getContext(ph.getParent());
    } else if (parentContext == null && element.getParent() != null) {
      parentContext = getContext(element.getParent());
    } else if (parentContext == null && element.getParent() == null) {
      parentContext = getContext((MUIElement) ((EObject) element).eContainer());
    }

    return safeCreateGui(element, parent, parentContext);
  }
Ejemplo n.º 26
0
  @Override
  public void createWidget(MUIElement element, MElementContainer<MUIElement> parent) {
    if (perspectiveSwitcherPanel == null)
      initializedPerspectiveSwticherPanel((MPerspectiveStack) element);

    VerticalLayout perspectiveStackContent = new VerticalLayout();
    perspectiveStackContent.setSizeFull();
    element.setWidget(perspectiveStackContent);
  }
  @Override
  public void bringToTop(MUIElement element) {
    if (element instanceof MApplication) {
      return;
    }

    MWindow window = getTopLevelWindowFor(element);
    if (window == element) {
      if (!element.isToBeRendered()) {
        element.setToBeRendered(true);
      }

      window.getParent().setSelectedElement(window);
    } else {
      showElementInWindow(window, element);
    }
    UIEvents.publishEvent(UIEvents.UILifeCycle.BRINGTOTOP, element);
  }
Ejemplo n.º 28
0
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer#hideChild
   * (org.eclipse.e4.ui.model.application.MElementContainer,
   * org.eclipse.e4.ui.model.application.MUIElement)
   */
  @Override
  public void hideChild(MElementContainer<MUIElement> parentElement, MUIElement child) {
    super.hideChild(parentElement, child);

    // Since there's no place to 'store' a child that's not in a menu
    // we'll blow it away and re-create on an add
    Widget widget = (Widget) child.getWidget();
    if (widget != null && !widget.isDisposed()) widget.dispose();
  }
 int getOrientation(final MUIElement element) {
   MUIElement theParent = element.getParent();
   if (theParent instanceof MTrimBar) {
     MTrimBar trimContainer = (MTrimBar) theParent;
     SideValue side = trimContainer.getSide();
     if (side.getValue() == SideValue.LEFT_VALUE || side.getValue() == SideValue.RIGHT_VALUE)
       return SWT.VERTICAL;
   }
   return SWT.HORIZONTAL;
 }
  @Override
  public void hostElement(
      MUIElement element, MWindow hostWindow, Object uiContainer, IEclipseContext hostContext) {
    // This is subtle; unless the element is hooked into the model it won't fire events
    hostWindow.getSharedElements().add(element);
    element.getTags().add(HOSTED_ELEMENT);

    IPresentationEngine renderer = hostWindow.getContext().get(IPresentationEngine.class);
    renderer.createGui(element, uiContainer, hostContext);
  }