use of org.pentaho.di.ui.spoon.dialog.SearchFieldsProgressDialog in project pentaho-kettle by pentaho.
the class TransGraph method inputOutputFields.
/**
* Display the input- or outputfields for a step.
*
* @param stepMeta The step (it's metadata) to query
* @param before set to true if you want to have the fields going INTO the step, false if you want to see all the
* fields that exit the step.
*/
private void inputOutputFields(StepMeta stepMeta, boolean before) {
spoon.refreshGraph();
transMeta.setRepository(spoon.rep);
SearchFieldsProgressDialog op = new SearchFieldsProgressDialog(transMeta, stepMeta, before);
boolean alreadyThrownError = false;
try {
final ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);
// Run something in the background to cancel active database queries, forecably if needed!
Runnable run = new Runnable() {
@Override
public void run() {
IProgressMonitor monitor = pmd.getProgressMonitor();
while (pmd.getShell() == null || (!pmd.getShell().isDisposed() && !monitor.isCanceled())) {
try {
Thread.sleep(250);
} catch (InterruptedException e) {
// Ignore
}
}
if (monitor.isCanceled()) {
try {
transMeta.cancelQueries();
} catch (Exception e) {
// Ignore
}
}
}
};
// 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, "TransGraph.Dialog.GettingFields.Title"), BaseMessages.getString(PKG, "TransGraph.Dialog.GettingFields.Message"), e);
alreadyThrownError = true;
} catch (InterruptedException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "TransGraph.Dialog.GettingFields.Title"), BaseMessages.getString(PKG, "TransGraph.Dialog.GettingFields.Message"), e);
alreadyThrownError = true;
}
RowMetaInterface fields = op.getFields();
if (fields != null && fields.size() > 0) {
StepFieldsDialog sfd = new StepFieldsDialog(shell, transMeta, SWT.NONE, stepMeta.getName(), fields);
String sn = (String) sfd.open();
if (sn != null) {
StepMeta esi = transMeta.findStep(sn);
if (esi != null) {
editStep(esi);
}
}
} else {
if (!alreadyThrownError) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "TransGraph.Dialog.CouldntFindFields.Message"));
mb.setText(BaseMessages.getString(PKG, "TransGraph.Dialog.CouldntFindFields.Title"));
mb.open();
}
}
}
Aggregations