/** Copy information from the meta-data input to the dialog fields. */
  public void getData() {
    int i;
    if (isDebug())
      logDebug(BaseMessages.getString(PKG, "RestDialog.Log.GettingKeyInfo")); // $NON-NLS-1$

    if (input.getHeaderName() != null) {
      for (i = 0; i < input.getHeaderName().length; i++) {
        TableItem item = wFields.table.getItem(i);
        if (input.getHeaderField()[i] != null) item.setText(1, input.getHeaderField()[i]);
        if (input.getHeaderName()[i] != null) item.setText(2, input.getHeaderName()[i]);
      }
    }

    if (input.getParameterField() != null) {
      for (i = 0; i < input.getParameterField().length; i++) {
        TableItem item = wParameters.table.getItem(i);
        if (input.getParameterField()[i] != null) item.setText(1, input.getParameterField()[i]);
        if (input.getParameterName()[i] != null) item.setText(2, input.getParameterName()[i]);
      }
    }

    wMethod.setText(Const.NVL(input.getMethod(), RestMeta.HTTP_METHOD_GET));
    wMethodInField.setSelection(input.isDynamicMethod());
    if (input.getBodyField() != null) wBody.setText(input.getBodyField());
    if (input.getMethodFieldName() != null) wMethodField.setText(input.getMethodFieldName());
    if (input.getUrl() != null) wUrl.setText(input.getUrl());
    wUrlInField.setSelection(input.isUrlInField());
    if (input.getUrlField() != null) wUrlField.setText(input.getUrlField());
    if (input.getFieldName() != null) wResult.setText(input.getFieldName());
    if (input.getResultCodeFieldName() != null) wResultCode.setText(input.getResultCodeFieldName());
    if (input.getResponseTimeFieldName() != null)
      wResponseTime.setText(input.getResponseTimeFieldName());

    if (input.getHttpLogin() != null) wHttpLogin.setText(input.getHttpLogin());
    if (input.getHttpPassword() != null) wHttpPassword.setText(input.getHttpPassword());
    if (input.getProxyHost() != null) wProxyHost.setText(input.getProxyHost());
    if (input.getProxyPort() != null) wProxyPort.setText(input.getProxyPort());
    wPreemptive.setSelection(input.isPreemptive());

    if (input.getTrustStoreFile() != null) wTrustStoreFile.setText(input.getTrustStoreFile());
    if (input.getTrustStorePassword() != null)
      wTrustStorePassword.setText(input.getTrustStorePassword());

    wApplicationType.setText(Const.NVL(input.getApplicationType(), ""));

    wFields.setRowNums();
    wFields.optWidth(true);
    wStepname.selectAll();
  }
  private void ok() {
    if (Const.isEmpty(wStepname.getText())) return;

    int nrheaders = wFields.nrNonEmpty();
    int nrparams = wParameters.nrNonEmpty();
    input.allocate(nrheaders, nrparams);

    if (isDebug())
      logDebug(
          BaseMessages.getString(
              PKG,
              "RestDialog.Log.FoundArguments",
              String.valueOf(nrheaders))); // $NON-NLS-1$ //$NON-NLS-2$
    for (int i = 0; i < nrheaders; i++) {
      TableItem item = wFields.getNonEmpty(i);
      input.getHeaderField()[i] = item.getText(1);
      input.getHeaderName()[i] = item.getText(2);
    }
    for (int i = 0; i < nrparams; i++) {
      TableItem item = wParameters.getNonEmpty(i);
      input.getParameterField()[i] = item.getText(1);
      input.getParameterName()[i] = item.getText(2);
    }

    input.setDynamicMethod(wMethodInField.getSelection());
    input.setMethodFieldName(wMethodField.getText());
    input.setMethod(wMethod.getText());
    input.setUrl(wUrl.getText());
    input.setUrlField(wUrlField.getText());
    input.setUrlInField(wUrlInField.getSelection());
    input.setBodyField(wBody.getText());
    input.setFieldName(wResult.getText());
    input.setResultCodeFieldName(wResultCode.getText());
    input.setResponseTimeFieldName(wResponseTime.getText());

    input.setHttpLogin(wHttpLogin.getText());
    input.setHttpPassword(wHttpPassword.getText());
    input.setProxyHost(wProxyHost.getText());
    input.setProxyPort(wProxyPort.getText());
    input.setPreemptive(wPreemptive.getSelection());

    input.setTrustStoreFile(wTrustStoreFile.getText());
    input.setTrustStorePassword(wTrustStorePassword.getText());
    input.setApplicationType(wApplicationType.getText());
    stepname = wStepname.getText(); // return value

    dispose();
  }