use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class PGPDecryptStreamDialog method get.
private void get() {
if (!gotPreviousFields) {
try {
String fieldvalue = wStreamFieldName.getText();
String passphrasefieldvalue = wPassphraseFieldName.getText();
wStreamFieldName.removeAll();
wPassphraseFieldName.removeAll();
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null) {
String[] fields = r.getFieldNames();
wStreamFieldName.setItems(fields);
wPassphraseFieldName.setItems(fields);
}
if (fieldvalue != null) {
wStreamFieldName.setText(fieldvalue);
}
if (passphrasefieldvalue != null) {
wPassphraseFieldName.setText(passphrasefieldvalue);
}
gotPreviousFields = true;
} catch (KettleException ke) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogTitle"), BaseMessages.getString(PKG, "PGPDecryptStreamDialog.FailedToGetFields.DialogMessage"), ke);
}
}
}
use of org.pentaho.di.ui.core.dialog.ErrorDialog 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.ui.core.dialog.ErrorDialog 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.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class RowGeneratorDialog method ok.
private void ok() {
if (Utils.isEmpty(wStepname.getText())) {
return;
}
// return value
stepname = wStepname.getText();
try {
// to see if there is an exception
getInfo(new RowGeneratorMeta());
// to put the content on the input structure for real if all is well.
getInfo(input);
dispose();
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Title"), BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Message"), e);
}
}
use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class RowGeneratorDialog method preview.
/**
* Preview the data generated by this step. This generates a transformation using this step & a dummy and previews it.
*/
private void preview() {
RowGeneratorMeta oneMeta = new RowGeneratorMeta();
try {
getInfo(oneMeta);
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Title"), BaseMessages.getString(PKG, "RowGeneratorDialog.Illegal.Dialog.Settings.Message"), e);
return;
}
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "System.Dialog.EnterPreviewSize.Title"), BaseMessages.getString(PKG, "System.Dialog.EnterPreviewSize.Message"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
Trans trans = progressDialog.getTrans();
String loggingText = progressDialog.getLoggingText();
if (!progressDialog.isCancelled()) {
if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
EnterTextDialog etd = new EnterTextDialog(shell, BaseMessages.getString(PKG, "System.Dialog.PreviewError.Title"), BaseMessages.getString(PKG, "System.Dialog.PreviewError.Message"), loggingText, true);
etd.setReadOnly();
etd.open();
}
}
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()), loggingText);
prd.open();
}
}
Aggregations