/** * This helper method puts the step configuration stored in the meta object and puts it into the * dialog controls. */ private void populateDialog() { wRemoveBlanks.setSelection(meta.isConsecutiveDelimsAsOne()); if (meta.getSourceFields() != null) { for (int i = 0; i < meta.getSourceFields().length; i++) { TableItem item = wGroup.table.getItem(i); if (meta.getSourceFields()[i] != null) { item.setText(1, meta.getSourceFields()[i]); } if (meta.getSourceDelims()[i] != null) { item.setText(2, meta.getSourceDelims()[i]); } if (meta.getOutputFields()[i] != null) { item.setText(3, meta.getOutputFields()[i]); } if (meta.getOutputDelims()[i] != null) { item.setText(4, meta.getOutputDelims()[i]); } } } wGroup.setRowNums(); wGroup.optWidth(true); wStepname.selectAll(); wStepname.setFocus(); }
/** Called when the user confirms the dialog */ private void ok() { // The "stepname" variable will be the return value for the open() method. // Setting to step name from the dialog control stepname = wStepname.getText(); // Setting the settings to the meta object meta.setConsecutiveDelimsAsOne(wRemoveBlanks.getSelection()); int nrfields = wGroup.nrNonEmpty(); meta.allocate(nrfields); for (int i = 0; i < nrfields; i++) { TableItem item = wGroup.getNonEmpty(i); meta.getSourceFields()[i] = item.getText(1); meta.getSourceDelims()[i] = item.getText(2); meta.getOutputFields()[i] = item.getText(3); meta.getOutputDelims()[i] = item.getText(4); } // close the SWT dialog window dispose(); }