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;
}
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();
}
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;
}
Aggregations