use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.
the class TransLoadProgressDialog method open.
public TransMeta open() {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
Spoon spoon = Spoon.getInstance();
try {
// Call extension point(s) before the file has been opened
ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.TransBeforeOpen.id, (objectId == null) ? transname : objectId.toString());
if (objectId != null) {
transInfo = rep.loadTransformation(objectId, versionLabel);
} else {
transInfo = rep.loadTransformation(transname, repdir, new ProgressMonitorAdapter(monitor), true, versionLabel);
}
// Call extension point(s) now that the file has been opened
ExtensionPointHandler.callExtensionPoint(spoon.getLog(), KettleExtensionPoint.TransAfterOpen.id, transInfo);
if (transInfo.hasMissingPlugins()) {
StepMeta stepMeta = transInfo.getStep(0);
Display.getDefault().syncExec(() -> {
MissingTransDialog missingTransDialog = new MissingTransDialog(shell, transInfo.getMissingTrans(), stepMeta.getStepMetaInterface(), transInfo, stepMeta.getName());
if (missingTransDialog.open() == null) {
transInfo = null;
}
});
}
} catch (KettleException e) {
throw new InvocationTargetException(e, BaseMessages.getString(PKG, "TransLoadProgressDialog.Exception.ErrorLoadingTransformation"));
}
}
};
try {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
pmd.run(true, false, op);
} catch (InvocationTargetException e) {
KettleRepositoryLostException krle = KettleRepositoryLostException.lookupStackStrace(e);
if (krle != null) {
throw krle;
}
new ErrorDialog(shell, BaseMessages.getString(PKG, "TransLoadProgressDialog.ErrorLoadingTransformation.DialogTitle"), BaseMessages.getString(PKG, "TransLoadProgressDialog.ErrorLoadingTransformation.DialogMessage"), e);
transInfo = null;
} catch (InterruptedException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "TransLoadProgressDialog.ErrorLoadingTransformation.DialogTitle"), BaseMessages.getString(PKG, "TransLoadProgressDialog.ErrorLoadingTransformation.DialogMessage"), e);
transInfo = null;
}
return transInfo;
}
use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.
the class GetDatabaseInfoProgressDialog method open.
public DatabaseMetaInformation open() {
final DatabaseMetaInformation dmi = new DatabaseMetaInformation(dbInfo);
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
dmi.getData(Spoon.loggingObject, new ProgressMonitorAdapter(monitor));
} catch (Exception e) {
throw new InvocationTargetException(e, BaseMessages.getString(PKG, "GetDatabaseInfoProgressDialog.Error.GettingInfoTable", e.toString()));
}
}
};
try {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
pmd.run(true, true, op);
} catch (InvocationTargetException e) {
showErrorDialog(e);
return null;
} catch (InterruptedException e) {
showErrorDialog(e);
return null;
}
return dmi;
}
use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.
the class AnalyseImpactProgressDialog method open.
public boolean open() {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
// Start with a clean slate!!
impact.clear();
transMeta.analyseImpact(impact, new ProgressMonitorAdapter(monitor));
impactHasRun = true;
} catch (Exception e) {
impact.clear();
impactHasRun = false;
// Problem encountered generating impact list: {0}
throw new InvocationTargetException(e, BaseMessages.getString(PKG, "AnalyseImpactProgressDialog.RuntimeError.UnableToAnalyzeImpact.Exception", e.toString()));
}
}
};
try {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
pmd.run(true, true, op);
} catch (InvocationTargetException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "AnalyseImpactProgressDialog.Dialog.UnableToAnalyzeImpact.Title"), BaseMessages.getString(PKG, "AnalyseImpactProgressDialog.Dialog.UnableToAnalyzeImpact.Messages"), e);
} catch (InterruptedException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "AnalyseImpactProgressDialog.Dialog.UnableToAnalyzeImpact.Title"), BaseMessages.getString(PKG, "AnalyseImpactProgressDialog.Dialog.UnableToAnalyzeImpact.Messages"), e);
}
return impactHasRun;
}
use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.
the class CheckTransProgressDialog method open.
public void open() {
final ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
transMeta.checkSteps(remarks, onlySelected, new ProgressMonitorAdapter(monitor), space, repository, metaStore);
} catch (Exception e) {
throw new InvocationTargetException(e, BaseMessages.getString(PKG, "AnalyseImpactProgressDialog.RuntimeError.ErrorCheckingTransformation.Exception", e.toString()));
}
}
};
try {
// Run something in the background to cancel active database queries, force this if needed!
Runnable run = new Runnable() {
public void run() {
IProgressMonitor monitor = pmd.getProgressMonitor();
while (pmd.getShell() == null || (!pmd.getShell().isDisposed() && !monitor.isCanceled())) {
try {
Thread.sleep(250);
} catch (InterruptedException e) {
// Ignore sleep interruption exception
}
}
if (monitor.isCanceled()) {
try {
transMeta.cancelQueries();
} catch (Exception e) {
// Ignore cancel errors
}
}
}
};
// Dump the cancel looker in the background!
new Thread(run).start();
pmd.run(true, true, op);
} catch (InvocationTargetException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "CheckTransProgressDialog.Dialog.ErrorCheckingTransformation.Title"), BaseMessages.getString(PKG, "CheckTransProgressDialog.Dialog.ErrorCheckingTransformation.Message"), e);
} catch (InterruptedException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "CheckTransProgressDialog.Dialog.ErrorCheckingTransformation.Title"), BaseMessages.getString(PKG, "CheckTransProgressDialog.Dialog.ErrorCheckingTransformation.Message"), e);
}
}
use of org.pentaho.di.core.ProgressMonitorAdapter in project pentaho-kettle by pentaho.
the class GetJobSQLProgressDialog method open.
public List<SQLStatement> open() {
IRunnableWithProgress op = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
try {
stats = jobMeta.getSQLStatements(repository, new ProgressMonitorAdapter(monitor));
} catch (KettleException e) {
throw new InvocationTargetException(e, BaseMessages.getString(PKG, "GetJobSQLProgressDialog.RuntimeError.UnableToGenerateSQL.Exception", // Error
e.getMessage()));
// generating
// SQL for
// job:
// \n{0}
}
}
};
try {
ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
pmd.run(false, false, op);
} catch (InvocationTargetException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "GetJobSQLProgressDialog.Dialog.UnableToGenerateSQL.Title"), BaseMessages.getString(PKG, "GetJobSQLProgressDialog.Dialog.UnableToGenerateSQL.Message"), e);
stats = null;
} catch (InterruptedException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "GetJobSQLProgressDialog.Dialog.UnableToGenerateSQL.Title"), BaseMessages.getString(PKG, "GetJobSQLProgressDialog.Dialog.UnableToGenerateSQL.Message"), e);
stats = null;
}
return stats;
}
Aggregations