Search in sources :

Example 1 with KettleXulLoader

use of org.pentaho.di.ui.xul.KettleXulLoader in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapNoStepsDialog method open.

void open() throws KettleException {
    Document xulDocument;
    try {
        xulDocument = initXul(parent, new KettleXulLoader(), new SwtXulRunner());
    } catch (XulException xulException) {
        throw new KettleException("Failed to initialize RemapNoStepsDialog.", xulException);
    }
    ((SwtDialog) xulDocument.getElementById(XUL_DIALOG_ID)).show();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) XulException(org.pentaho.ui.xul.XulException) SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) Document(org.pentaho.ui.xul.dom.Document) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Example 2 with KettleXulLoader

use of org.pentaho.di.ui.xul.KettleXulLoader in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapStepChooserDialog method open.

void open() throws KettleException {
    SwtDialog dialog;
    try {
        dialog = (SwtDialog) initXul(parent, new KettleXulLoader(), new SwtXulRunner()).getElementById(XUL_DIALOG_ID);
    } catch (XulException xulException) {
        throw new KettleException("Failed to initialize DataServiceRemapStepChooserDialog.", xulException);
    }
    dialog.show();
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) XulException(org.pentaho.ui.xul.XulException) SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Example 3 with KettleXulLoader

use of org.pentaho.di.ui.xul.KettleXulLoader in project pentaho-kettle by pentaho.

the class XulDatabaseDialog method createDialog.

@SuppressWarnings("deprecation")
private void createDialog() {
    XulDomContainer container = null;
    try {
        databaseDialogInstance = new DatabaseConnectionDialog();
        if (((Shell) this.parentShell).getText().contains("Metadata Editor")) {
            databaseDialogInstance.registerClass(EXTENDED_WIDGET_ID, PMD_WIDGET_CLASSNAME);
            databaseDialogInstance.registerClass(EXTENDED_MENULIST_WIDGET_ID, PMD_MENULIST_WIDGET_CLASSNAME);
        } else {
            databaseDialogInstance.registerClass(EXTENDED_WIDGET_ID, EXTENDED_WIDGET_CLASSNAME);
            databaseDialogInstance.registerClass(EXTENDED_MENULIST_WIDGET_ID, EXTENDED_MENULIST_WIDGET_CLASSNAME);
        }
        /*
       * Attention: onload: loadConnectionData() is called here the first time, see below for second time
       */
        container = databaseDialogInstance.getSwtInstance(new KettleXulLoader(), parentShell);
        container.addEventHandler(EVENT_ID, DataOverrideHandler.class.getName());
        SpoonPluginManager.getInstance().applyPluginsForContainer("connection_dialog", container);
        dataHandler = (DataOverrideHandler) container.getEventHandler(EVENT_ID);
        if (databaseMeta != null) {
            dataHandler.setData(databaseMeta);
        }
        dataHandler.setDatabases(databases);
        dataHandler.getControls();
    } catch (XulException e) {
        new ErrorDialog(parentShell, BaseMessages.getString(PKG, "XulDatabaseDialog.Error.Title"), BaseMessages.getString(PKG, "XulDatabaseDialog.Error.HandleXul"), e);
        return;
    }
    try {
        // Inject the button panel that contains the "Feature List" and "Explore" buttons
        XulComponent boxElement = container.getDocumentRoot().getElementById(FRAGMENT_ID);
        XulComponent parentElement = boxElement.getParent();
        ResourceBundle res = null;
        try {
            res = GlobalMessages.getBundle(MESSAGES);
        } catch (MissingResourceException e) {
            log.logError(BaseMessages.getString(PKG, "XulDatabaseDialog.Error.ResourcesNotFound.Title"), e.getMessage(), e);
        }
        XulDomContainer fragmentContainer = null;
        String pkg = getClass().getPackage().getName().replace('.', '/');
        // to check for it here.
        if (res != null) {
            fragmentContainer = container.loadFragment(pkg.concat(DIALOG_FRAGMENT_FILE), res);
        } else {
            fragmentContainer = container.loadFragment(pkg.concat(DIALOG_FRAGMENT_FILE));
        }
        XulComponent newBox = fragmentContainer.getDocumentRoot().getFirstChild();
        parentElement.replaceChild(boxElement, newBox);
    } catch (Exception e) {
        new ErrorDialog(parentShell, BaseMessages.getString(PKG, "XulDatabaseDialog.Error.Title"), BaseMessages.getString(PKG, "XulDatabaseDialog.Error.HandleXul"), e);
        return;
    }
    try {
        xulDialogComponent = (XulDialog) container.getDocumentRoot().getRootElement();
        parentShell.addDisposeListener(new DisposeListener() {

            public void widgetDisposed(DisposeEvent arg0) {
                xulDialogComponent.hide();
            }
        });
    } catch (Exception e) {
        new ErrorDialog(parentShell, BaseMessages.getString(PKG, "XulDatabaseDialog.Error.Title"), BaseMessages.getString(PKG, "XulDatabaseDialog.Error.Dialog"), e);
        return;
    }
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) MissingResourceException(java.util.MissingResourceException) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseConnectionDialog(org.pentaho.ui.database.DatabaseConnectionDialog) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) DisposeEvent(org.eclipse.swt.events.DisposeEvent) XulException(org.pentaho.ui.xul.XulException) MissingResourceException(java.util.MissingResourceException) XulException(org.pentaho.ui.xul.XulException) ResourceBundle(java.util.ResourceBundle) XulComponent(org.pentaho.ui.xul.XulComponent)

