Search in sources :

Example 6 with SwtDialog

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

the class DriverDetailsDialogControllerTest method testShowHelpUsesDialogShell.

@Test
public void testShowHelpUsesDialogShell() throws Exception {
    doCallRealMethod().when(controller).showHelp();
    SwtDialog dialog = mock(SwtDialog.class);
    doReturn(dialog).when(controller).getDialog();
    IllegalStateException runtimeException = new IllegalStateException();
    doThrow(runtimeException).when(dialog).getShell();
    try {
        controller.showHelp();
    } catch (Exception e) {
        assertThat(runtimeException, is(sameInstance(e)));
    }
    verify(dialog).getShell();
}
Also used : SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog) NotDirectoryException(java.nio.file.NotDirectoryException) FileNotFoundException(java.io.FileNotFoundException) AccessDeniedException(java.nio.file.AccessDeniedException) Test(org.junit.Test)

Example 7 with SwtDialog

use of org.pentaho.ui.xul.swt.tags.SwtDialog 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)

Example 8 with SwtDialog

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

the class KettleDialog method hide.

@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();
}
Also used : WindowProperty(org.pentaho.di.ui.core.gui.WindowProperty) SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog)

Example 9 with SwtDialog

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

the class RepositoryExplorer method dispose.

public void dispose() {
    SwtDialog dialog = (SwtDialog) container.getDocumentRoot().getElementById("repository-explorer-dialog");
    dialog.dispose();
    initialized = false;
}
Also used : SwtDialog(org.pentaho.ui.xul.swt.tags.SwtDialog)

Example 10 with SwtDialog

use of org.pentaho.ui.xul.swt.tags.SwtDialog 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)

Aggregations

SwtDialog (org.pentaho.ui.xul.swt.tags.SwtDialog)19 Test (org.junit.Test)13 XulException (org.pentaho.ui.xul.XulException)7 KettleException (org.pentaho.di.core.exception.KettleException)6 Document (org.pentaho.ui.xul.dom.Document)5 Shell (org.eclipse.swt.widgets.Shell)4 KettleXulLoader (org.pentaho.di.ui.xul.KettleXulLoader)4 SwtXulRunner (org.pentaho.ui.xul.swt.SwtXulRunner)4 Mockito.doAnswer (org.mockito.Mockito.doAnswer)3 InvocationOnMock (org.mockito.invocation.InvocationOnMock)3 Answer (org.mockito.stubbing.Answer)3 DataServiceDelegate (org.pentaho.di.trans.dataservice.ui.DataServiceDelegate)3 XulLoader (org.pentaho.ui.xul.XulLoader)3 XulRunner (org.pentaho.ui.xul.XulRunner)3 FileNotFoundException (java.io.FileNotFoundException)1 AccessDeniedException (java.nio.file.AccessDeniedException)1 NotDirectoryException (java.nio.file.NotDirectoryException)1 Matchers.anyString (org.mockito.Matchers.anyString)1 DataServiceMeta (org.pentaho.di.trans.dataservice.DataServiceMeta)1 DataServiceAlreadyExistsException (org.pentaho.di.trans.dataservice.serialization.DataServiceAlreadyExistsException)1