Search in sources :

Example 96 with ErrorDialog

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

the class GetRepositoryNamesDialog method displaydirectoryList.

private void displaydirectoryList() {
    try {
        if (repository == null) {
            throw new KettleException(BaseMessages.getString(PKG, "GetRepositoryNames.Exception.NotConnectedToRepository"));
        }
        SelectDirectoryDialog sdd = new SelectDirectoryDialog(shell, SWT.NONE, repository);
        RepositoryDirectoryInterface rd = sdd.open();
        if (rd != null) {
            wDirectory.setText(rd.getPath());
        }
    } catch (Exception e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "GetRepositoryNames.ErrorGettingFolderds.DialogMessage"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SelectDirectoryDialog(org.pentaho.di.ui.repository.dialog.SelectDirectoryDialog) KettleException(org.pentaho.di.core.exception.KettleException)

Example 97 with ErrorDialog

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

the class ExcelWriterStepDialog method get.

private void get() {
    try {
        RowMetaInterface r = transMeta.getPrevStepFields(stepname);
        if (r != null) {
            TableItemInsertListener listener = new TableItemInsertListener() {

                @Override
                public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                    if (v.isNumber()) {
                        if (v.getLength() > 0) {
                            int le = v.getLength();
                            int pr = v.getPrecision();
                            if (v.getPrecision() <= 0) {
                                pr = 0;
                            }
                            String mask = "";
                            for (int m = 0; m < le - pr; m++) {
                                mask += "0";
                            }
                            if (pr > 0) {
                                mask += ".";
                            }
                            for (int m = 0; m < pr; m++) {
                                mask += "0";
                            }
                            tableItem.setText(3, mask);
                        }
                    }
                    return true;
                }
            };
            BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1, 5 }, new int[] { 2 }, 0, 0, listener);
        }
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) TableItem(org.eclipse.swt.widgets.TableItem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 98 with ErrorDialog

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

the class ExecSQLRowDialog method get.

private void get() {
    if (!gotPreviousFields) {
        gotPreviousFields = true;
        try {
            String sqlfield = wSQLFieldName.getText();
            wSQLFieldName.removeAll();
            RowMetaInterface r = transMeta.getPrevStepFields(stepname);
            if (r != null) {
                wSQLFieldName.removeAll();
                wSQLFieldName.setItems(r.getFieldNames());
            }
            if (sqlfield != null) {
                wSQLFieldName.setText(sqlfield);
            }
        } catch (KettleException ke) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "ExecSQLRowDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "ExecSQLRowDialog.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 99 with ErrorDialog

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

the class PaloCubeDeleteDialog method doSelectConnection.

private void doSelectConnection(boolean clearCurrentData) {
    try {
        if (clearCurrentData) {
            comboCubeName.removeAll();
        }
        if (comboCubeName.getItemCount() > 1) {
            return;
        }
        if (addConnectionLine.getText() != null) {
            DatabaseMeta dbMeta = DatabaseMeta.findDatabase(jobMeta.getDatabases(), addConnectionLine.getText());
            if (dbMeta != null) {
                PaloHelper helper = new PaloHelper(dbMeta, DefaultLogLevel.getLogLevel());
                helper.connect();
                List<String> cubes = helper.getCubesNames();
                Collections.sort(cubes, new PaloNameComparator());
                for (String cubename : cubes) {
                    if (comboCubeName.indexOf(cubename) == -1) {
                        comboCubeName.add(cubename);
                    }
                }
                helper.disconnect();
            }
        }
    } catch (Exception ex) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "PaloDimInputFlatDialog.RetreiveDimensionsErrorTitle"), BaseMessages.getString(PKG, "PaloDimInputFlatDialog.RetreiveDimensionsError"), ex);
    }
}
Also used : PaloHelper(org.pentaho.di.palo.core.PaloHelper) PaloNameComparator(org.pentaho.di.palo.core.PaloNameComparator) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta)

Example 100 with ErrorDialog

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

the class PaloCellOutputDialog method doGetFields.

private void doGetFields() {
    try {
        List<String> cubeDimensions = null;
        if (comboCube.getText() != null && comboCube.getText() != "") {
            if (addConnectionLine.getText() != null) {
                DatabaseMeta dbMeta = transMeta.findDatabase(addConnectionLine.getText());
                if (dbMeta != null) {
                    PaloCellOutputData data = new PaloCellOutputData(dbMeta);
                    data.helper.connect();
                    cubeDimensions = data.helper.getCubeDimensions(comboCube.getText());
                    data.helper.disconnect();
                }
            }
            tableViewFields.table.removeAll();
            for (int i = 0; i < cubeDimensions.size(); i++) {
                final TableItem item = new TableItem(tableViewFields.table, SWT.NONE);
                item.setText(1, cubeDimensions.get(i));
            // item.setText(3, "String");
            }
            final TableItem item = new TableItem(tableViewFields.table, SWT.NONE);
            item.setText(1, "Cube Measure");
            item.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN));
            tableViewFields.removeEmptyRows();
            tableViewFields.setRowNums();
            tableViewFields.optWidth(true);
            tableViewFields.setReadonly(true);
        } else {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"), new Exception(BaseMessages.getString(PKG, "PaloCellOutputDialog.SelectCubeFirstError")));
        }
        this.fillPreviousFieldTableViewColumn();
    } catch (KettleException ke) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"), BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"), ke);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PaloCellOutputData(org.pentaho.di.trans.steps.palo.celloutput.PaloCellOutputData) TableItem(org.eclipse.swt.widgets.TableItem) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) KettleException(org.pentaho.di.core.exception.KettleException)

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