Search in sources :

Example 51 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class PGPDecryptStreamDialog method get.

private void get() {
    if (!gotPreviousFields) {
        try {
            String fieldvalue = wStreamFieldName.getText();
            String passphrasefieldvalue = wPassphraseFieldName.getText();
            wStreamFieldName.removeAll();
            wPassphraseFieldName.removeAll();
            RowMetaInterface r = transMeta.getPrevStepFields(stepname);
            if (r != null) {
                String[] fields = r.getFieldNames();
                wStreamFieldName.setItems(fields);
                wPassphraseFieldName.setItems(fields);
            }
            if (fieldvalue != null) {
                wStreamFieldName.setText(fieldvalue);
            }
            if (passphrasefieldvalue != null) {
                wPassphraseFieldName.setText(passphrasefieldvalue);
            }
            gotPreviousFields = true;
        } catch (KettleException ke) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogMessage"), ke);
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface)

Example 52 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class PropertyInputDialog method getSections.

private void getSections() {
    Wini wini = new Wini();
    PropertyInputMeta meta = new PropertyInputMeta();
    try {
        getInfo(meta);
        FileInputList fileInputList = meta.getFiles(transMeta);
        if (fileInputList.nrOfFiles() > 0) {
            // Check the first file
            if (fileInputList.getFile(0).exists()) {
                // Open the file (only first file) in readOnly ...
                // 
                wini = new Wini(KettleVFS.getInputStream(fileInputList.getFile(0)));
                Iterator<String> itSection = wini.keySet().iterator();
                String[] sectionsList = new String[wini.keySet().size()];
                int i = 0;
                while (itSection.hasNext()) {
                    sectionsList[i] = itSection.next().toString();
                    i++;
                }
                Const.sortStrings(sectionsList);
                EnterSelectionDialog dialog = new EnterSelectionDialog(shell, sectionsList, BaseMessages.getString(PKG, "PropertyInputDialog.Dialog.SelectASection.Title"), BaseMessages.getString(PKG, "PropertyInputDialog.Dialog.SelectASection.Message"));
                String sectionname = dialog.open();
                if (sectionname != null) {
                    wSection.setText(sectionname);
                }
            } else {
                // The file not exists !
                throw new KettleException(BaseMessages.getString(PKG, "PropertyInputDialog.Exception.FileDoesNotExist", KettleVFS.getFilename(fileInputList.getFile(0))));
            }
        } else {
            // No file specified
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setMessage(BaseMessages.getString(PKG, "PropertyInputDialog.FilesMissing.DialogMessage"));
            mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
            mb.open();
        }
    } catch (Throwable e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PropertyInputDialog.UnableToGetListOfSections.Title"), BaseMessages.getString(PKG, "PropertyInputDialog.UnableToGetListOfSections.Message"), e);
    } finally {
        if (wini != null) {
            wini.clear();
        }
        wini = null;
        meta = null;
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) Wini(org.ini4j.Wini) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) PropertyInputMeta(org.pentaho.di.trans.steps.propertyinput.PropertyInputMeta) FileInputList(org.pentaho.di.core.fileinput.FileInputList) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 53 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class PropertyInputDialog method setFileField.

private void setFileField() {
    try {
        String value = wFilenameField.getText();
        wFilenameField.removeAll();
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        if (r != null) {
            r.getFieldNames();
            for (int i = 0; i < r.getFieldNames().length; i++) {
                wFilenameField.add(r.getFieldNames()[i]);
            }
        }
        if (value != null) {
            wFilenameField.setText(value);
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PropertyInputDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PropertyInputDialog.FailedToGetFields.DialogMessage"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 54 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class RowGeneratorDialog method ok.

private void ok() {
    if (Utils.isEmpty(wStepname.getText())) {
        return;
    }
    // return value
    stepname = wStepname.getText();
    try {
        // to see if there is an exception
        getInfo(new RowGeneratorMeta());
        // to put the content on the input structure for real if all is well.
        getInfo(input);
        dispose();
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Title"), BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Message"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowGeneratorMeta(org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta)

Example 55 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class RowGeneratorDialog method preview.

/**
 * Preview the data generated by this step. This generates a transformation using this step & a dummy and previews it.
 */
private void preview() {
    RowGeneratorMeta oneMeta = new RowGeneratorMeta();
    try {
        getInfo(oneMeta);
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Title"), BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Message"), e);
        return;
    }
    TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
    EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "System.Dialog.EnterPreviewSize.Title"), BaseMessages.getString(PKG, "System.Dialog.EnterPreviewSize.Message"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
        TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
        progressDialog.open();
        Trans trans = progressDialog.getTrans();
        String loggingText = progressDialog.getLoggingText();
        if (!progressDialog.isCancelled()) {
            if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
                EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
                etd.setReadOnly();
                etd.open();
            }
        }
        PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
        prd.open();
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TransPreviewProgressDialog(org.pentaho.di.ui.trans.dialog.TransPreviewProgressDialog) TransMeta(org.pentaho.di.trans.TransMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) EnterTextDialog(org.pentaho.di.ui.core.dialog.EnterTextDialog) PreviewRowsDialog(org.pentaho.di.ui.core.dialog.PreviewRowsDialog) EnterNumberDialog(org.pentaho.di.ui.core.dialog.EnterNumberDialog) RowGeneratorMeta(org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta) Trans(org.pentaho.di.trans.Trans) Point(org.eclipse.swt.graphics.Point)

Aggregations

ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)527 KettleException (org.pentaho.di.core.exception.KettleException)440 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)178 MessageBox (org.eclipse.swt.widgets.MessageBox)118 TableItem (org.eclipse.swt.widgets.TableItem)97 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)76 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)63 TransMeta (org.pentaho.di.trans.TransMeta)48 Shell (org.eclipse.swt.widgets.Shell)46 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)46 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)44 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)44 ArrayList (java.util.ArrayList)43 TableItemInsertListener (org.pentaho.di.ui.trans.step.TableItemInsertListener)43 EnterSelectionDialog (org.pentaho.di.ui.core.dialog.EnterSelectionDialog)42 SelectionEvent (org.eclipse.swt.events.SelectionEvent)40 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)39 StepMeta (org.pentaho.di.trans.step.StepMeta)38 FormData (org.eclipse.swt.layout.FormData)37 FormLayout (org.eclipse.swt.layout.FormLayout)37