use of org.pentaho.di.ui.core.database.dialog.DatabaseDialog in project pentaho-kettle by pentaho.
the class JobEntryDialog method showDbDialogUnlessCancelledOrValid.
@VisibleForTesting
String showDbDialogUnlessCancelledOrValid(DatabaseMeta changing, DatabaseMeta origin) {
changing.shareVariablesWith(jobMeta);
DatabaseDialog cid = getDatabaseDialog();
cid.setDatabaseMeta(changing);
cid.setModalDialog(true);
String name = null;
boolean repeat = true;
while (repeat) {
name = cid.open();
if (name == null) {
// Cancel was pressed
repeat = false;
} else {
name = name.trim();
DatabaseMeta same = jobMeta.findDatabase(name);
if (same == null || same == origin) {
// OK was pressed and input is valid
repeat = false;
} else {
showDbExistsDialog(changing);
}
}
}
return name;
}
Aggregations