// Preview the data
  private void preview() {
    try {

      GetFilesRowsCountMeta oneMeta = new GetFilesRowsCountMeta();
      getInfo(oneMeta);

      TransMeta previewMeta =
          TransPreviewFactory.generatePreviewTransformation(
              transMeta, oneMeta, wStepname.getText());

      EnterNumberDialog numberDialog =
          new EnterNumberDialog(
              shell,
              props.getDefaultPreviewSize(),
              BaseMessages.getString(PKG, "GetFilesRowsCountDialog.NumberRows.DialogTitle"),
              BaseMessages.getString(PKG, "GetFilesRowsCountDialog.NumberRows.DialogMessage"));
      int previewSize = numberDialog.open();
      if (previewSize > 0) {
        TransPreviewProgressDialog progressDialog =
            new TransPreviewProgressDialog(
                shell, previewMeta, new String[] {wStepname.getText()}, new int[] {previewSize});
        progressDialog.open();

        if (!progressDialog.isCancelled()) {
          Trans trans = progressDialog.getTrans();
          String loggingText = progressDialog.getLoggingText();

          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();
        }
      }
    } catch (KettleException e) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "GetFilesRowsCountDialog.ErrorPreviewingData.DialogTitle"),
          BaseMessages.getString(PKG, "GetFilesRowsCountDialog.ErrorPreviewingData.DialogMessage"),
          e);
    }
  }
  // Preview the data
  private void preview() {
    GetTableNamesMeta oneMeta = new GetTableNamesMeta();

    getInfo(oneMeta);
    if (oneMeta.getDatabase() == null) {
      MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
      mb.setMessage(
          BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogMessage"));
      mb.setText(BaseMessages.getString(PKG, "GetTableNamesDialog.InvalidConnection.DialogTitle"));
      mb.open();
      return;
    }
    if (!checkUserInput(oneMeta)) return;

    TransMeta previewMeta =
        TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());

    EnterNumberDialog numberDialog =
        new EnterNumberDialog(
            shell,
            props.getDefaultPreviewSize(),
            BaseMessages.getString(PKG, "GetTableNamesDialog.PreviewSize.DialogTitle"),
            BaseMessages.getString(PKG, "GetTableNamesDialog.PreviewSize.DialogMessage"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
      TransPreviewProgressDialog progressDialog =
          new TransPreviewProgressDialog(
              shell, previewMeta, new String[] {wStepname.getText()}, new int[] {previewSize});
      progressDialog.open();

      if (!progressDialog.isCancelled()) {
        Trans trans = progressDialog.getTrans();
        String loggingText = progressDialog.getLoggingText();

        if (trans.getResult() != null && trans.getResult().getNrErrors() > 0) {
          EnterTextDialog etd =
              new EnterTextDialog(
                  shell,
                  BaseMessages.getString(PKG, "System.Dialog.Error.Title"),
                  BaseMessages.getString(PKG, "GetTableNamesDialog.ErrorInPreview.DialogMessage"),
                  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();
      }
    }
  }
  private void preview() {
    PaloDimInputMeta oneMeta = new PaloDimInputMeta();
    try {
      getInfo(oneMeta);
    } catch (KettleException e) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "PaloInputDialog.Illegal.Dialog.Settings.Title"),
          BaseMessages.getString(PKG, "PaloInputDialog.Illegal.Dialog.Settings.Message"),
          e);
      return;
    }

    TransMeta previewMeta =
        TransPreviewFactory.generatePreviewTransformation(
            transMeta, oneMeta, textStepName.getText());

    EnterNumberDialog numberDialog =
        new EnterNumberDialog(
            shell,
            500,
            BaseMessages.getString("System.Dialog.EnterPreviewSize.Title"),
            BaseMessages.getString("System.Dialog.EnterPreviewSize.Message"));
    int previewSize = numberDialog.open();
    if (previewSize > 0) {
      TransPreviewProgressDialog progressDialog =
          new TransPreviewProgressDialog(
              shell, previewMeta, new String[] {textStepName.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("System.Dialog.PreviewError.Title"),
                  BaseMessages.getString("System.Dialog.PreviewError.Message"),
                  loggingText,
                  true);
          etd.setReadOnly();
          etd.open();
        }
      }

      PreviewRowsDialog prd =
          new PreviewRowsDialog(
              shell,
              transMeta,
              SWT.NONE,
              textStepName.getText(),
              progressDialog.getPreviewRowsMeta(textStepName.getText()),
              progressDialog.getPreviewRows(textStepName.getText()),
              loggingText);
      prd.open();
    }
  }
  // Preview the data
  private void preview() {
    // execute a complete preview transformation in the background.
    // This is how we do it...
    //
    FixedInputMeta oneMeta = new FixedInputMeta();
    getInfo(oneMeta);

    TransMeta previewMeta =
        TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());

    EnterNumberDialog numberDialog =
        new EnterNumberDialog(
            shell,
            props.getDefaultPreviewSize(),
            BaseMessages.getString(PKG, "FixedInputDialog.PreviewSize.DialogTitle"),
            BaseMessages.getString(PKG, "FixedInputDialog.PreviewSize.DialogMessage"));
    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();
    }
  }
  // Preview the data
  // unused
  // preserve for later
  private void preview() {
    // Create the XML input step
    SapInputMeta oneMeta = new SapInputMeta();
    getInfo(oneMeta);

    TransMeta previewMeta =
        TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
    transMeta.getVariable("Internal.Transformation.Filename.Directory");
    previewMeta.getVariable("Internal.Transformation.Filename.Directory");

    EnterNumberDialog numberDialog =
        new EnterNumberDialog(
            shell,
            props.getDefaultPreviewSize(),
            BaseMessages.getString(PKG, "CsvInputDialog.PreviewSize.DialogTitle"),
            BaseMessages.getString(PKG, "CsvInputDialog.PreviewSize.DialogMessage"));
    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();
    }
  }
  private void show() {
    if (rowDatas.size() == 0) return;

    int nr = wStepList.getSelectionIndex();

    java.util.List<Object[]> buffer = (java.util.List<Object[]>) rowDatas.get(nr);
    RowMetaInterface rowMeta = (RowMetaInterface) rowMetas.get(nr);
    String name = (String) stepNames.get(nr);

    if (rowMeta != null && buffer != null && buffer.size() > 0) {
      PreviewRowsDialog prd =
          new PreviewRowsDialog(
              shell, Variables.getADefaultVariableSpace(), SWT.NONE, name, rowMeta, buffer);
      prd.open();
    } else {
      MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
      mb.setText(
          BaseMessages.getString(PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Title"));
      mb.setMessage(
          BaseMessages.getString(PKG, "EnterPreviewRowsDialog.Dialog.NoPreviewRowsFound.Message"));
      mb.open();
    }
  }