Example 4 with KettleXulLoader

use of org.pentaho.di.ui.xul.KettleXulLoader in project pentaho-kettle by pentaho.

the class XulPreviewRowsDialog method open.

public void open() {
    try {
        KettleXulLoader theLoader = new KettleXulLoader();
        theLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
        theLoader.setOuterContext(this.shell);
        this.container = theLoader.loadXul(XUL);
        this.controller = new XulPreviewRowsController(this.shell, this.databaseMeta, this.schema, this.table, this.limit);
        this.container.addEventHandler(this.controller);
        this.runner = new SwtXulRunner();
        this.runner.addContainer(this.container);
        this.runner.initialize();
        XulDialog thePreviewDialog = (XulDialog) this.container.getDocumentRoot().getElementById("previewRowsDialog");
        thePreviewDialog.show();
    } catch (Exception e) {
        logger.info(e);
    }
}
Also used : XulDialog(org.pentaho.ui.xul.containers.XulDialog) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Example 5 with KettleXulLoader

use of org.pentaho.di.ui.xul.KettleXulLoader in project pentaho-kettle by pentaho.

the class FileOverwriteDialogController method getInstance.

public static FileOverwriteDialogController getInstance(Shell shell, List<UIRepositoryObject> objects) {
    try {
        KettleXulLoader swtLoader = new KettleXulLoader();
        swtLoader.setOuterContext(shell);
        swtLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
        XulDomContainer container = swtLoader.loadXul("org/pentaho/di/ui/repository/repositoryexplorer/xul/file-overwrite-dialog.xul", resourceBundle);
        final XulRunner runner = new SwtXulRunner();
        runner.addContainer(container);
        FileOverwriteDialogController dialogController = new FileOverwriteDialogController(container, objects);
        container.addEventHandler(dialogController);
        runner.initialize();
        return dialogController;
    } catch (Exception e) {
        return null;
    }
}
Also used : KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) XulDomContainer(org.pentaho.ui.xul.XulDomContainer) XulRunner(org.pentaho.ui.xul.XulRunner) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Aggregations

KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)19 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)11 ResourceBundle (java.util.ResourceBundle)9 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)9 SwtXulRunner (org.pentaho.ui.xul.swt.SwtXulRunner)9 ToolBar (org.eclipse.swt.widgets.ToolBar)8 KettleException (org.pentaho.di.core.exception.KettleException)7 XulLoader (org.pentaho.ui.xul.XulLoader)7 XulSpoonResourceBundle (org.pentaho.di.ui.spoon.XulSpoonResourceBundle)5 XulException (org.pentaho.ui.xul.XulException)5 SwtDialog (org.pentaho.ui.xul.swt.tags.SwtDialog)4 KettleValueException (org.pentaho.di.core.exception.KettleValueException)3 XulDialog (org.pentaho.ui.xul.containers.XulDialog)3 FormData (org.eclipse.swt.layout.FormData)2 File (java.io.File)1 MalformedURLException (java.net.MalformedURLException)1 MissingResourceException (java.util.MissingResourceException)1 FileObject (org.apache.commons.vfs2.FileObject)1 FileSystemException (org.apache.commons.vfs2.FileSystemException)1 SWTException (org.eclipse.swt.SWTException)1