Search in sources :

Example 6 with SwtXulRunner

use of org.pentaho.ui.xul.swt.SwtXulRunner in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceRemapConfirmationDialog method open.

void open() throws KettleException {
    Document xulDocument;
    try {
        xulDocument = initXul(parent, new KettleXulLoader(), new SwtXulRunner());
    } catch (XulException e) {
        throw new KettleException("Failed to create data service remap confirmation dialog", e);
    }
    ((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 7 with SwtXulRunner

use of org.pentaho.ui.xul.swt.SwtXulRunner in project pdi-dataservice-server-plugin by pentaho.

the class DataServiceTestDialog method initXul.

private Document initXul(Composite parent) throws KettleException {
    try {
        SwtXulLoader swtLoader = new KettleXulLoader();
        swtLoader.setOuterContext(parent);
        swtLoader.registerClassLoader(getClass().getClassLoader());
        XulDomContainer container = swtLoader.loadXul(XUL_PATH, resourceBundle);
        container.addEventHandler(dataServiceTestController);
        final XulRunner runner = new SwtXulRunner();
        runner.addContainer(container);
        runner.initialize();
        return container.getDocumentRoot();
    } catch (XulException xulException) {
        throw new KettleException("Failed to initialize DataServicesTestDialog.", xulException);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) XulException(org.pentaho.ui.xul.XulException) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) SwtXulLoader(org.pentaho.ui.xul.swt.SwtXulLoader) 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)

Example 8 with SwtXulRunner

use of org.pentaho.ui.xul.swt.SwtXulRunner in project pentaho-kettle by pentaho.

the class PurRepositoryDialog method open.

public RepositoryMeta open(final MODE mode) {
    try {
        SwtXulLoader swtLoader = new SwtXulLoader();
        swtLoader.setOuterContext(parent);
        swtLoader.registerClassLoader(getClass().getClassLoader());
        container = // $NON-NLS-1$
        swtLoader.loadXul("org/pentaho/di/ui/repository/pur/xul/pur-repository-config-dialog.xul", resourceBundle);
        final XulRunner runner = new SwtXulRunner();
        runner.addContainer(container);
        parent.addDisposeListener(new DisposeListener() {

            public void widgetDisposed(DisposeEvent arg0) {
                hide();
            }
        });
        repositoryConfigController.setMessages(resourceBundle);
        repositoryConfigController.setRepositoryMeta(repositoryMeta);
        repositoryConfigController.setCallback(new IRepositoryConfigDialogCallback() {

            public void onSuccess(PurRepositoryMeta meta) {
                // If repository does not have a name then send back a null repository meta
                if (meta.getName() != null) {
                    // already exist
                    if (mode == MODE.ADD) {
                        if (masterRepositoriesMeta.searchRepository(meta.getName()) == null) {
                            repositoryMeta = meta;
                            hide();
                        } else {
                            displayRepositoryAlreadyExistMessage(meta.getName());
                        }
                    } else {
                        if (masterRepositoryName.equals(meta.getName())) {
                            repositoryMeta = meta;
                            hide();
                        } else if (masterRepositoriesMeta.searchRepository(meta.getName()) == null) {
                            repositoryMeta = meta;
                            hide();
                        } else {
                            displayRepositoryAlreadyExistMessage(meta.getName());
                        }
                    }
                }
            }

            public void onError(Throwable t) {
                SpoonFactory.getInstance().messageBox(t.getLocalizedMessage(), resourceBundle.getString("RepositoryConfigDialog.InitializationFailed"), false, // $NON-NLS-1$
                Const.ERROR);
                // $NON-NLS-1$
                log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), t);
            }

            public void onCancel() {
                repositoryMeta = null;
                hide();
            }
        });
        container.addEventHandler(repositoryConfigController);
        try {
            runner.initialize();
            show();
        } catch (XulException e) {
            SpoonFactory.getInstance().messageBox(e.getLocalizedMessage(), resourceBundle.getString("RepositoryConfigDialog.InitializationFailed"), false, // $NON-NLS-1$
            Const.ERROR);
            // $NON-NLS-1$
            log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), e);
        }
    } catch (XulException e) {
        // $NON-NLS-1$
        log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), e);
    }
    return repositoryMeta;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) XulException(org.pentaho.ui.xul.XulException) PurRepositoryMeta(org.pentaho.di.repository.pur.PurRepositoryMeta) SwtXulLoader(org.pentaho.ui.xul.swt.SwtXulLoader) DisposeEvent(org.eclipse.swt.events.DisposeEvent) XulRunner(org.pentaho.ui.xul.XulRunner) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Example 9 with SwtXulRunner

