Search in sources :

Example 11 with ProgressMonitorAdapter

use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.

the class GetSQLProgressDialog method open.

public List<SQLStatement> open() {
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                stats = transMeta.getSQLStatements(new ProgressMonitorAdapter(monitor));
            } catch (KettleException e) {
                throw new InvocationTargetException(e, BaseMessages.getString(PKG, "GetSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception", e.getMessage()));
            }
        }
    };
    try {
        ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
        pmd.run(false, false, op);
    } catch (InvocationTargetException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Title"), BaseMessages.getString(PKG, "GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Message"), e);
        stats = null;
    } catch (InterruptedException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Title"), BaseMessages.getString(PKG, "GetSQLProgressDialog.Dialog.UnableToGenerateSQL.Message"), e);
        stats = null;
    }
    return stats;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ProgressMonitorAdapter(org.pentaho.di.core.ProgressMonitorAdapter) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress)

Example 12 with ProgressMonitorAdapter

use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.

the class SearchFieldsProgressDialog method run.

public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
    int size = transMeta.findNrPrevSteps(stepInfo);
    try {
        if (before) {
            monitor.beginTask(BaseMessages.getString(PKG, "SearchFieldsProgressDialog.Dialog.SearchInputFields.Message"), // Searching
            size);
            // for
            // input
            // fields...
            fields = transMeta.getPrevStepFields(stepInfo, new ProgressMonitorAdapter(monitor));
        } else {
            monitor.beginTask(BaseMessages.getString(PKG, "SearchFieldsProgressDialog.Dialog.SearchOutputFields.Message"), // Searching
            size);
            // for
            // output
            // fields...
            fields = transMeta.getStepFields(stepInfo, new ProgressMonitorAdapter(monitor));
        }
    } catch (KettleStepException kse) {
        throw new InvocationTargetException(kse, BaseMessages.getString(PKG, "SearchFieldsProgressDialog.Log.UnableToGetFields", stepInfo.toString(), kse.getMessage()));
    }
    monitor.done();
}
Also used : KettleStepException(org.pentaho.di.core.exception.KettleStepException) ProgressMonitorAdapter(org.pentaho.di.core.ProgressMonitorAdapter) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 13 with ProgressMonitorAdapter

use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.

the class RepositoryExportProgressDialog method open.

public boolean open() {
    boolean retval = true;
    final List<ExportFeedback> list = new ArrayList<ExportFeedback>();
    IRepositoryExporter tmpExporter = null;
    try {
        tmpExporter = rep.getExporter();
    } catch (KettleException e) {
        log.logError(RepositoryExportProgressDialog.class.toString(), "Error creating repository: " + e.toString());
        log.logError(Const.getStackTracker(e));
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExportDialog.ErrorExport.Title"), BaseMessages.getString(PKG, "RepositoryExportDialog.ErrorExport.Message"), e);
        return false;
    }
    final IRepositoryExporter exporter = tmpExporter;
    // this hack is only to support dog-nail build process for <...>
    // and keep base interfaces without changes - getExporter should
    // directly return IRepositoryExporterFeedback.
    final boolean isFeedback = (exporter instanceof IRepositoryExporterFeedback) ? true : false;
    IRunnableWithProgress op = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            try {
                exporter.setImportRulesToValidate(importRules);
                ProgressMonitorAdapter pMonitor = new ProgressMonitorAdapter(monitor);
                if (isFeedback) {
                    IRepositoryExporterFeedback fExporter = IRepositoryExporterFeedback.class.cast(exporter);
                    List<ExportFeedback> ret = fExporter.exportAllObjectsWithFeedback(pMonitor, filename, dir, "all");
                    list.addAll(ret);
                } else {
                    exporter.exportAllObjects(pMonitor, filename, dir, "all");
                }
            } catch (KettleException e) {
                throw new InvocationTargetException(e, BaseMessages.getString(PKG, "RepositoryExportDialog.Error.CreateUpdate", Const.getStackTracker(e)));
            }
        }
    };
    try {
        ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
        pmd.run(true, true, op);
        if (!pmd.getProgressMonitor().isCanceled() && isFeedback) {
            // show some results here.
            IRepositoryExporterFeedback fExporter = IRepositoryExporterFeedback.class.cast(exporter);
            showExportResultStatus(list, fExporter.isRulesViolation());
        }
    } catch (InvocationTargetException e) {
        log.logError(RepositoryExportProgressDialog.class.toString(), "Error creating repository: " + e.toString());
        log.logError(Const.getStackTracker(e));
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExportDialog.ErrorExport.Title"), BaseMessages.getString(PKG, "RepositoryExportDialog.ErrorExport.Message"), e);
        retval = false;
    } catch (InterruptedException e) {
        log.logError(RepositoryExportProgressDialog.class.toString(), "Error creating repository: " + e.toString());
        log.logError(Const.getStackTracker(e));
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExportDialog.ErrorExport.Title"), BaseMessages.getString(PKG, "RepositoryExportDialog.ErrorExport.Message"), e);
        retval = false;
    }
    return retval;
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ExportFeedback(org.pentaho.di.repository.ExportFeedback) ProgressMonitorDialog(org.eclipse.jface.dialogs.ProgressMonitorDialog) ArrayList(java.util.ArrayList) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) IRepositoryExporterFeedback(org.pentaho.di.repository.IRepositoryExporterFeedback) ProgressMonitorAdapter(org.pentaho.di.core.ProgressMonitorAdapter) IRepositoryExporter(org.pentaho.di.repository.IRepositoryExporter)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)13 ProgressMonitorAdapter (org.pentaho.di.core.ProgressMonitorAdapter)13 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)12 ProgressMonitorDialog (org.eclipse.jface.dialogs.ProgressMonitorDialog)12 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)12 KettleException (org.pentaho.di.core.exception.KettleException)9 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)9 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)2 Spoon (org.pentaho.di.ui.spoon.Spoon)2 ArrayList (java.util.ArrayList)1 MessageDialog (org.eclipse.jface.dialogs.MessageDialog)1 MessageBox (org.eclipse.swt.widgets.MessageBox)1 Database (org.pentaho.di.core.database.Database)1 DatabaseMetaInformation (org.pentaho.di.core.database.DatabaseMetaInformation)1 KettleStepException (org.pentaho.di.core.exception.KettleStepException)1 ExportFeedback (org.pentaho.di.repository.ExportFeedback)1 IRepositoryExporter (org.pentaho.di.repository.IRepositoryExporter)1 IRepositoryExporterFeedback (org.pentaho.di.repository.IRepositoryExporterFeedback)1 StepMeta (org.pentaho.di.trans.step.StepMeta)1 MissingEntryDialog (org.pentaho.di.ui.job.entries.missing.MissingEntryDialog)1