use of org.apache.hop.ui.core.dialog.BaseDialog in project hop by apache.
the class IGetFieldsCapableTransformDialog method getFields.
default void getFields(final TransformMetaType meta) {
final String[] incomingFieldNames = getFieldNames(meta);
final List<String> newFieldNames = getNewFieldNames(incomingFieldNames);
if (newFieldNames != null && newFieldNames.size() > 0) {
// we have new incoming fields
final int nrNonEmptyFields = getFieldsTable().nrNonEmpty();
// are any fields already populated in the fields table?
if (nrNonEmptyFields > 0) {
final FieldSelectionDialog fieldSelectDialog = new FieldSelectionDialog(this.getShell(), newFieldNames.size()) {
@Override
protected void ok() {
super.ok();
openGetFieldsSampleDataDialog(reloadAllFields);
}
};
fieldSelectDialog.open();
} else {
// no fields are populated yet, go straight to "sample data" dialog
openGetFieldsSampleDataDialog(true);
}
} else {
// we have no new fields
final BaseDialog errorDlg = new BaseMessageDialog(getShell(), BaseMessages.getString(PKG, "GetFieldsCapableTransformDialog.NoNewFields.Title"), BaseMessages.getString(PKG, "GetFieldsCapableTransformDialog.NoNewFields.Message"));
// GetFieldsSampleDataDialog
if (incomingFieldNames != null && incomingFieldNames.length > 0) {
final Map<String, Listener> buttons = new HashMap();
buttons.put(BaseMessages.getString(PKG, "System.Button.OK"), event -> {
errorDlg.dispose();
openGetFieldsSampleDataDialog(true);
});
errorDlg.setButtons(buttons);
}
errorDlg.open();
}
}
Aggregations