use of org.pentaho.ui.xul.swt.SwtXulRunner in project pentaho-kettle by pentaho.

the class XulDatabaseExplorerDialog method open.

public boolean open() {
    try {
        KettleXulLoader theLoader = new KettleXulLoader();
        theLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
        theLoader.setSettingsManager(new DefaultSettingsManager(new File(Const.getKettleDirectory() + Const.FILE_SEPARATOR + "xulSettings.properties")));
        theLoader.setOuterContext(this.shell);
        this.container = theLoader.loadXul(XUL, new XulDatabaseExplorerResourceBundle());
        XulDialog theExplorerDialog = (XulDialog) this.container.getDocumentRoot().getElementById("databaseExplorerDialog");
        SpoonPluginManager.getInstance().applyPluginsForContainer("database_dialog", container);
        this.controller = new XulDatabaseExplorerController(this.shell, this.databaseMeta, this.databases, look);
        this.container.addEventHandler(this.controller);
        this.runner = new SwtXulRunner();
        this.runner.addContainer(this.container);
        this.runner.initialize();
        this.controller.setSelectedSchemaAndTable(schemaName, selectedTable);
        // show dialog if connection is success only.
        if (controller.getActionStatus() == UiPostActionStatus.OK) {
            theExplorerDialog.show();
        }
    } catch (Exception e) {
        LogChannel.GENERAL.logError("Error exploring database", e);
    }
    return this.controller.getSelectedTable() != null;
}
Also used : XulDialog(org.pentaho.ui.xul.containers.XulDialog) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) File(java.io.File) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner) DefaultSettingsManager(org.pentaho.ui.xul.impl.DefaultSettingsManager)

Example 10 with SwtXulRunner

use of org.pentaho.ui.xul.swt.SwtXulRunner in project pentaho-kettle by pentaho.

the class XulStepFieldsDialog method open.

public void open(boolean isAcceptButtonHidden) {
    try {
        KettleXulLoader theLoader = new KettleXulLoader();
        theLoader.setOuterContext(this.shell);
        theLoader.setSettingsManager(XulSpoonSettingsManager.getInstance());
        this.container = theLoader.loadXul(XUL);
        this.controller = new XulStepFieldsController(this.shell, this.databaseMeta, this.schemaTableCombo, this.rowMeta);
        this.controller.setShowAcceptButton(isAcceptButtonHidden);
        this.container.addEventHandler(this.controller);
        this.runner = new SwtXulRunner();
        this.runner.addContainer(this.container);
        this.runner.initialize();
        XulDialog thePreviewDialog = (XulDialog) this.container.getDocumentRoot().getElementById("stepFieldsDialog");
        thePreviewDialog.show();
        ((SwtDialog) thePreviewDialog).dispose();
    } catch (Exception e) {
        logger.info(e);
    }
}
Also used : SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) XulDialog(org.pentaho.ui.xul.containers.XulDialog) KettleXulLoader(org.pentaho.di.ui.xul.KettleXulLoader) SwtXulRunner(org.pentaho.ui.xul.swt.SwtXulRunner)

Aggregations

SwtXulRunner (org.pentaho.ui.xul.swt.SwtXulRunner)10 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)9 XulException (org.pentaho.ui.xul.XulException)5 KettleException (org.pentaho.di.core.exception.KettleException)4 SwtDialog (org.pentaho.ui.xul.swt.tags.SwtDialog)4 XulRunner (org.pentaho.ui.xul.XulRunner)3 XulDialog (org.pentaho.ui.xul.containers.XulDialog)3 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)2 Document (org.pentaho.ui.xul.dom.Document)2 SwtXulLoader (org.pentaho.ui.xul.swt.SwtXulLoader)2 File (java.io.File)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 PurRepositoryMeta (org.pentaho.di.repository.pur.PurRepositoryMeta)1 DefaultSettingsManager (org.pentaho.ui.xul.impl.DefaultSettingsManager)1 SwtBindingFactory (org.pentaho.ui.xul.swt.SwtBindingFactory)1