use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class ProcessFilesDialog method get.
private void get() {
if (!gotPreviousFields) {
gotPreviousFields = true;
try {
String source = wSourceFileNameField.getText();
String target = wTargetFileNameField.getText();
wSourceFileNameField.removeAll();
wTargetFileNameField.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
wSourceFileNameField.setItems(r.getFieldNames());
wTargetFileNameField.setItems(r.getFieldNames());
if (source != null) {
wSourceFileNameField.setText(source);
}
if (target != null) {
wTargetFileNameField.setText(target);
}
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "ProcessFilesDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "ProcessFilesDialog.FailedToGetFields.DialogMessage"), ke);
}
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class PropertyInputDialog method setFileField.
private void setFileField() {
try {
String value = wFilenameField.getText();
wFilenameField.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
r.getFieldNames();
for (int i = 0; i < r.getFieldNames().length; i++) {
wFilenameField.add(r.getFieldNames()[i]);
}
}
if (value != null) {
wFilenameField.setText(value);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PropertyInputDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PropertyInputDialog.FailedToGetFields.DialogMessage"), ke);
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class PropertyInputDialog method getSections.
private void getSections() {
Wini wini = new Wini();
PropertyInputMeta meta = new PropertyInputMeta();
try {
getInfo(meta);
FileInputList fileInputList = meta.getFiles(transMeta);
if (fileInputList.nrOfFiles() > 0) {
// Check the first file
if (fileInputList.getFile(0).exists()) {
// Open the file (only first file) in readOnly ...
//
wini = new Wini(KettleVFS.getInputStream(fileInputList.getFile(0)));
Iterator<String> itSection = wini.keySet().iterator();
String[] sectionsList = new String[wini.keySet().size()];
int i = 0;
while (itSection.hasNext()) {
sectionsList[i] = itSection.next().toString();
i++;
}
Const.sortStrings(sectionsList);
EnterSelectionDialog dialog = new EnterSelectionDialog(shell, sectionsList, BaseMessages.getString(PKG, "PropertyInputDialog.Dialog.SelectASection.Title"), BaseMessages.getString(PKG, "PropertyInputDialog.Dialog.SelectASection.Message"));
String sectionname = dialog.open();
if (sectionname != null) {
wSection.setText(sectionname);
}
} else {
// The file not exists !
throw new KettleException(BaseMessages.getString(PKG, "PropertyInputDialog.Exception.FileDoesNotExist", KettleVFS.getFilename(fileInputList.getFile(0))));
}
} else {
// No file specified
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "PropertyInputDialog.FilesMissing.DialogMessage"));
mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
mb.open();
}
} catch (Throwable e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PropertyInputDialog.UnableToGetListOfSections.Title"), BaseMessages.getString(PKG, "PropertyInputDialog.UnableToGetListOfSections.Message"), e);
} finally {
if (wini != null) {
wini.clear();
}
wini = null;
meta = null;
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class RegexEvalDialog method getPreviousFields.
private void getPreviousFields() {
// Save user-selected value, if applicable
String selectedValue = wfieldevaluate.getText();
// Clear the existing list, and reload
wfieldevaluate.removeAll();
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
for (String item : r.getFieldNames()) {
wfieldevaluate.add(item);
}
}
// Re-select the user-selected value, if applicable
if (!Utils.isEmpty(selectedValue)) {
wfieldevaluate.select(wfieldevaluate.indexOf(selectedValue));
} else {
wfieldevaluate.select(0);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RegexEvalDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "RegexEvalDialog.FailedToGetFields.DialogMessage"), ke);
}
}
use of org.pentaho.di.core.exception.KettleException in project pentaho-kettle by pentaho.
the class ReplaceStringDialog method get.
private void get() {
try {
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
TableItemInsertListener listener = new TableItemInsertListener() {
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
if (v.getType() == ValueMetaInterface.TYPE_STRING) {
// Only process strings
tableItem.setText(3, BaseMessages.getString(PKG, "System.Combo.No"));
tableItem.setText(6, BaseMessages.getString(PKG, "System.Combo.No"));
tableItem.setText(8, BaseMessages.getString(PKG, "System.Combo.No"));
tableItem.setText(9, BaseMessages.getString(PKG, "System.Combo.No"));
tableItem.setText(10, BaseMessages.getString(PKG, "System.Combo.No"));
return true;
} else {
return false;
}
}
};
BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] { 1 }, new int[] {}, -1, -1, listener);
}
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "ReplaceStringDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "ReplaceStringDialog.FailedToGetFields.DialogMessage"), ke);
}
}
Aggregations