public XulDomContainer loadXul(Document xulDocument, Object context)
      throws IllegalArgumentException, XulException {

    setOuterContext(context);
    XulDomContainer domC = super.loadXul(xulDocument);

    // SWT has no notion of an "onload" event, so we must simulate it...
    // This needs to be replaced by an agnostic listener pattern.

    XulComponent maybeWindow = domC.getDocumentRoot().getRootElement();
    if (maybeWindow instanceof SwtWindow) {
      SwtWindow window = (SwtWindow) maybeWindow;
      window.notifyListeners(XulRoot.EVENT_ON_LOAD);
      defaultParent = window;
    }

    XulComponent maybeDialog = domC.getDocumentRoot().getRootElement();
    if (maybeWindow instanceof SwtDialog) {
      SwtDialog dialog = (SwtDialog) maybeDialog;
      dialog.notifyListeners(XulRoot.EVENT_ON_LOAD);
      defaultParent = dialog;
    }

    return domC;
  }
Esempio n. 2
0
  @Override
  public void hide() {

    if (closing
        || dialog.getMainArea().isDisposed()
        || getParentShell(getParent()).isDisposed()
        || (getParent() instanceof SwtDialog && ((SwtDialog) getParent()).isDisposing())) {
      return;
    }

    // Save the window location & size in the Kettle world...
    //
    WindowProperty windowProperty = new WindowProperty(getShell());
    PropsUI.getInstance().setScreen(windowProperty);

    super.hide();
  }
 public void dispose() {
   SwtDialog dialog =
       (SwtDialog) container.getDocumentRoot().getElementById("repository-explorer-dialog");
   dialog.dispose();
   initialized = false;
 }