private void fillStoredData() {

    if (stepname != null) textStepName.setText(stepname);

    int index =
        addConnectionLine.indexOf(
            meta.getDatabaseMeta() != null ? meta.getDatabaseMeta().getName() : "");
    if (index >= 0) addConnectionLine.select(index);

    if (meta.getDimension() != null) {
      comboDimension.add(meta.getDimension());
      comboDimension.select(0);
    }

    buttonBaseElementsOnly.setSelection(meta.getBaseElementsOnly());

    tableViewFields.table.removeAll();
    if (meta.getLevels().size() > 0) {
      for (PaloDimensionLevel level : meta.getLevels()) {
        tableViewFields.add(
            level.getLevelName(),
            String.valueOf(level.getLevelNumber()),
            level.getFieldName(),
            level.getFieldType());
      }
      tableViewFields.setRowNums();
      tableViewFields.optWidth(true);
    }
  }
  private void getInfo(PaloDimInputMeta myMeta) throws KettleException {
    stepname = textStepName.getText();
    List<PaloDimensionLevel> levels = new ArrayList<PaloDimensionLevel>();

    for (int i = 0; i < tableViewFields.table.getItemCount(); i++) {
      PaloDimensionLevel level =
          new PaloDimensionLevel(
              tableViewFields.table.getItem(i).getText(1),
              Integer.parseInt(tableViewFields.table.getItem(i).getText(2)),
              tableViewFields.table.getItem(i).getText(3),
              tableViewFields.table.getItem(i).getText(4));
      levels.add(level);
    }
    myMeta.setDatabaseMeta(transMeta.findDatabase(addConnectionLine.getText()));
    myMeta.setLevels(levels);
    myMeta.setDimension(comboDimension.getText());
    myMeta.setBaseElementsOnly(buttonBaseElementsOnly.getSelection());
    myMeta.setChanged(true);
  }
  public String open() {

    final Display display = getParent().getDisplay();
    shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, meta);
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;

    FormData fd;

    labelStepName = new Label(shell, SWT.RIGHT);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(middle, -margin);
    fd.top = new FormAttachment(0, margin);
    labelStepName.setLayoutData(fd);

    textStepName = new Text(shell, SWT.BORDER);
    fd = new FormData();
    fd.left = new FormAttachment(middle, 0);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(0, margin);
    textStepName.setLayoutData(fd);

    addConnectionLine = addConnectionLine(shell, textStepName, Const.MIDDLE_PCT, margin);

    labelDimension = new Label(shell, SWT.RIGHT);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(middle, -margin);
    fd.top = new FormAttachment(addConnectionLine, margin);
    labelDimension.setLayoutData(fd);

    comboDimension = new Combo(shell, SWT.READ_ONLY);
    fd = new FormData();
    fd.left = new FormAttachment(middle, 0);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(addConnectionLine, margin);
    comboDimension.setLayoutData(fd);

    labelBaseElementsOnly = new Label(shell, SWT.RIGHT);
    fd = new FormData();
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(middle, -margin);
    fd.top = new FormAttachment(comboDimension, margin);
    labelBaseElementsOnly.setLayoutData(fd);

    buttonBaseElementsOnly = new Button(shell, SWT.CHECK);
    fd = new FormData();
    fd.left = new FormAttachment(middle, 0);
    fd.right = new FormAttachment(100, 0);
    fd.top = new FormAttachment(comboDimension, margin);
    buttonBaseElementsOnly.setLayoutData(fd);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            meta.setChanged();
          }
        };
    ColumnInfo[] colinf =
        new ColumnInfo[] {
          new ColumnInfo(getLocalizedColumn(0), ColumnInfo.COLUMN_TYPE_TEXT, false, true),
          new ColumnInfo(getLocalizedColumn(1), ColumnInfo.COLUMN_TYPE_TEXT, false, true),
          new ColumnInfo(getLocalizedColumn(2), ColumnInfo.COLUMN_TYPE_TEXT, false, false),
          new ColumnInfo(
              getLocalizedColumn(3),
              ColumnInfo.COLUMN_TYPE_CCOMBO,
              new String[] {"String", "Number"},
              true)
        };

    tableViewFields =
        new TableView(null, shell, SWT.FILL | SWT.BORDER, colinf, 10, true, lsMod, props);

    tableViewFields.setSize(477, 280);
    tableViewFields.setBounds(5, 125, 477, 280);
    tableViewFields.setReadonly(true);
    tableViewFields.setSortable(false);
    fd = new FormData();
    fd.left = new FormAttachment(0, margin);
    fd.top = new FormAttachment(buttonBaseElementsOnly, 3 * margin);
    fd.right = new FormAttachment(100, -150);
    fd.bottom = new FormAttachment(100, -50);
    tableViewFields.setLayoutData(fd);

    buttonGetLevels = new Button(shell, SWT.NONE);
    fd = new FormData();
    fd.left = new FormAttachment(tableViewFields, margin);
    fd.top = new FormAttachment(buttonBaseElementsOnly, 3 * margin);
    fd.right = new FormAttachment(100, 0);
    buttonGetLevels.setLayoutData(fd);

    buttonClearLevels = new Button(shell, SWT.NONE);
    fd = new FormData();
    fd.left = new FormAttachment(tableViewFields, margin);
    fd.top = new FormAttachment(buttonGetLevels, margin);
    fd.right = new FormAttachment(100, 0);
    buttonClearLevels.setLayoutData(fd);

    buttonOk = new Button(shell, SWT.CENTER);
    buttonCancel = new Button(shell, SWT.CENTER);
    buttonPreview = new Button(shell, SWT.CENTER);
    buttonOk.setText(BaseMessages.getString("System.Button.OK"));
    buttonPreview.setText(BaseMessages.getString("System.Button.Preview"));
    buttonCancel.setText(BaseMessages.getString("System.Button.Cancel"));
    setButtonPositions(new Button[] {buttonOk, buttonPreview, buttonCancel}, margin, null);

    buttonCancel.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            cancel();
          }
        });
    buttonPreview.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            preview();
          }
        });
    buttonOk.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            ok();
          }
        });
    buttonClearLevels.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            doClearLevels();
          }
        });
    buttonGetLevels.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            doGetLevels();
          }
        });
    comboDimension.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            doSelectDimension();
          }
        });
    addConnectionLine.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            doSelectConnection(false);
          }
        });

    this.fillLocalizationData();
    this.fillStoredData();
    this.doSelectConnection(false);

    props.setLook(tableViewFields);
    props.setLook(comboDimension);
    props.setLook(textStepName);
    props.setLook(buttonClearLevels);
    props.setLook(buttonGetLevels);
    props.setLook(labelStepName);
    props.setLook(labelDimension);
    props.setLook(buttonOk);
    props.setLook(buttonCancel);
    props.setLook(buttonPreview);
    props.setLook(addConnectionLine);
    props.setLook(labelBaseElementsOnly);
    props.setLook(buttonBaseElementsOnly);

    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });
    meta.setChanged(changed);
    setSize();
    shell.open();

    PaloCellInputDialog.showPaloLibWarningDialog(shell);

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return stepname;
  }
 private void cancel() {
   stepname = null;
   meta.setChanged(changed);
   dispose();
 }