Search in sources :

Example 11 with XulException

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

the class StarModelerPerspective method createTab.

public XulTabAndPanel createTab() {
    try {
        XulTab tab = (XulTab) document.createElement("tab");
        if (name != null) {
            tab.setLabel(name);
        }
        XulTabpanel panel = (XulTabpanel) document.createElement("tabpanel");
        panel.setSpacing(0);
        panel.setPadding(0);
        tabs.addChild(tab);
        panels.addChild(panel);
        tabbox.setSelectedIndex(panels.getChildNodes().indexOf(panel));
        return new XulTabAndPanel(tab, panel);
    } catch (XulException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : XulTabpanel(org.pentaho.ui.xul.components.XulTabpanel) XulException(org.pentaho.ui.xul.XulException) XulTab(org.pentaho.ui.xul.components.XulTab)

Example 12 with XulException

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

the class BrowseController method renameRepositoryObject.

protected void renameRepositoryObject(final UIRepositoryObject object) throws XulException {
    XulPromptBox prompt = promptForName(object);
    prompt.addDialogCallback(new XulDialogCallback<String>() {

        public void onClose(XulComponent component, Status status, String value) {
            if (status == Status.ACCEPT) {
                try {
                    object.setName(value);
                } catch (Exception e) {
                    if (mainController == null || !mainController.handleLostRepository(e)) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }

        public void onError(XulComponent component, Throwable err) {
            throw new RuntimeException(err);
        }
    });
    prompt.open();
}
Also used : XulPromptBox(org.pentaho.ui.xul.components.XulPromptBox) XulComponent(org.pentaho.ui.xul.XulComponent) XulException(org.pentaho.ui.xul.XulException) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException) UIObjectCreationException(org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException) KettleException(org.pentaho.di.core.exception.KettleException)

Example 13 with XulException

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

the class LazilyInitializedController method showErrorDialog.

private void showErrorDialog(final Exception e) {
    XulMessageBox messageBox = null;
    try {
        messageBox = (XulMessageBox) document.createElement("messagebox");
    } catch (XulException xe) {
        throw new RuntimeException(xe);
    }
    messageBox.setTitle(BaseMessages.getString(PKG, "Dialog.Error"));
    messageBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
    if (e != null) {
        messageBox.setMessage(BaseMessages.getString(PKG, "LazilyInitializedController.Message.UnableToInitWithParam", e.getLocalizedMessage()));
    } else {
        messageBox.setMessage(BaseMessages.getString(PKG, "LazilyInitializedController.Message.UnableToInit"));
    }
    messageBox.open();
}
Also used : XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) XulException(org.pentaho.ui.xul.XulException)

Example 14 with XulException

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

the class AbstractRepositoryExplorerUISupport method initControllers.

public void initControllers(Repository rep) throws ControllerInitializationException {
    for (String name : controllerNames) {
        try {
            IUISupportController controller = (IUISupportController) container.getEventHandler(name);
            controller.init(rep);
        } catch (XulException e) {
            throw new ControllerInitializationException(e);
        }
    }
}
Also used : ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException) XulException(org.pentaho.ui.xul.XulException) IUISupportController(org.pentaho.di.ui.repository.repositoryexplorer.IUISupportController)

Example 15 with XulException

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

the class RepositoriesController method login.

public void login() {
    if (loginModel.isValid() == false) {
        return;
    }
    KettleWaitBox box;
    try {
        box = (KettleWaitBox) document.createElement("iconwaitbox");
        box.setIndeterminate(true);
        box.setCanCancel(false);
        box.setIcon("ui/images/kettle_logo_small.svg");
        box.setTitle(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Wait.Title"));
        box.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Wait.Message"));
        final Shell loginShell = (Shell) loginDialog.getRootObject();
        final Display display = loginShell.getDisplay();
        box.setDialogParent(loginShell);
        box.setRunnable(new WaitBoxRunnable(box) {

            @Override
            public void run() {
                try {
                    helper.loginToRepository();
                    waitBox.stop();
                    display.syncExec(new Runnable() {

                        public void run() {
                            loginDialog.hide();
                            okButton.setDisabled(false);
                            cancelButton.setDisabled(false);
                            if (helper.getConnectedRepository().getConnectMessage() != null) {
                                getMessageBox().setTitle(BaseMessages.getString(PKG, "ConnectMessageTitle"));
                                getMessageBox().setMessage(helper.getConnectedRepository().getConnectMessage());
                                getMessageBox().open();
                            }
                            getCallback().onSuccess(helper.getConnectedRepository());
                        }
                    });
                } catch (final Throwable th) {
                    waitBox.stop();
                    try {
                        display.syncExec(new Runnable() {

                            public void run() {
                                getCallback().onError(th);
                                okButton.setDisabled(false);
                                cancelButton.setDisabled(false);
                            }
                        });
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }

            @Override
            public void cancel() {
            }
        });
        okButton.setDisabled(true);
        cancelButton.setDisabled(true);
        box.start();
    } catch (XulException e1) {
        getCallback().onError(e1);
    }
}
Also used : WaitBoxRunnable(org.pentaho.ui.xul.components.WaitBoxRunnable) Shell(org.eclipse.swt.widgets.Shell) XulException(org.pentaho.ui.xul.XulException) WaitBoxRunnable(org.pentaho.ui.xul.components.WaitBoxRunnable) KettleWaitBox(org.pentaho.di.ui.xul.KettleWaitBox) XulException(org.pentaho.ui.xul.XulException) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException) Display(org.eclipse.swt.widgets.Display)

Aggregations

XulException (org.pentaho.ui.xul.XulException)60 KettleException (org.pentaho.di.core.exception.KettleException)20 Test (org.junit.Test)11 XulMessageBox (org.pentaho.ui.xul.components.XulMessageBox)10 XulComponent (org.pentaho.ui.xul.XulComponent)9 Shell (org.eclipse.swt.widgets.Shell)7 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)7 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)7 SwtXulRunner (org.pentaho.ui.xul.swt.SwtXulRunner)7 XulDomContainer (org.pentaho.ui.xul.XulDomContainer)6 SwtDialog (org.pentaho.ui.xul.swt.tags.SwtDialog)6 XulRunner (org.pentaho.ui.xul.XulRunner)5 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Document (org.pentaho.ui.xul.dom.Document)4 ResourceBundle (java.util.ResourceBundle)3 Mockito.doAnswer (org.mockito.Mockito.doAnswer)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3 Answer (org.mockito.stubbing.Answer)3 XulLoader (org.pentaho.ui.xul.XulLoader)3 SwtBindingFactory (org.pentaho.ui.xul.swt.SwtBindingFactory)3