Search in sources :

Example 31 with XulException

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

the class FragmentHandlerTest method testLoadDatabaseOptionsFragmentWithException.

@Test(expected = XulException.class)
public void testLoadDatabaseOptionsFragmentWithException() throws Exception {
    XulComponent component = mock(XulComponent.class);
    XulComponent parent = mock(XulComponent.class);
    when(component.getParent()).thenReturn(parent);
    when(document.getElementById("database-options-box")).thenReturn(component);
    when(xulDomContainer.loadFragment(anyString(), any(Object.class))).thenThrow(new XulException());
    fragmentHandler.loadDatabaseOptionsFragment(null);
}
Also used : XulException(org.pentaho.ui.xul.XulException) XulComponent(org.pentaho.ui.xul.XulComponent) Test(org.junit.Test)

Example 32 with XulException

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

the class FragmentHandlerTest method testShowMessage.

@Test
public void testShowMessage() throws Exception {
    XulMessageBox messageBox = mock(XulMessageBox.class);
    when(document.createElement("messagebox")).thenReturn(messageBox);
    fragmentHandler.showMessage(null);
    // Generate exception, should see a message in standard output
    when(document.createElement("messagebox")).thenThrow(new XulException());
    fragmentHandler.showMessage("");
}
Also used : XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) XulException(org.pentaho.ui.xul.XulException) Test(org.junit.Test)

Example 33 with XulException

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

the class AuthProviderController method setNewOverlay.

public void setNewOverlay(AuthProvider provider) throws XulException {
    if (provider == null) {
        provider = new NoAuthAuthProvider(bf);
    }
    if (this.activeProvider != null) {
        getXulDomContainer().removeOverlay(activeProvider.getOverlay());
    }
    getXulDomContainer().loadOverlay(provider.getOverlay());
    if (model.getSelectedItem() != null) {
        AuthProvider current = (AuthProvider) model.getSelectedItem().getItem();
        if (current.getOverlay().equalsIgnoreCase(provider.getOverlay())) {
            try {
                current.bind();
            } catch (Exception e) {
                log.logError(resourceBundle.getString("error.on_bind"), e);
            }
        }
    }
    this.activeProvider = provider;
}
Also used : NoAuthAuthProvider(org.pentaho.di.ui.core.auth.model.NoAuthAuthProvider) KerberosAuthProvider(org.pentaho.di.ui.core.auth.model.KerberosAuthProvider) AuthProvider(org.pentaho.di.ui.core.auth.model.AuthProvider) NoAuthAuthProvider(org.pentaho.di.ui.core.auth.model.NoAuthAuthProvider) BasicAuthProvider(org.pentaho.di.ui.core.auth.model.BasicAuthProvider) XulException(org.pentaho.ui.xul.XulException) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 34 with XulException

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

the class StarModelerPerspective method onFileClose.

public boolean onFileClose() {
    int idx = tabbox.getSelectedIndex();
    if (idx == -1 || idx >= tabbox.getTabs().getChildNodes().size()) {
        return false;
    }
    try {
        if (onTabClose(idx)) {
            XulComponent panel = panels.getChildNodes().get(idx);
            XulComponent tab = tabs.getChildNodes().get(idx);
            panels.removeChild(panel);
            tabs.removeChild(tab);
            return true;
        }
    } catch (XulException e) {
        e.printStackTrace();
    }
    return false;
}
Also used : XulException(org.pentaho.ui.xul.XulException) XulComponent(org.pentaho.ui.xul.XulComponent)

Example 35 with XulException

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

the class SpoonPerspectiveManager method unloadPerspective.

private void unloadPerspective(SpoonPerspective per) {
    per.setActive(false);
    List<XulOverlay> overlays = per.getOverlays();
    if (overlays != null) {
        for (XulOverlay overlay : overlays) {
            try {
                domContainer.removeOverlay(overlay.getOverlayUri());
            } catch (XulException e) {
                log.logError("Error unload perspective", e);
            }
        }
    }
    getSpoon().enableMenus();
}
Also used : XulOverlay(org.pentaho.ui.xul.XulOverlay) XulException(org.pentaho.ui.xul.XulException)

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