Example #1
0
  @SuppressWarnings("deprecation")
  @Override
  public void show(boolean force) {
    if ((force) || (!buttonsCreated)) {
      setButtons();
    }

    isDialogHidden = false;

    dialog.getShell().setText(title);

    // Remember the size from a last time or do proper layouting of the window.
    //
    if (getWidth() > 0 && getHeight() > 0) {
      BaseStepDialog.setSize(getShell(), getWidth(), getHeight(), true);
    } else {
      BaseStepDialog.setSize(getShell());
    }

    width = getShell().getSize().x;
    height = getShell().getSize().y;

    dialog.getShell().layout(true, true);

    // Timing is everything - fire the onLoad events so that anyone who is trying to listens gets
    // notified
    //
    notifyListeners(XulRoot.EVENT_ON_LOAD);

    returnCode = dialog.open();
  }
  public void get() {
    try {

      // As the user for a file to use as a reference
      //
      FileDialog dialog = new FileDialog(shell, SWT.OPEN);
      dialog.setFilterExtensions(new String[] {"*.sas7bdat;*.SAS7BDAT", "*.*"});
      dialog.setFilterNames(
          new String[] {
            BaseMessages.getString(PKG, "SASInputDialog.FileType.SAS7BAT")
                + ", "
                + BaseMessages.getString(PKG, "System.FileType.TextFiles"),
            BaseMessages.getString(PKG, "System.FileType.CSVFiles"),
            BaseMessages.getString(PKG, "System.FileType.TextFiles"),
            BaseMessages.getString(PKG, "System.FileType.AllFiles")
          });
      if (dialog.open() != null) {
        String filename =
            dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
        SasInputHelper helper = new SasInputHelper(filename);
        BaseStepDialog.getFieldsFromPrevious(
            helper.getRowMeta(), wFields, 1, new int[] {1}, new int[] {3}, 4, 5, null);
      }

    } catch (Exception e) {
      new ErrorDialog(shell, "Error", "Error reading information from file", e);
    }
  }
 private void getlookup() {
   try {
     String stepFrom = wStep.getText();
     if (!Utils.isEmpty(stepFrom)) {
       RowMetaInterface r = transMeta.getStepFields(stepFrom);
       if (r != null && !r.isEmpty()) {
         BaseStepDialog.getFieldsFromPrevious(
             r, wReturn, 1, new int[] {1}, new int[] {4}, -1, -1, null);
       } else {
         MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
         mb.setMessage(
             BaseMessages.getString(PKG, "FuzzyMatchDialog.CouldNotFindFields.DialogMessage"));
         mb.setText(
             BaseMessages.getString(PKG, "FuzzyMatchDialog.CouldNotFindFields.DialogTitle"));
         mb.open();
       }
     } else {
       MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
       mb.setMessage(
           BaseMessages.getString(PKG, "FuzzyMatchDialog.StepNameRequired.DialogMessage"));
       mb.setText(BaseMessages.getString(PKG, "FuzzyMatchDialog.StepNameRequired.DialogTitle"));
       mb.open();
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "FuzzyMatchDialog.FailedToGetFields.DialogTitle"),
         BaseMessages.getString(PKG, "FuzzyMatchDialog.FailedToGetFields.DialogMessage"),
         ke);
   }
 }
 protected void getFieldsFromInput() {
   try {
     RowMetaInterface r = transMeta.getPrevStepFields(stepname);
     if (r != null && !r.isEmpty()) {
       BaseStepDialog.getFieldsFromPrevious(
           r,
           wKey,
           1,
           new int[] {1, 2},
           new int[] {},
           -1,
           -1,
           new TableItemInsertListener() {
             public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
               tableItem.setText(3, LoadSatMeta.ATTRIBUTE_NORMAL);
               return true;
             }
           });
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "LoadDialog.UnableToGetFieldsError.DialogTitle"),
         BaseMessages.getString(PKG, "LoadDialog.UnableToGetFieldsError.DialogMessage"),
         ke);
   }
 }
 private void getUpdate() {
   try {
     RowMetaInterface r = transMeta.getPrevStepFields(stepname);
     if (r != null) {
       TableItemInsertListener listener =
           new TableItemInsertListener() {
             public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
               if (v.getType() == ValueMetaInterface.TYPE_DATE) {
                 // The default is : format is OK for dates, see if this sticks later on...
                 //
                 tableItem.setText(3, "Y");
               } else {
                 tableItem.setText(3, "Y"); // default is OK too...
               }
               return true;
             }
           };
       BaseStepDialog.getFieldsFromPrevious(
           r, wReturn, 1, new int[] {1, 2}, new int[] {}, -1, -1, listener);
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(
             PKG, "LucidDBBulkLoaderDialog.FailedToGetFields.DialogTitle"), // $NON-NLS-1$
         BaseMessages.getString(PKG, "LucidDBBulkLoaderDialog.FailedToGetFields.DialogMessage"),
         ke); //$NON-NLS-1$
   }
 }
Example #6
0
 private void get() {
   try {
     RowMetaInterface r = transMeta.getPrevStepFields(stepname);
     if (r != null && !r.isEmpty()) {
       BaseStepDialog.getFieldsFromPrevious(r, wFields, 1, new int[] {1}, null, -1, -1, null);
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"),
         BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"),
         ke);
   }
 }
 private void get() {
   try {
     RowMetaInterface r = transMeta.getPrevStepFields(stepname);
     if (r != null) {
       BaseStepDialog.getFieldsFromPrevious(
           r, wFields, 1, new int[] {1}, new int[] {}, -1, -1, null);
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "ExecSQLDialog.FailedToGetFields.DialogTitle"),
         BaseMessages.getString(PKG, "ExecSQLDialog.FailedToGetFields.DialogMessage"),
         ke);
   }
 }
 private void getHeaders() {
   try {
     RowMetaInterface r = transMeta.getPrevStepFields(stepname);
     if (r != null && !r.isEmpty()) {
       BaseStepDialog.getFieldsFromPrevious(
           r, wFields, 1, new int[] {1, 2}, new int[] {3}, -1, -1, null);
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "RestDialog.FailedToGetHeaders.DialogTitle"),
         BaseMessages.getString(PKG, "RestDialog.FailedToGetHeaders.DialogMessage"),
         ke); //$NON-NLS-1$ //$NON-NLS-2$
   }
 }
 private void getAgg() {
   try {
     RowMetaInterface r = transMeta.getPrevStepFields(stepname);
     if (r != null && !r.isEmpty()) {
       BaseStepDialog.getFieldsFromPrevious(
           r, wAgg, 1, new int[] {1, 2}, new int[] {}, -1, -1, null);
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "MemoryGroupByDialog.FailedToGetFields.DialogTitle"),
         BaseMessages.getString(PKG, "MemoryGroupByDialog.FailedToGetFields.DialogMessage"),
         ke);
   }
 }
 private void getValues() {
   try {
     StepMeta stepMeta = transMeta.findStep(wReference.getText());
     if (stepMeta != null) {
       RowMetaInterface prev = transMeta.getStepFields(stepMeta);
       if (prev != null) {
         BaseStepDialog.getFieldsFromPrevious(
             prev, wValues, 1, new int[] {1}, new int[] {}, -1, -1, null);
       }
     }
   } catch (KettleException e) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "MergeRowsDialog.ErrorGettingFields.DialogTitle"),
         BaseMessages.getString(PKG, "MergeRowsDialog.ErrorGettingFields.DialogMessage"),
         e);
   }
 }
Example #11
0
 private void get() {
   try {
     RowMetaInterface r = transMeta.getPrevStepFields(stepname);
     if (r != null && !r.isEmpty()) {
       TableItemInsertListener listener =
           new TableItemInsertListener() {
             public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
               tableItem.setText(2, "IN");
               return true;
             }
           };
       BaseStepDialog.getFieldsFromPrevious(
           r, wFields, 1, new int[] {1}, new int[] {3}, -1, -1, listener);
     }
   } catch (KettleException ke) {
     new ErrorDialog(
         shell,
         BaseMessages.getString(PKG, "DBProcDialog.FailedToGetFields.DialogTitle"),
         BaseMessages.getString(PKG, "DBProcDialog.FailedToGetFields.DialogMessage"),
         ke); //$NON-NLS-1$ //$NON-NLS-2$
   }
 }
  private void get() {
    try {
      RowMetaInterface r = transMeta.getPrevStepFields(stepname);
      if (r != null) {
        TableItemInsertListener insertListener =
            new TableItemInsertListener() {
              public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                return true;
              }
            };

        BaseStepDialog.getFieldsFromPrevious(
            r, wFields, 1, new int[] {1}, new int[] {}, -1, -1, insertListener);
      }
    } catch (KettleException ke) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Title"),
          BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"),
          ke);
    }
  }
  public JobEntryInterface open() {
    Shell parent = getParent();
    display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    backupChanged = jobEntry.hasChanged();

    createElements();

    // Detect [X] or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();
    setActive();

    BaseStepDialog.setSize(shell);

    int width = 750;
    int height = Const.isWindows() ? 730 : 720;

    shell.setSize(width, height);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return jobEntry;
  }
  public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
          }
        };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobTelnet.Title"));

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

    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobTelnet.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    // hostname line
    wlHostname = new Label(shell, SWT.RIGHT);
    wlHostname.setText(BaseMessages.getString(PKG, "JobTelnet.Hostname.Label"));
    props.setLook(wlHostname);
    fdlHostname = new FormData();
    fdlHostname.left = new FormAttachment(0, -margin);
    fdlHostname.top = new FormAttachment(wName, margin);
    fdlHostname.right = new FormAttachment(middle, -margin);
    wlHostname.setLayoutData(fdlHostname);

    wHostname = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wHostname);
    wHostname.addModifyListener(lsMod);
    fdHostname = new FormData();
    fdHostname.left = new FormAttachment(middle, 0);
    fdHostname.top = new FormAttachment(wName, margin);
    fdHostname.right = new FormAttachment(100, 0);
    wHostname.setLayoutData(fdHostname);

    // Whenever something changes, set the tooltip to the expanded version:
    wHostname.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            wHostname.setToolTipText(jobMeta.environmentSubstitute(wHostname.getText()));
          }
        });

    wlPort = new Label(shell, SWT.RIGHT);
    wlPort.setText(BaseMessages.getString(PKG, "JobTelnet.Port.Label"));
    props.setLook(wlPort);
    fdlPort = new FormData();
    fdlPort.left = new FormAttachment(0, -margin);
    fdlPort.right = new FormAttachment(middle, -margin);
    fdlPort.top = new FormAttachment(wHostname, margin);
    wlPort.setLayoutData(fdlPort);

    wPort = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPort);
    wPort.addModifyListener(lsMod);
    fdPort = new FormData();
    fdPort.left = new FormAttachment(middle, 0);
    fdPort.top = new FormAttachment(wHostname, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);

    wlTimeOut = new Label(shell, SWT.RIGHT);
    wlTimeOut.setText(BaseMessages.getString(PKG, "JobTelnet.TimeOut.Label"));
    props.setLook(wlTimeOut);
    fdlTimeOut = new FormData();
    fdlTimeOut.left = new FormAttachment(0, -margin);
    fdlTimeOut.right = new FormAttachment(middle, -margin);
    fdlTimeOut.top = new FormAttachment(wPort, margin);
    wlTimeOut.setLayoutData(fdlTimeOut);

    wTimeOut = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTimeOut);
    wTimeOut.addModifyListener(lsMod);
    fdTimeOut = new FormData();
    fdTimeOut.left = new FormAttachment(middle, 0);
    fdTimeOut.top = new FormAttachment(wPort, margin);
    fdTimeOut.right = new FormAttachment(100, 0);
    wTimeOut.setLayoutData(fdTimeOut);

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wTimeOut);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wName.addSelectionListener(lsDef);
    wHostname.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();
    BaseStepDialog.setSize(shell);

    shell.open();
    props.setDialogSize(shell, "JobTelnetDialogSize");
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return jobEntry;
  }
  public boolean open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    shell.setImage(GUIResource.getInstance().getImageSlave());

    lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            slaveServer.setChanged();
          }
        };

    middle = props.getMiddlePct();
    margin = Const.MARGIN;

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setText(BaseMessages.getString(PKG, "SlaveServerDialog.Shell.Title"));
    shell.setLayout(formLayout);

    // First, add the buttons...

    // Buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));

    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

    Button[] buttons = new Button[] {wOK, wCancel};
    BaseStepDialog.positionBottomButtons(shell, buttons, margin, null);

    // The rest stays above the buttons...

    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);

    addServiceTab();
    addProxyTab();

    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(0, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOK, -margin);
    wTabFolder.setLayoutData(fdTabFolder);

    // Add listeners
    wOK.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        });
    wCancel.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        });

    SelectionAdapter selAdapter =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };
    wUsername.addSelectionListener(selAdapter);
    wPassword.addSelectionListener(selAdapter);
    wHostname.addSelectionListener(selAdapter);
    wPort.addSelectionListener(selAdapter);
    wWebAppName.addSelectionListener(selAdapter);
    wProxyHost.addSelectionListener(selAdapter);
    wProxyPort.addSelectionListener(selAdapter);
    wNonProxyHosts.addSelectionListener(selAdapter);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    wTabFolder.setSelection(0);

    getData();

    BaseStepDialog.setSize(shell);

    shell.open();
    Display display = parent.getDisplay();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return ok;
  }
  public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
          }
        };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.Title"));

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

    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    wlFields = new Label(shell, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    // fdlFields.right= new FormAttachment(middle, -margin);
    fdlFields.top = new FormAttachment(wName, 2 * margin);
    wlFields.setLayoutData(fdlFields);

    // Buttons to the right of the screen...
    wbdSourceFileFolder = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbdSourceFileFolder);
    wbdSourceFileFolder.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.DeleteEntry"));
    wbdSourceFileFolder.setToolTipText(
        BaseMessages.getString(PKG, "JobCheckDbConnections.DeleteSourceFileButton.Label"));
    fdbdSourceFileFolder = new FormData();
    fdbdSourceFileFolder.right = new FormAttachment(100, -margin);
    fdbdSourceFileFolder.top = new FormAttachment(wlFields, 50);
    wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder);

    // Buttons to the right of the screen...
    wbgetConnections = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbgetConnections);
    wbgetConnections.setText(BaseMessages.getString(PKG, "JobCheckDbConnections.GetConnections"));
    wbgetConnections.setToolTipText(
        BaseMessages.getString(PKG, "JobCheckDbConnections.GetConnections.Tooltip"));
    fdbgetConnections = new FormData();
    fdbgetConnections.right = new FormAttachment(100, -margin);
    fdbgetConnections.top = new FormAttachment(wlFields, 20);
    wbgetConnections.setLayoutData(fdbgetConnections);

    addDatabases();

    int rows =
        jobEntry.connections == null
            ? 1
            : (jobEntry.connections.length == 0 ? 0 : jobEntry.connections.length);

    final int FieldsRows = rows;

    ColumnInfo[] colinf =
        new ColumnInfo[] {
          new ColumnInfo(
              BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.Argument.Label"),
              ColumnInfo.COLUMN_TYPE_CCOMBO,
              connections,
              false),
          new ColumnInfo(
              BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.WaitFor.Label"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false),
          new ColumnInfo(
              BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.WaitForTime.Label"),
              ColumnInfo.COLUMN_TYPE_CCOMBO,
              JobEntryCheckDbConnections.unitTimeDesc,
              false),
        };

    colinf[0].setToolTip(BaseMessages.getString(PKG, "JobCheckDbConnections.Fields.Column"));
    colinf[1].setUsingVariables(true);
    colinf[1].setToolTip(BaseMessages.getString(PKG, "JobCheckDbConnections.WaitFor.ToolTip"));

    wFields =
        new TableView(
            jobMeta,
            shell,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
            colinf,
            FieldsRows,
            lsMod,
            props);

    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(wbgetConnections, -margin);
    fdFields.bottom = new FormAttachment(100, -50);
    wFields.setLayoutData(fdFields);

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    FormData fd = new FormData();
    fd.right = new FormAttachment(50, -10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wOK.setLayoutData(fd);

    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    fd = new FormData();
    fd.left = new FormAttachment(50, 10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wCancel.setLayoutData(fd);

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wFields);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };
    // Delete files from the list of files...
    wbdSourceFileFolder.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            int idx[] = wFields.getSelectionIndices();
            wFields.remove(idx);
            wFields.removeEmptyRows();
            wFields.setRowNums();
          }
        });

    // get connections...
    wbgetConnections.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            getDatabases();
          }
        });

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wName.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();

    BaseStepDialog.setSize(shell);

    shell.open();
    props.setDialogSize(shell, "JobCheckDbConnectionsDialogSize");
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return jobEntry;
  }
  public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
          }
        };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(Messages.getString("JobXMLWellFormed.Title"));

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

    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(Messages.getString("JobXMLWellFormed.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);

    //////////////////////////
    // START OF GENERAL TAB   ///
    //////////////////////////

    wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(Messages.getString("JobXMLWellFormed.Tab.General.Label"));

    wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);

    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);

    // SETTINGS grouping?
    // ////////////////////////
    // START OF SETTINGS GROUP
    //

    wSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wSettings);
    wSettings.setText(Messages.getString("JobXMLWellFormed.Settings.Label"));

    FormLayout groupLayout = new FormLayout();
    groupLayout.marginWidth = 10;
    groupLayout.marginHeight = 10;
    wSettings.setLayout(groupLayout);

    wlIncludeSubfolders = new Label(wSettings, SWT.RIGHT);
    wlIncludeSubfolders.setText(Messages.getString("JobXMLWellFormed.IncludeSubfolders.Label"));
    props.setLook(wlIncludeSubfolders);
    fdlIncludeSubfolders = new FormData();
    fdlIncludeSubfolders.left = new FormAttachment(0, 0);
    fdlIncludeSubfolders.top = new FormAttachment(wName, margin);
    fdlIncludeSubfolders.right = new FormAttachment(middle, -margin);
    wlIncludeSubfolders.setLayoutData(fdlIncludeSubfolders);
    wIncludeSubfolders = new Button(wSettings, SWT.CHECK);
    props.setLook(wIncludeSubfolders);
    wIncludeSubfolders.setToolTipText(
        Messages.getString("JobXMLWellFormed.IncludeSubfolders.Tooltip"));
    fdIncludeSubfolders = new FormData();
    fdIncludeSubfolders.left = new FormAttachment(middle, 0);
    fdIncludeSubfolders.top = new FormAttachment(wName, margin);
    fdIncludeSubfolders.right = new FormAttachment(100, 0);
    wIncludeSubfolders.setLayoutData(fdIncludeSubfolders);
    wIncludeSubfolders.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
          }
        });

    // previous
    wlPrevious = new Label(wSettings, SWT.RIGHT);
    wlPrevious.setText(Messages.getString("JobXMLWellFormed.Previous.Label"));
    props.setLook(wlPrevious);
    fdlPrevious = new FormData();
    fdlPrevious.left = new FormAttachment(0, 0);
    fdlPrevious.top = new FormAttachment(wIncludeSubfolders, margin);
    fdlPrevious.right = new FormAttachment(middle, -margin);
    wlPrevious.setLayoutData(fdlPrevious);
    wPrevious = new Button(wSettings, SWT.CHECK);
    props.setLook(wPrevious);
    wPrevious.setSelection(jobEntry.arg_from_previous);
    wPrevious.setToolTipText(Messages.getString("JobXMLWellFormed.Previous.Tooltip"));
    fdPrevious = new FormData();
    fdPrevious.left = new FormAttachment(middle, 0);
    fdPrevious.top = new FormAttachment(wIncludeSubfolders, margin);
    fdPrevious.right = new FormAttachment(100, 0);
    wPrevious.setLayoutData(fdPrevious);
    wPrevious.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {

            RefreshArgFromPrevious();
          }
        });
    fdSettings = new FormData();
    fdSettings.left = new FormAttachment(0, margin);
    fdSettings.top = new FormAttachment(wName, margin);
    fdSettings.right = new FormAttachment(100, -margin);
    wSettings.setLayoutData(fdSettings);

    // ///////////////////////////////////////////////////////////
    // / END OF SETTINGS GROUP
    // ///////////////////////////////////////////////////////////

    // SourceFileFolder line
    wlSourceFileFolder = new Label(wGeneralComp, SWT.RIGHT);
    wlSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.SourceFileFolder.Label"));
    props.setLook(wlSourceFileFolder);
    fdlSourceFileFolder = new FormData();
    fdlSourceFileFolder.left = new FormAttachment(0, 0);
    fdlSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
    fdlSourceFileFolder.right = new FormAttachment(middle, -margin);
    wlSourceFileFolder.setLayoutData(fdlSourceFileFolder);

    // Browse Source folders button ...
    wbSourceDirectory = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSourceDirectory);
    wbSourceDirectory.setText(Messages.getString("JobXMLWellFormed.BrowseFolders.Label"));
    fdbSourceDirectory = new FormData();
    fdbSourceDirectory.right = new FormAttachment(100, 0);
    fdbSourceDirectory.top = new FormAttachment(wSettings, margin);
    wbSourceDirectory.setLayoutData(fdbSourceDirectory);

    wbSourceDirectory.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
            if (wSourceFileFolder.getText() != null) {
              ddialog.setFilterPath(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
            }

            // Calling open() will open and run the dialog.
            // It will return the selected directory, or
            // null if user cancels
            String dir = ddialog.open();
            if (dir != null) {
              // Set the text box to the new selection
              wSourceFileFolder.setText(dir);
            }
          }
        });

    // Browse Source files button ...
    wbSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbSourceFileFolder);
    wbSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.BrowseFiles.Label"));
    fdbSourceFileFolder = new FormData();
    fdbSourceFileFolder.right = new FormAttachment(wbSourceDirectory, -margin);
    fdbSourceFileFolder.top = new FormAttachment(wSettings, margin);
    wbSourceFileFolder.setLayoutData(fdbSourceFileFolder);

    // Browse Destination file add button ...
    wbaSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbaSourceFileFolder);
    wbaSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameAdd.Button"));
    fdbaSourceFileFolder = new FormData();
    fdbaSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -margin);
    fdbaSourceFileFolder.top = new FormAttachment(wSettings, margin);
    wbaSourceFileFolder.setLayoutData(fdbaSourceFileFolder);

    wSourceFileFolder = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSourceFileFolder.setToolTipText(
        Messages.getString("JobXMLWellFormed.SourceFileFolder.Tooltip"));

    props.setLook(wSourceFileFolder);
    wSourceFileFolder.addModifyListener(lsMod);
    fdSourceFileFolder = new FormData();
    fdSourceFileFolder.left = new FormAttachment(middle, 0);
    fdSourceFileFolder.top = new FormAttachment(wSettings, 2 * margin);
    fdSourceFileFolder.right = new FormAttachment(wbSourceFileFolder, -55);
    wSourceFileFolder.setLayoutData(fdSourceFileFolder);

    // Whenever something changes, set the tooltip to the expanded version:
    wSourceFileFolder.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            wSourceFileFolder.setToolTipText(
                jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
          }
        });

    wbSourceFileFolder.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] {"*.xml;*.XML", "*"});
            if (wSourceFileFolder.getText() != null) {
              dialog.setFileName(jobMeta.environmentSubstitute(wSourceFileFolder.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
              wSourceFileFolder.setText(
                  dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
          }
        });

    // Buttons to the right of the screen...
    wbdSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbdSourceFileFolder);
    wbdSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameDelete.Button"));
    wbdSourceFileFolder.setToolTipText(
        Messages.getString("JobXMLWellFormed.FilenameDelete.Tooltip"));
    fdbdSourceFileFolder = new FormData();
    fdbdSourceFileFolder.right = new FormAttachment(100, 0);
    fdbdSourceFileFolder.top = new FormAttachment(wSourceFileFolder, 40);
    wbdSourceFileFolder.setLayoutData(fdbdSourceFileFolder);

    wbeSourceFileFolder = new Button(wGeneralComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbeSourceFileFolder);
    wbeSourceFileFolder.setText(Messages.getString("JobXMLWellFormed.FilenameEdit.Button"));
    wbeSourceFileFolder.setToolTipText(Messages.getString("JobXMLWellFormed.FilenameEdit.Tooltip"));
    fdbeSourceFileFolder = new FormData();
    fdbeSourceFileFolder.right = new FormAttachment(100, 0);
    fdbeSourceFileFolder.left = new FormAttachment(wbdSourceFileFolder, 0, SWT.LEFT);
    fdbeSourceFileFolder.top = new FormAttachment(wbdSourceFileFolder, margin);
    wbeSourceFileFolder.setLayoutData(fdbeSourceFileFolder);

    // Wildcard
    wlWildcard = new Label(wGeneralComp, SWT.RIGHT);
    wlWildcard.setText(Messages.getString("JobXMLWellFormed.Wildcard.Label"));
    props.setLook(wlWildcard);
    fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wSourceFileFolder, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);

    wWildcard = new TextVar(jobMeta, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wWildcard.setToolTipText(Messages.getString("JobXMLWellFormed.Wildcard.Tooltip"));
    props.setLook(wWildcard);
    wWildcard.addModifyListener(lsMod);
    fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wSourceFileFolder, margin);
    fdWildcard.right = new FormAttachment(wbSourceFileFolder, -55);
    wWildcard.setLayoutData(fdWildcard);

    wlFields = new Label(wGeneralComp, SWT.NONE);
    wlFields.setText(Messages.getString("JobXMLWellFormed.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.right = new FormAttachment(middle, -margin);
    fdlFields.top = new FormAttachment(wWildcard, margin);
    wlFields.setLayoutData(fdlFields);

    int rows =
        jobEntry.source_filefolder == null
            ? 1
            : (jobEntry.source_filefolder.length == 0 ? 0 : jobEntry.source_filefolder.length);
    final int FieldsRows = rows;

    ColumnInfo[] colinf =
        new ColumnInfo[] {
          new ColumnInfo(
              Messages.getString("JobXMLWellFormed.Fields.SourceFileFolder.Label"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false),
          new ColumnInfo(
              Messages.getString("JobXMLWellFormed.Fields.Wildcard.Label"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false),
        };

    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(Messages.getString("JobXMLWellFormed.Fields.SourceFileFolder.Tooltip"));
    colinf[1].setUsingVariables(true);
    colinf[1].setToolTip(Messages.getString("JobXMLWellFormed.Fields.Wildcard.Tooltip"));

    wFields =
        new TableView(
            jobMeta,
            wGeneralComp,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
            colinf,
            FieldsRows,
            lsMod,
            props);

    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(100, -75);
    fdFields.bottom = new FormAttachment(100, -margin);
    wFields.setLayoutData(fdFields);

    RefreshArgFromPrevious();

    // Add the file to the list of files...
    SelectionAdapter selA =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            wFields.add(new String[] {wSourceFileFolder.getText(), wWildcard.getText()});
            wSourceFileFolder.setText("");

            wWildcard.setText("");
            wFields.removeEmptyRows();
            wFields.setRowNums();
            wFields.optWidth(true);
          }
        };
    wbaSourceFileFolder.addSelectionListener(selA);
    wSourceFileFolder.addSelectionListener(selA);

    // Delete files from the list of files...
    wbdSourceFileFolder.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            int idx[] = wFields.getSelectionIndices();
            wFields.remove(idx);
            wFields.removeEmptyRows();
            wFields.setRowNums();
          }
        });

    // Edit the selected file & remove from the list...
    wbeSourceFileFolder.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            int idx = wFields.getSelectionIndex();
            if (idx >= 0) {
              String string[] = wFields.getItem(idx);
              wSourceFileFolder.setText(string[0]);
              wWildcard.setText(string[1]);
              wFields.remove(idx);
            }
            wFields.removeEmptyRows();
            wFields.setRowNums();
          }
        });

    fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);

    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);

    /////////////////////////////////////////////////////////////
    /// END OF GENERAL TAB
    /////////////////////////////////////////////////////////////

    //////////////////////////////////////
    // START OF ADVANCED  TAB   ///
    /////////////////////////////////////

    wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
    wAdvancedTab.setText(Messages.getString("JobXMLWellFormed.Tab.Advanced.Label"));

    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;

    wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wAdvancedComp);
    wAdvancedComp.setLayout(contentLayout);

    // SuccessOngrouping?
    // ////////////////////////
    // START OF SUCCESS ON GROUP///
    // /
    wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE);
    props.setLook(wSuccessOn);
    wSuccessOn.setText(Messages.getString("JobXMLWellFormed.SuccessOn.Group.Label"));

    FormLayout successongroupLayout = new FormLayout();
    successongroupLayout.marginWidth = 10;
    successongroupLayout.marginHeight = 10;

    wSuccessOn.setLayout(successongroupLayout);

    // Success Condition
    wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
    wlSuccessCondition.setText(Messages.getString("JobXMLWellFormed.SuccessCondition.Label"));
    props.setLook(wlSuccessCondition);
    fdlSuccessCondition = new FormData();
    fdlSuccessCondition.left = new FormAttachment(0, 0);
    fdlSuccessCondition.right = new FormAttachment(middle, 0);
    fdlSuccessCondition.top = new FormAttachment(0, margin);
    wlSuccessCondition.setLayoutData(fdlSuccessCondition);
    wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wSuccessCondition.add(Messages.getString("JobXMLWellFormed.SuccessWhenAllWorksFine.Label"));
    wSuccessCondition.add(Messages.getString("JobXMLWellFormed.SuccessWhenAtLeat.Label"));
    wSuccessCondition.add(
        Messages.getString("JobXMLWellFormed.SuccessWhenBadFormedLessThan.Label"));
    wSuccessCondition.select(0); // +1: starts at -1

    props.setLook(wSuccessCondition);
    fdSuccessCondition = new FormData();
    fdSuccessCondition.left = new FormAttachment(middle, 0);
    fdSuccessCondition.top = new FormAttachment(0, margin);
    fdSuccessCondition.right = new FormAttachment(100, 0);
    wSuccessCondition.setLayoutData(fdSuccessCondition);
    wSuccessCondition.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            activeSuccessCondition();
          }
        });

    // Success when number of errors less than
    wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT);
    wlNrErrorsLessThan.setText(Messages.getString("JobXMLWellFormed.NrBadFormedLessThan.Label"));
    props.setLook(wlNrErrorsLessThan);
    fdlNrErrorsLessThan = new FormData();
    fdlNrErrorsLessThan.left = new FormAttachment(0, 0);
    fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
    fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin);
    wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan);

    wNrErrorsLessThan =
        new TextVar(
            jobMeta,
            wSuccessOn,
            SWT.SINGLE | SWT.LEFT | SWT.BORDER,
            Messages.getString("JobXMLWellFormed.NrBadFormedLessThan.Tooltip"));
    props.setLook(wNrErrorsLessThan);
    wNrErrorsLessThan.addModifyListener(lsMod);
    fdNrErrorsLessThan = new FormData();
    fdNrErrorsLessThan.left = new FormAttachment(middle, 0);
    fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
    fdNrErrorsLessThan.right = new FormAttachment(100, -margin);
    wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan);

    fdSuccessOn = new FormData();
    fdSuccessOn.left = new FormAttachment(0, margin);
    fdSuccessOn.top = new FormAttachment(0, margin);
    fdSuccessOn.right = new FormAttachment(100, -margin);
    wSuccessOn.setLayoutData(fdSuccessOn);
    // ///////////////////////////////////////////////////////////
    // / END OF Success ON GROUP
    // ///////////////////////////////////////////////////////////

    // fileresult grouping?
    // ////////////////////////
    // START OF LOGGING GROUP///
    // /
    wFileResult = new Group(wAdvancedComp, SWT.SHADOW_NONE);
    props.setLook(wFileResult);
    wFileResult.setText(Messages.getString("JobXMLWellFormed.FileResult.Group.Label"));

    FormLayout fileresultgroupLayout = new FormLayout();
    fileresultgroupLayout.marginWidth = 10;
    fileresultgroupLayout.marginHeight = 10;

    wFileResult.setLayout(fileresultgroupLayout);

    // Add Filenames to result filenames?
    wlAddFilenameToResult = new Label(wFileResult, SWT.RIGHT);
    wlAddFilenameToResult.setText(Messages.getString("JobXMLWellFormed.AddFilenameToResult.Label"));
    props.setLook(wlAddFilenameToResult);
    fdlAddFilenameToResult = new FormData();
    fdlAddFilenameToResult.left = new FormAttachment(0, 0);
    fdlAddFilenameToResult.right = new FormAttachment(middle, 0);
    fdlAddFilenameToResult.top = new FormAttachment(0, margin);
    wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
    wAddFilenameToResult = new CCombo(wFileResult, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wAddFilenameToResult.add(Messages.getString("JobXMLWellFormed.AddAllFilenamesToResult.Label"));
    wAddFilenameToResult.add(
        Messages.getString("JobXMLWellFormed.AddOnlyWellFormedFilenames.Label"));
    wAddFilenameToResult.add(
        Messages.getString("JobXMLWellFormed.AddOnlyBadFormedFilenames.Label"));
    wAddFilenameToResult.select(0); // +1: starts at -1

    props.setLook(wAddFilenameToResult);
    fdAddFilenameToResult = new FormData();
    fdAddFilenameToResult.left = new FormAttachment(middle, 0);
    fdAddFilenameToResult.top = new FormAttachment(0, margin);
    fdAddFilenameToResult.right = new FormAttachment(100, 0);
    wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
    wAddFilenameToResult.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {}
        });

    fdFileResult = new FormData();
    fdFileResult.left = new FormAttachment(0, margin);
    fdFileResult.top = new FormAttachment(wSuccessOn, margin);
    fdFileResult.right = new FormAttachment(100, -margin);
    wFileResult.setLayoutData(fdFileResult);
    // ///////////////////////////////////////////////////////////
    // / END OF FilesResult GROUP
    // ///////////////////////////////////////////////////////////

    fdAdvancedComp = new FormData();
    fdAdvancedComp.left = new FormAttachment(0, 0);
    fdAdvancedComp.top = new FormAttachment(0, 0);
    fdAdvancedComp.right = new FormAttachment(100, 0);
    fdAdvancedComp.bottom = new FormAttachment(100, 0);
    wAdvancedComp.setLayoutData(wAdvancedComp);

    wAdvancedComp.layout();
    wAdvancedTab.setControl(wAdvancedComp);

    /////////////////////////////////////////////////////////////
    /// END OF ADVANCED TAB
    /////////////////////////////////////////////////////////////

    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(Messages.getString("System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(Messages.getString("System.Button.Cancel"));

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wTabFolder);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wName.addSelectionListener(lsDef);
    wSourceFileFolder.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();
    activeSuccessCondition();

    activeSuccessCondition();

    wTabFolder.setSelection(0);
    BaseStepDialog.setSize(shell);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return jobEntry;
  }
  public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
          }
        };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobWaitForFile.Title"));

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

    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobWaitForFile.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    // Filename line
    wlFilename = new Label(shell, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "JobWaitForFile.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wName, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);

    wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFilename);
    wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wName, 0);
    wbFilename.setLayoutData(fdbFilename);

    wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.top = new FormAttachment(wName, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);

    // Whenever something changes, set the tooltip to the expanded version:
    wFilename.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
          }
        });

    wbFilename.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] {"*"});
            if (wFilename.getText() != null) {
              dialog.setFileName(jobMeta.environmentSubstitute(wFilename.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
              wFilename.setText(
                  dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
          }
        });

    // Maximum timeout
    wlMaximumTimeout = new Label(shell, SWT.RIGHT);
    wlMaximumTimeout.setText(BaseMessages.getString(PKG, "JobWaitForFile.MaximumTimeout.Label"));
    props.setLook(wlMaximumTimeout);
    fdlMaximumTimeout = new FormData();
    fdlMaximumTimeout.left = new FormAttachment(0, 0);
    fdlMaximumTimeout.top = new FormAttachment(wFilename, margin);
    fdlMaximumTimeout.right = new FormAttachment(middle, -margin);
    wlMaximumTimeout.setLayoutData(fdlMaximumTimeout);
    wMaximumTimeout = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMaximumTimeout);
    wMaximumTimeout.setToolTipText(
        BaseMessages.getString(PKG, "JobWaitForFile.MaximumTimeout.Tooltip"));
    wMaximumTimeout.addModifyListener(lsMod);
    fdMaximumTimeout = new FormData();
    fdMaximumTimeout.left = new FormAttachment(middle, 0);
    fdMaximumTimeout.top = new FormAttachment(wFilename, margin);
    fdMaximumTimeout.right = new FormAttachment(100, 0);
    wMaximumTimeout.setLayoutData(fdMaximumTimeout);

    // Cycle time
    wlCheckCycleTime = new Label(shell, SWT.RIGHT);
    wlCheckCycleTime.setText(BaseMessages.getString(PKG, "JobWaitForFile.CheckCycleTime.Label"));
    props.setLook(wlCheckCycleTime);
    fdlCheckCycleTime = new FormData();
    fdlCheckCycleTime.left = new FormAttachment(0, 0);
    fdlCheckCycleTime.top = new FormAttachment(wMaximumTimeout, margin);
    fdlCheckCycleTime.right = new FormAttachment(middle, -margin);
    wlCheckCycleTime.setLayoutData(fdlCheckCycleTime);
    wCheckCycleTime = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wCheckCycleTime);
    wCheckCycleTime.setToolTipText(
        BaseMessages.getString(PKG, "JobWaitForFile.CheckCycleTime.Tooltip"));
    wCheckCycleTime.addModifyListener(lsMod);
    fdCheckCycleTime = new FormData();
    fdCheckCycleTime.left = new FormAttachment(middle, 0);
    fdCheckCycleTime.top = new FormAttachment(wMaximumTimeout, margin);
    fdCheckCycleTime.right = new FormAttachment(100, 0);
    wCheckCycleTime.setLayoutData(fdCheckCycleTime);

    // Success on timeout
    wlSuccesOnTimeout = new Label(shell, SWT.RIGHT);
    wlSuccesOnTimeout.setText(BaseMessages.getString(PKG, "JobWaitForFile.SuccessOnTimeout.Label"));
    props.setLook(wlSuccesOnTimeout);
    fdlSuccesOnTimeout = new FormData();
    fdlSuccesOnTimeout.left = new FormAttachment(0, 0);
    fdlSuccesOnTimeout.top = new FormAttachment(wCheckCycleTime, margin);
    fdlSuccesOnTimeout.right = new FormAttachment(middle, -margin);
    wlSuccesOnTimeout.setLayoutData(fdlSuccesOnTimeout);
    wSuccesOnTimeout = new Button(shell, SWT.CHECK);
    props.setLook(wSuccesOnTimeout);
    wSuccesOnTimeout.setToolTipText(
        BaseMessages.getString(PKG, "JobWaitForFile.SuccessOnTimeout.Tooltip"));
    fdSuccesOnTimeout = new FormData();
    fdSuccesOnTimeout.left = new FormAttachment(middle, 0);
    fdSuccesOnTimeout.top = new FormAttachment(wCheckCycleTime, margin);
    fdSuccesOnTimeout.right = new FormAttachment(100, 0);
    wSuccesOnTimeout.setLayoutData(fdSuccesOnTimeout);
    wSuccesOnTimeout.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
          }
        });

    // Check file size
    wlFileSizeCheck = new Label(shell, SWT.RIGHT);
    wlFileSizeCheck.setText(BaseMessages.getString(PKG, "JobWaitForFile.FileSizeCheck.Label"));
    props.setLook(wlFileSizeCheck);
    fdlFileSizeCheck = new FormData();
    fdlFileSizeCheck.left = new FormAttachment(0, 0);
    fdlFileSizeCheck.top = new FormAttachment(wSuccesOnTimeout, margin);
    fdlFileSizeCheck.right = new FormAttachment(middle, -margin);
    wlFileSizeCheck.setLayoutData(fdlFileSizeCheck);
    wFileSizeCheck = new Button(shell, SWT.CHECK);
    props.setLook(wFileSizeCheck);
    wFileSizeCheck.setToolTipText(
        BaseMessages.getString(PKG, "JobWaitForFile.FileSizeCheck.Tooltip"));
    fdFileSizeCheck = new FormData();
    fdFileSizeCheck.left = new FormAttachment(middle, 0);
    fdFileSizeCheck.top = new FormAttachment(wSuccesOnTimeout, margin);
    fdFileSizeCheck.right = new FormAttachment(100, 0);
    wFileSizeCheck.setLayoutData(fdFileSizeCheck);
    wFileSizeCheck.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
          }
        });
    // Add filename to result filenames
    wlAddFilenameResult = new Label(shell, SWT.RIGHT);
    wlAddFilenameResult.setText(
        BaseMessages.getString(PKG, "JobWaitForFile.AddFilenameResult.Label"));
    props.setLook(wlAddFilenameResult);
    fdlAddFilenameResult = new FormData();
    fdlAddFilenameResult.left = new FormAttachment(0, 0);
    fdlAddFilenameResult.top = new FormAttachment(wFileSizeCheck, margin);
    fdlAddFilenameResult.right = new FormAttachment(middle, -margin);
    wlAddFilenameResult.setLayoutData(fdlAddFilenameResult);
    wAddFilenameResult = new Button(shell, SWT.CHECK);
    props.setLook(wAddFilenameResult);
    wAddFilenameResult.setToolTipText(
        BaseMessages.getString(PKG, "JobWaitForFile.AddFilenameResult.Tooltip"));
    fdAddFilenameResult = new FormData();
    fdAddFilenameResult.left = new FormAttachment(middle, 0);
    fdAddFilenameResult.top = new FormAttachment(wFileSizeCheck, margin);
    fdAddFilenameResult.right = new FormAttachment(100, 0);
    wAddFilenameResult.setLayoutData(fdAddFilenameResult);
    wAddFilenameResult.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
          }
        });
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

    BaseStepDialog.positionBottomButtons(
        shell, new Button[] {wOK, wCancel}, margin, wAddFilenameResult);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wName.addSelectionListener(lsDef);
    wFilename.addSelectionListener(lsDef);
    wMaximumTimeout.addSelectionListener(lsDef);
    wCheckCycleTime.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();

    BaseStepDialog.setSize(shell);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return jobEntry;
  }
  public RepositoryDirectoryInterface open() {
    dircolor = GUIResource.getInstance().getColorDirectory();

    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    shell.setImage(GUIResource.getInstance().getImageSpoon());
    shell.setText(BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.Main.Title"));

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);

    // Tree
    wTree = new Tree(shell, SWT.SINGLE | SWT.BORDER);
    props.setLook(wTree);

    try {
      // We're terrible and load the entire repository, disable lazy loading if set
      if (rep instanceof RepositoryExtended) {
        RepositoryExtended repositoryExtended = (RepositoryExtended) this.rep;
        repositoryTree = repositoryExtended.loadRepositoryDirectoryTree(true);
      } else {
        repositoryTree = this.rep.loadRepositoryDirectoryTree();
      }
    } catch (KettleException e) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(
              PKG, "SelectDirectoryDialog.Dialog.ErrorRefreshingDirectoryTree.Title"),
          BaseMessages.getString(
              PKG, "SelectDirectoryDialog.Dialog.ErrorRefreshingDirectoryTree.Message"),
          e);
      return null;
    }

    if (!getData()) {
      return null;
    }

    // Buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));

    wRefresh = new Button(shell, SWT.PUSH);
    wRefresh.setText(BaseMessages.getString(PKG, "System.Button.Refresh"));

    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

    FormData fdTree = new FormData();
    FormData fdOK = new FormData();
    FormData fdRefresh = new FormData();
    FormData fdCancel = new FormData();

    int margin = 10;

    fdTree.left = new FormAttachment(0, 0); // To the right of the label
    fdTree.top = new FormAttachment(0, 0);
    fdTree.right = new FormAttachment(100, 0);
    fdTree.bottom = new FormAttachment(100, -50);
    wTree.setLayoutData(fdTree);

    fdOK.left = new FormAttachment(wTree, 0, SWT.CENTER);
    fdOK.bottom = new FormAttachment(100, -margin);
    wOK.setLayoutData(fdOK);

    fdRefresh.left = new FormAttachment(wOK, 10);
    fdRefresh.bottom = new FormAttachment(100, -margin);
    wRefresh.setLayoutData(fdRefresh);

    fdCancel.left = new FormAttachment(wRefresh, 10);
    fdCancel.bottom = new FormAttachment(100, -margin);
    wCancel.setLayoutData(fdCancel);

    // Add listeners
    wCancel.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            dispose();
          }
        });

    // Add listeners
    wOK.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            handleOK();
          }
        });

    wTree.addSelectionListener(
        new SelectionAdapter() {
          private String getSelectedPath(SelectionEvent selectionEvent) {
            TreeItem treeItem = (TreeItem) selectionEvent.item;
            String path;
            if (treeItem.getParentItem() == null) {
              path = treeItem.getText();
            } else {
              path = ConstUI.getTreePath(treeItem, 0);
            }
            return path;
          }

          private boolean isSelectedPathRestricted(SelectionEvent selectionEvent) {
            String path = getSelectedPath(selectionEvent);
            boolean isRestricted = isRestrictedPath(path);
            return isRestricted;
          }

          public void widgetDefaultSelected(SelectionEvent selectionEvent) {
            if (isSelectedPathRestricted(selectionEvent)) {
              return;
            }
            handleOK();
          }

          public void widgetSelected(SelectionEvent selectionEvent) {
            boolean restricted = isSelectedPathRestricted(selectionEvent);
            wOK.setEnabled(!restricted);
          }
        });

    wRefresh.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            getData();
          }
        });

    wTree.addMenuDetectListener(
        new MenuDetectListener() {
          public void menuDetected(MenuDetectEvent e) {
            setTreeMenu();
          }
        });

    BaseStepDialog.setSize(shell);

    shell.open();
    Display display = parent.getDisplay();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return selection;
  }
  public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell =
        new Shell(
            parent,
            SWT.DIALOG_TRIM
                | (modal ? SWT.APPLICATION_MODAL | SWT.SHEET : SWT.NONE)
                | SWT.RESIZE
                | SWT.MIN
                | SWT.MAX);
    props.setLook(shell);

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(shellText);
    shell.setImage(GUIResource.getInstance().getImageSpoon());

    int margin = Const.MARGIN;

    if (quickSearch) {
      ToolBar treeTb = new ToolBar(shell, SWT.HORIZONTAL | SWT.FLAT);
      props.setLook(treeTb);

      ToolItem wtfilter = new ToolItem(treeTb, SWT.SEPARATOR);
      Label wlfilter = new Label(treeTb, SWT.SEARCH);
      props.setLook(wlfilter);
      wlfilter.setText(BaseMessages.getString(PKG, "EnterSelectionDialog.FilterString.Label"));
      wtfilter.setControl(wlfilter);
      if (Const.isOSX()) {
        wtfilter.setWidth(100);
      } else {
        wtfilter.setWidth(70);
      }

      wfilter = new ToolItem(treeTb, SWT.SEPARATOR);
      searchText = new Text(treeTb, SWT.SEARCH | SWT.CANCEL);
      props.setLook(searchText);
      searchText.setToolTipText(
          BaseMessages.getString(PKG, "EnterSelectionDialog.FilterString.ToolTip"));
      wfilter.setControl(searchText);
      wfilter.setWidth(120);

      wbRegex = new ToolItem(treeTb, SWT.CHECK);
      wbRegex.setImage(GUIResource.getInstance().getImageRegexSmall());
      wbRegex.setToolTipText(BaseMessages.getString(PKG, "EnterSelectionDialog.useRegEx.Tooltip"));

      goSearch = new ToolItem(treeTb, SWT.PUSH);
      goSearch.setImage(GUIResource.getInstance().getImageSearchSmall());
      goSearch.setToolTipText(BaseMessages.getString(PKG, "EnterSelectionDialog.refresh.Label"));

      goSearch.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
              updateFilter();
            }
          });

      if (this.databasesInterface != null) {
        addConnection = new ToolItem(treeTb, SWT.PUSH);
        addConnection.setImage(GUIResource.getInstance().getImageAdd());
        addConnection.setToolTipText(BaseMessages.getString(PKG, "Add.Datasource.Label"));

        addConnection.addSelectionListener(
            new SelectionAdapter() {
              public void widgetSelected(SelectionEvent event) {
                addDataSource();
              }
            });
      }

      FormData fd = new FormData();
      fd.right = new FormAttachment(100, -margin);
      fd.top = new FormAttachment(0, margin);
      treeTb.setLayoutData(fd);

      searchText.addSelectionListener(
          new SelectionAdapter() {
            public void widgetDefaultSelected(SelectionEvent e) {
              updateFilter();
            }
          });

      // From step line
      wlSelection = new Label(shell, SWT.NONE);
      wlSelection.setText(lineText);
      props.setLook(wlSelection);
      fdlSelection = new FormData();
      fdlSelection.left = new FormAttachment(0, 0);
      fdlSelection.top = new FormAttachment(treeTb, margin);
      wlSelection.setLayoutData(fdlSelection);
    } else {
      // From step line
      wlSelection = new Label(shell, SWT.NONE);
      wlSelection.setText(lineText);
      props.setLook(wlSelection);
      fdlSelection = new FormData();
      fdlSelection.left = new FormAttachment(0, 0);
      wlSelection.setLayoutData(fdlSelection);
    }

    int options = SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
    if (multi) {
      options |= SWT.MULTI;
    } else {
      options |= SWT.SINGLE;
    }

    wSelection = new List(shell, options);
    for (int i = 0; i < choices.length; i++) {
      wSelection.add(choices[i]);
    }
    if (selectedNrs != null) {
      wSelection.select(selectedNrs);
      wSelection.showSelection();
    }
    if (fixed) {
      props.setLook(wSelection, Props.WIDGET_STYLE_FIXED);
    } else {
      props.setLook(wSelection);
    }

    // Some buttons
    wOK = new Button(shell, SWT.PUSH);
    if (viewOnly) {
      wOK.setText(BaseMessages.getString(PKG, "System.Button.Close"));
    } else {
      wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    }
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };
    wOK.addListener(SWT.Selection, lsOK);

    Button[] buttons = new Button[] {wOK};

    if (!viewOnly) {
      wCancel = new Button(shell, SWT.PUSH);
      wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
      lsCancel =
          new Listener() {
            public void handleEvent(Event e) {
              cancel();
            }
          };
      wCancel.addListener(SWT.Selection, lsCancel);

      buttons = new Button[] {wOK, wCancel};
    }

    BaseStepDialog.positionBottomButtons(shell, buttons, margin, null);

    fdSelection = new FormData();
    fdSelection.left = new FormAttachment(0, 0);
    fdSelection.right = new FormAttachment(100, 0);
    fdSelection.top = new FormAttachment(wlSelection, margin);
    fdSelection.bottom = new FormAttachment(wOK, -margin * 3);
    wSelection.setLayoutData(fdSelection);

    // Add listeners

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };
    wSelection.addSelectionListener(lsDef);
    wSelection.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.character == SWT.CR) {
              ok();
            }
          }
        });
    // Detect [X] or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();

    BaseStepDialog.setSize(shell);

    wOK.setFocus();

    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return selection;
  }
  public JobEntryInterface open() {
    Shell parentShell = getParent();
    Display display = parentShell.getDisplay();

    shell = new Shell(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);

    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
          }
        };

    String datasets[] = null;
    AutoPopulate ap = new AutoPopulate();
    try {

      datasets = ap.parseDatasetsRecordsets(this.jobMeta.getJobCopies());

    } catch (Exception e) {
      System.out.println("Error Parsing existing Datasets");
      System.out.println(e.toString());
      datasets = new String[] {""};
    }

    backupChanged = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText("Limit");

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

    shell.setLayout(formLayout);
    shell.setText("Define an ECL Limit");

    FormLayout groupLayout = new FormLayout();
    groupLayout.marginWidth = 10;
    groupLayout.marginHeight = 10;

    // Stepname line
    Group generalGroup = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(generalGroup);
    generalGroup.setText("General Details");
    generalGroup.setLayout(groupLayout);
    FormData generalGroupFormat = new FormData();
    generalGroupFormat.top = new FormAttachment(0, margin);
    generalGroupFormat.width = 400;
    generalGroupFormat.height = 100;
    generalGroupFormat.left = new FormAttachment(middle, 0);
    generalGroup.setLayoutData(generalGroupFormat);

    jobEntryName = buildText("Job Entry Name", null, lsMod, middle, margin, generalGroup);

    // All other contols
    Group limitGroup = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(limitGroup);
    limitGroup.setText("Limit Details");
    limitGroup.setLayout(groupLayout);
    FormData limitGroupFormat = new FormData();
    limitGroupFormat.top = new FormAttachment(generalGroup, margin);
    limitGroupFormat.width = 400;
    limitGroupFormat.height = 300;
    limitGroupFormat.left = new FormAttachment(middle, 0);
    limitGroup.setLayoutData(limitGroupFormat);

    recordsetName = buildText("Result Recordset", null, lsMod, middle, margin, limitGroup);
    recordset = buildCombo("Recordset", recordsetName, lsMod, middle, margin, limitGroup, datasets);
    maxRecs = buildText("Maximum Records", recordset, lsMod, middle, margin, limitGroup);
    errorMessage = buildText("Error Message", maxRecs, lsMod, middle, margin, limitGroup);
    errorCode = buildText("Error Code", errorMessage, lsMod, middle, margin, limitGroup);
    // failClause = buildText("FAIL(<clause>)", maxRecs, lsMod, middle, margin, limitGroup);
    keyed =
        buildCombo(
            "KEYED", errorCode, lsMod, middle, margin, limitGroup, new String[] {"false", "true"});
    count =
        buildCombo(
            "COUNT", keyed, lsMod, middle, margin, limitGroup, new String[] {"false", "true"});
    skip =
        buildCombo(
            "SKIP", count, lsMod, middle, margin, limitGroup, new String[] {"false", "true"});
    // 	onFailTransform = buildText("ONFAIL(<transform>)", skip, lsMod, middle, margin, limitGroup);

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText("OK");
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText("Cancel");

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, limitGroup);

    // Add listeners
    Listener cancelListener =
        new Listener() {

          public void handleEvent(Event e) {
            cancel();
          }
        };
    Listener okListener =
        new Listener() {

          public void handleEvent(Event e) {
            ok();
          }
        };
    wCancel.addListener(SWT.Selection, cancelListener);
    wOK.addListener(SWT.Selection, okListener);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    if (jobEntry.getName() != null) {
      jobEntryName.setText(jobEntry.getName());
    }
    if (jobEntry.getRecordsetName() != null) {
      recordsetName.setText(jobEntry.getRecordsetName());
    }
    if (jobEntry.getRecordset() != null) {
      recordset.setText(jobEntry.getRecordset());
    }
    if (jobEntry.getMaxRecs() != null) {
      maxRecs.setText(jobEntry.getMaxRecs());
    }
    // if (jobEntry.getFailClause() != null) {
    //    failClause.setText(jobEntry.getFailClause());
    // }
    if (jobEntry.getErrorCode() != null) {
      errorCode.setText(jobEntry.getErrorCode());
    }
    if (jobEntry.getErrorMessage() != null) {
      errorMessage.setText(jobEntry.getErrorMessage());
    }

    if (jobEntry.getKeyedString() != null) {
      keyed.setText(jobEntry.getKeyedString());
    }
    if (jobEntry.getCountString() != null) {
      count.setText(jobEntry.getCountString());
    }
    if (jobEntry.getSkipString() != null) {
      skip.setText(jobEntry.getSkipString());
    }
    // if (jobEntry.getOnFailTransform() != null) {
    //     onFailTransform.setText(jobEntry.getOnFailTransform());
    //  }

    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }

    return jobEntry;
  }
Example #22
0
  public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, input);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            input.setChanged();
          }
        };
    changed = input.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "Edi2Xml.Shell.Title"));

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

    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);

    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);

    // edifact field line
    Label wlEdiField = new Label(shell, SWT.RIGHT);
    wlEdiField.setText(BaseMessages.getString(PKG, "Edi2Xml.InputField.Label")); // $NON-NLS-1$
    props.setLook(wlEdiField);
    FormData fdlEdiField = new FormData();
    fdlEdiField.left = new FormAttachment(0, 0);
    fdlEdiField.right = new FormAttachment(middle, -margin);
    fdlEdiField.top = new FormAttachment(wStepname, margin);
    wlEdiField.setLayoutData(fdlEdiField);

    wEdiField = new ComboVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wEdiField.setToolTipText(BaseMessages.getString(PKG, "Edi2Xml.InputField.Tooltip"));
    props.setLook(wEdiField);
    wEdiField.addModifyListener(lsMod);
    FormData fdEdiField = new FormData();
    fdEdiField.left = new FormAttachment(middle, 0);
    fdEdiField.top = new FormAttachment(wStepname, margin);
    fdEdiField.right = new FormAttachment(100, 0);
    wEdiField.setLayoutData(fdEdiField);
    wEdiField.addFocusListener(
        new FocusListener() {
          public void focusLost(org.eclipse.swt.events.FocusEvent e) {}

          public void focusGained(org.eclipse.swt.events.FocusEvent e) {
            Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
            shell.setCursor(busy);
            BaseStepDialog.getFieldsFromPrevious(wEdiField, transMeta, stepMeta);
            shell.setCursor(null);
            busy.dispose();
          }
        });

    // xml output field value
    wlXmlField = new Label(shell, SWT.RIGHT);
    wlXmlField.setText(BaseMessages.getString(PKG, "Edi2Xml.OutputField.Label"));
    props.setLook(wlXmlField);
    fdlXmlField = new FormData();
    fdlXmlField.left = new FormAttachment(0, 0);
    fdlXmlField.right = new FormAttachment(middle, -margin);
    fdlXmlField.top = new FormAttachment(wEdiField, margin);
    wlXmlField.setLayoutData(fdlXmlField);

    wXmlField = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wXmlField);
    wXmlField.setToolTipText(BaseMessages.getString(PKG, "Edi2Xml.OutputField.Tooltip"));
    wXmlField.addModifyListener(lsMod);
    fdXmlField = new FormData();
    fdXmlField.left = new FormAttachment(middle, 0);
    fdXmlField.right = new FormAttachment(100, 0);
    fdXmlField.top = new FormAttachment(wEdiField, margin);
    wXmlField.setLayoutData(fdXmlField);

    // OK and cancel buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wXmlField);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wStepname.addSelectionListener(lsDef);
    wXmlField.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    // Set the shell size, based upon previous time...
    setSize();

    getData();
    input.setChanged(changed);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return stepname;
  }
  public JobEntryInterface open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
          }
        };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Title"));

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

    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Name.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, 0);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    // Connection line
    wConnection = addConnectionLine(shell, wName, middle, margin);
    if (jobEntry.getDatabase() == null && jobMeta.nrDatabases() == 1) {
      wConnection.select(0);
    }
    wConnection.addModifyListener(lsMod);

    // Schema name line
    wlSchemaname = new Label(shell, SWT.RIGHT);
    wlSchemaname.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Schemaname.Label"));
    props.setLook(wlSchemaname);
    fdlSchemaname = new FormData();
    fdlSchemaname.left = new FormAttachment(0, 0);
    fdlSchemaname.right = new FormAttachment(middle, 0);
    fdlSchemaname.top = new FormAttachment(wConnection, margin);
    wlSchemaname.setLayoutData(fdlSchemaname);

    wSchemaname = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSchemaname);
    wSchemaname.setToolTipText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Schemaname.Tooltip"));
    wSchemaname.addModifyListener(lsMod);
    fdSchemaname = new FormData();
    fdSchemaname.left = new FormAttachment(middle, 0);
    fdSchemaname.top = new FormAttachment(wConnection, margin);
    fdSchemaname.right = new FormAttachment(100, 0);
    wSchemaname.setLayoutData(fdSchemaname);

    // Table name line
    wlTablename = new Label(shell, SWT.RIGHT);
    wlTablename.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Tablename.Label"));
    props.setLook(wlTablename);
    fdlTablename = new FormData();
    fdlTablename.left = new FormAttachment(0, 0);
    fdlTablename.right = new FormAttachment(middle, 0);
    fdlTablename.top = new FormAttachment(wSchemaname, margin);
    wlTablename.setLayoutData(fdlTablename);

    wbTable = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTable);
    wbTable.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    FormData fdbTable = new FormData();
    fdbTable.right = new FormAttachment(100, 0);
    fdbTable.top = new FormAttachment(wSchemaname, margin / 2);
    wbTable.setLayoutData(fdbTable);
    wbTable.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            getTableName();
          }
        });

    wTablename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTablename);
    wTablename.addModifyListener(lsMod);
    fdTablename = new FormData();
    fdTablename.left = new FormAttachment(middle, 0);
    fdTablename.top = new FormAttachment(wSchemaname, margin);
    fdTablename.right = new FormAttachment(wbTable, -margin);
    wTablename.setLayoutData(fdTablename);

    // Filename line
    wlFilename = new Label(shell, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wTablename, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);

    wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbFilename);
    wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wTablename, 0);
    wbFilename.setLayoutData(fdbFilename);

    wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.top = new FormAttachment(wTablename, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);

    // Whenever something changes, set the tooltip to the expanded version:
    wFilename.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
          }
        });

    wbFilename.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] {"*.txt", "*.csv", "*"});
            if (wFilename.getText() != null) {
              dialog.setFileName(jobMeta.environmentSubstitute(wFilename.getText()));
            }
            dialog.setFilterNames(FILETYPES);
            if (dialog.open() != null) {
              wFilename.setText(
                  dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
            }
          }
        });

    // Local
    wlLocalInfile = new Label(shell, SWT.RIGHT);
    wlLocalInfile.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.LocalInfile.Label"));
    props.setLook(wlLocalInfile);
    fdlLocalInfile = new FormData();
    fdlLocalInfile.left = new FormAttachment(0, 0);
    fdlLocalInfile.top = new FormAttachment(wFilename, margin);
    fdlLocalInfile.right = new FormAttachment(middle, -margin);
    wlLocalInfile.setLayoutData(fdlLocalInfile);
    wLocalInfile = new Button(shell, SWT.CHECK);
    props.setLook(wLocalInfile);
    wLocalInfile.setToolTipText(
        BaseMessages.getString(PKG, "JobMysqlBulkLoad.LocalInfile.Tooltip"));
    fdLocalInfile = new FormData();
    fdLocalInfile.left = new FormAttachment(middle, 0);
    fdLocalInfile.top = new FormAttachment(wFilename, margin);
    fdLocalInfile.right = new FormAttachment(100, 0);
    wLocalInfile.setLayoutData(fdLocalInfile);
    wLocalInfile.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
          }
        });

    // Priority
    wlProrityValue = new Label(shell, SWT.RIGHT);
    wlProrityValue.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.ProrityValue.Label"));
    props.setLook(wlProrityValue);
    fdlProrityValue = new FormData();
    fdlProrityValue.left = new FormAttachment(0, 0);
    fdlProrityValue.right = new FormAttachment(middle, 0);
    fdlProrityValue.top = new FormAttachment(wLocalInfile, margin);
    wlProrityValue.setLayoutData(fdlProrityValue);
    wProrityValue = new CCombo(shell, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProrityValue.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.NorProrityValue.Label"));
    wProrityValue.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.LowProrityValue.Label"));
    wProrityValue.add(BaseMessages.getString(PKG, "JobMysqlBulkLoad.ConProrityValue.Label"));
    wProrityValue.select(0); // +1: starts at -1

    props.setLook(wProrityValue);
    fdProrityValue = new FormData();
    fdProrityValue.left = new FormAttachment(middle, 0);
    fdProrityValue.top = new FormAttachment(wLocalInfile, margin);
    fdProrityValue.right = new FormAttachment(100, 0);
    wProrityValue.setLayoutData(fdProrityValue);

    fdProrityValue = new FormData();
    fdProrityValue.left = new FormAttachment(middle, 0);
    fdProrityValue.top = new FormAttachment(wLocalInfile, margin);
    fdProrityValue.right = new FormAttachment(100, 0);
    wProrityValue.setLayoutData(fdProrityValue);

    // Separator
    wlSeparator = new Label(shell, SWT.RIGHT);
    wlSeparator.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Separator.Label"));
    props.setLook(wlSeparator);
    fdlSeparator = new FormData();
    fdlSeparator.left = new FormAttachment(0, 0);
    fdlSeparator.right = new FormAttachment(middle, 0);
    fdlSeparator.top = new FormAttachment(wProrityValue, margin);
    wlSeparator.setLayoutData(fdlSeparator);

    wSeparator = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSeparator);
    wSeparator.addModifyListener(lsMod);
    fdSeparator = new FormData();
    fdSeparator.left = new FormAttachment(middle, 0);
    fdSeparator.top = new FormAttachment(wProrityValue, margin);
    fdSeparator.right = new FormAttachment(100, 0);
    wSeparator.setLayoutData(fdSeparator);

    // enclosed
    wlEnclosed = new Label(shell, SWT.RIGHT);
    wlEnclosed.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Enclosed.Label"));
    props.setLook(wlEnclosed);
    fdlEnclosed = new FormData();
    fdlEnclosed.left = new FormAttachment(0, 0);
    fdlEnclosed.right = new FormAttachment(middle, 0);
    fdlEnclosed.top = new FormAttachment(wSeparator, margin);
    wlEnclosed.setLayoutData(fdlEnclosed);

    wEnclosed = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wEnclosed);
    wEnclosed.addModifyListener(lsMod);
    fdEnclosed = new FormData();
    fdEnclosed.left = new FormAttachment(middle, 0);
    fdEnclosed.top = new FormAttachment(wSeparator, margin);
    fdEnclosed.right = new FormAttachment(100, 0);
    wEnclosed.setLayoutData(fdEnclosed);

    // escaped
    wlEscaped = new Label(shell, SWT.RIGHT);
    wlEscaped.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Escaped.Label"));
    props.setLook(wlEscaped);
    fdlEscaped = new FormData();
    fdlEscaped.left = new FormAttachment(0, 0);
    fdlEscaped.right = new FormAttachment(middle, 0);
    fdlEscaped.top = new FormAttachment(wEnclosed, margin);
    wlEscaped.setLayoutData(fdlEscaped);

    wEscaped = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wEscaped);
    wEscaped.setToolTipText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Escaped.Tooltip"));
    wEscaped.addModifyListener(lsMod);
    fdEscaped = new FormData();
    fdEscaped.left = new FormAttachment(middle, 0);
    fdEscaped.top = new FormAttachment(wEnclosed, margin);
    fdEscaped.right = new FormAttachment(100, 0);
    wEscaped.setLayoutData(fdEscaped);

    // Line started
    wlLinestarted = new Label(shell, SWT.RIGHT);
    wlLinestarted.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Linestarted.Label"));
    props.setLook(wlLinestarted);
    fdlLinestarted = new FormData();
    fdlLinestarted.left = new FormAttachment(0, 0);
    fdlLinestarted.right = new FormAttachment(middle, 0);
    fdlLinestarted.top = new FormAttachment(wEscaped, margin);
    wlLinestarted.setLayoutData(fdlLinestarted);

    wLinestarted = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLinestarted);
    wLinestarted.addModifyListener(lsMod);
    fdLinestarted = new FormData();
    fdLinestarted.left = new FormAttachment(middle, 0);
    fdLinestarted.top = new FormAttachment(wEscaped, margin);
    fdLinestarted.right = new FormAttachment(100, 0);
    wLinestarted.setLayoutData(fdLinestarted);

    // Line terminated
    wlLineterminated = new Label(shell, SWT.RIGHT);
    wlLineterminated.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Lineterminated.Label"));
    props.setLook(wlLineterminated);
    fdlLineterminated = new FormData();
    fdlLineterminated.left = new FormAttachment(0, 0);
    fdlLineterminated.right = new FormAttachment(middle, 0);
    fdlLineterminated.top = new FormAttachment(wLinestarted, margin);
    wlLineterminated.setLayoutData(fdlLineterminated);

    wLineterminated = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLineterminated);
    wLineterminated.addModifyListener(lsMod);
    fdLineterminated = new FormData();
    fdLineterminated.left = new FormAttachment(middle, 0);
    fdLineterminated.top = new FormAttachment(wLinestarted, margin);
    fdLineterminated.right = new FormAttachment(100, 0);
    wLineterminated.setLayoutData(fdLineterminated);

    // List of columns to set for
    wlListattribut = new Label(shell, SWT.RIGHT);
    wlListattribut.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Listattribut.Label"));
    props.setLook(wlListattribut);
    fdlListattribut = new FormData();
    fdlListattribut.left = new FormAttachment(0, 0);
    fdlListattribut.right = new FormAttachment(middle, 0);
    fdlListattribut.top = new FormAttachment(wLineterminated, margin);
    wlListattribut.setLayoutData(fdlListattribut);

    wbListattribut = new Button(shell, SWT.PUSH | SWT.CENTER);
    props.setLook(wbListattribut);
    wbListattribut.setText(BaseMessages.getString(PKG, "System.Button.Edit"));
    FormData fdbListattribut = new FormData();
    fdbListattribut.right = new FormAttachment(100, 0);
    fdbListattribut.top = new FormAttachment(wLineterminated, margin);
    wbListattribut.setLayoutData(fdbListattribut);
    wbListattribut.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            getListColumns();
          }
        });

    wListattribut = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wListattribut);
    wListattribut.setToolTipText(
        BaseMessages.getString(PKG, "JobMysqlBulkLoad.Listattribut.Tooltip"));
    wListattribut.addModifyListener(lsMod);
    fdListattribut = new FormData();
    fdListattribut.left = new FormAttachment(middle, 0);
    fdListattribut.top = new FormAttachment(wLineterminated, margin);
    fdListattribut.right = new FormAttachment(wbListattribut, -margin);
    wListattribut.setLayoutData(fdListattribut);

    // Replace data
    wlReplacedata = new Label(shell, SWT.RIGHT);
    wlReplacedata.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Replacedata.Label"));
    props.setLook(wlReplacedata);
    fdlReplacedata = new FormData();
    fdlReplacedata.left = new FormAttachment(0, 0);
    fdlReplacedata.top = new FormAttachment(wListattribut, margin);
    fdlReplacedata.right = new FormAttachment(middle, -margin);
    wlReplacedata.setLayoutData(fdlReplacedata);
    wReplacedata = new Button(shell, SWT.CHECK);
    props.setLook(wReplacedata);
    wReplacedata.setToolTipText(
        BaseMessages.getString(PKG, "JobMysqlBulkLoad.Replacedata.Tooltip"));
    fdReplacedata = new FormData();
    fdReplacedata.left = new FormAttachment(middle, 0);
    fdReplacedata.top = new FormAttachment(wListattribut, margin);
    fdReplacedata.right = new FormAttachment(100, 0);
    wReplacedata.setLayoutData(fdReplacedata);
    wReplacedata.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
          }
        });

    // Nbr of lines to ignore
    wlIgnorelines = new Label(shell, SWT.RIGHT);
    wlIgnorelines.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.Ignorelines.Label"));
    props.setLook(wlIgnorelines);
    fdlIgnorelines = new FormData();
    fdlIgnorelines.left = new FormAttachment(0, 0);
    fdlIgnorelines.right = new FormAttachment(middle, 0);
    fdlIgnorelines.top = new FormAttachment(wReplacedata, margin);
    wlIgnorelines.setLayoutData(fdlIgnorelines);

    wIgnorelines = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIgnorelines);
    wIgnorelines.addModifyListener(lsMod);
    fdIgnorelines = new FormData();
    fdIgnorelines.left = new FormAttachment(middle, 0);
    fdIgnorelines.top = new FormAttachment(wReplacedata, margin);
    fdIgnorelines.right = new FormAttachment(100, 0);
    wIgnorelines.setLayoutData(fdIgnorelines);

    // fileresult grouping?
    // ////////////////////////
    // START OF FileResult GROUP///
    // /
    wFileResult = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(wFileResult);
    wFileResult.setText(BaseMessages.getString(PKG, "JobMysqlBulkLoad.FileResult.Group.Label"));

    FormLayout groupLayout = new FormLayout();
    groupLayout.marginWidth = 10;
    groupLayout.marginHeight = 10;

    wFileResult.setLayout(groupLayout);

    // Add file to result
    wlAddFileToResult = new Label(wFileResult, SWT.RIGHT);
    wlAddFileToResult.setText(
        BaseMessages.getString(PKG, "JobMysqlBulkLoad.AddFileToResult.Label"));
    props.setLook(wlAddFileToResult);
    fdlAddFileToResult = new FormData();
    fdlAddFileToResult.left = new FormAttachment(0, 0);
    fdlAddFileToResult.top = new FormAttachment(wIgnorelines, margin);
    fdlAddFileToResult.right = new FormAttachment(middle, -margin);
    wlAddFileToResult.setLayoutData(fdlAddFileToResult);
    wAddFileToResult = new Button(wFileResult, SWT.CHECK);
    props.setLook(wAddFileToResult);
    wAddFileToResult.setToolTipText(
        BaseMessages.getString(PKG, "JobMysqlBulkLoad.AddFileToResult.Tooltip"));
    fdAddFileToResult = new FormData();
    fdAddFileToResult.left = new FormAttachment(middle, 0);
    fdAddFileToResult.top = new FormAttachment(wIgnorelines, margin);
    fdAddFileToResult.right = new FormAttachment(100, 0);
    wAddFileToResult.setLayoutData(fdAddFileToResult);
    wAddFileToResult.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            jobEntry.setChanged();
          }
        });

    fdFileResult = new FormData();
    fdFileResult.left = new FormAttachment(0, margin);
    fdFileResult.top = new FormAttachment(wIgnorelines, margin);
    fdFileResult.right = new FormAttachment(100, -margin);
    wFileResult.setLayoutData(fdFileResult);
    // ///////////////////////////////////////////////////////////
    // / END OF FilesRsult GROUP
    // ///////////////////////////////////////////////////////////

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    FormData fd = new FormData();
    fd.right = new FormAttachment(50, -10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wOK.setLayoutData(fd);

    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    fd = new FormData();
    fd.left = new FormAttachment(50, 10);
    fd.bottom = new FormAttachment(100, 0);
    fd.width = 100;
    wCancel.setLayoutData(fd);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wName.addSelectionListener(lsDef);
    wTablename.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();
    BaseStepDialog.setSize(shell);

    shell.open();
    props.setDialogSize(shell, "JobMysqlBulkLoadDialogSize");
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return jobEntry;
  }
Example #24
0
  private void get() {
    try {
      RowMetaInterface r = transMeta.getPrevStepFields(stepname);
      if (r != null && !r.isEmpty()) {
        TableItemInsertListener listener =
            new TableItemInsertListener() {
              public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v) {
                tableItem.setText(2, "=");
                return true;
              }
            };
        BaseStepDialog.getFieldsFromPrevious(
            r, wInput, 1, new int[] {1, 3}, new int[] {}, -1, -1, listener);
      }

      DatabaseMeta databaseMeta = transMeta.findDatabase(wConnection.getText());
      if (databaseMeta == null) {
        showDatabaseWarning(false);
        return;
      }

      // Fill in the parameters too
      //
      if (function != null) {

        wFunction.setText(function.getName());

        if (wInput.nrNonEmpty() != 0 || wOutput.nrNonEmpty() != 0) {
          MessageBox mb = new MessageBox(shell, SWT.YES | SWT.NO | SWT.ICON_QUESTION);
          mb.setMessage(
              BaseMessages.getString(PKG, "SapInputDialog.ClearInputOutput.DialogMessage"));
          mb.setText(BaseMessages.getString(PKG, "SapInputDialog.ClearInputOutput.DialogTitle"));
          int answer = mb.open();
          if (answer == SWT.NO) {
            return;
          }
        }

        wInput.clearAll(false);
        wOutput.clearAll(false);
        Cursor hourGlass = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
        SAPConnection sc = SAPConnectionFactory.create();
        try {
          shell.setCursor(hourGlass);
          sc.open(databaseMeta);
          SAPFunctionSignature signature = sc.getFunctionSignature(function);

          // Populate the input view
          // TODO: clean this up a bit, feels a bit messy
          //
          int rownr = 0;
          for (SAPField field : signature.getInput()) {
            TableItem item;
            if (rownr == 0) {
              item = wInput.table.getItem(0);
            } else {
              item = new TableItem(wInput.table, SWT.NONE);
            }
            rownr++;

            SapType type = getSapType(field);

            int colnr = 1;
            item.setText(colnr++, Const.NVL(field.getName(), ""));
            item.setText(colnr++, type == null ? "" : type.getDescription());
            item.setText(colnr++, Const.NVL(field.getTable(), ""));
            item.setText(colnr++, Const.NVL(field.getName(), ""));
            item.setText(colnr++, field.getTypePentaho());
          }
          wInput.setRowNums();
          wInput.optWidth(true);

          // Get the output rows
          //
          rownr = 0;
          for (SAPField field : signature.getOutput()) {
            TableItem item;
            if (rownr == 0) {
              item = wOutput.table.getItem(0);
            } else {
              item = new TableItem(wOutput.table, SWT.NONE);
            }
            rownr++;

            SapType type = getSapType(field);

            int colnr = 1;
            item.setText(colnr++, Const.NVL(field.getName(), ""));
            item.setText(colnr++, type == null ? "" : type.getDescription());
            item.setText(colnr++, Const.NVL(field.getTable(), ""));
            item.setText(colnr++, Const.NVL(field.getName(), ""));
            item.setText(colnr++, field.getTypePentaho());
          }
          wOutput.setRowNums();
          wOutput.optWidth(true);

        } catch (Exception e) {
          throw new KettleException(e);
        } finally {
          sc.close();
          shell.setCursor(null);
          hourGlass.dispose();
        }
      }
    } catch (KettleException ke) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "SapInputDialog.GetFieldsFailed.DialogTitle"),
          BaseMessages.getString(PKG, "SapInputDialog.GetFieldsFailed.DialogMessage"),
          ke);
    }
  }
  public SAPFunction open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
    props.setLook(shell);
    shell.setImage(GUIResource.getInstance().getImageSpoon());
    int middle = Const.MIDDLE_PCT;
    int margin = Const.MARGIN;

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "SapFunctionBrowser.Title"));

    // Function
    //
    wlFunction = new Label(shell, SWT.RIGHT);
    wlFunction.setText(BaseMessages.getString(PKG, "SapInputDialog.Function.Label"));
    props.setLook(wlFunction);
    FormData fdlFunction = new FormData();
    fdlFunction.left = new FormAttachment(0, 0);
    fdlFunction.right = new FormAttachment(middle, -margin);
    fdlFunction.top = new FormAttachment(0, 0);
    wlFunction.setLayoutData(fdlFunction);
    wbFunction = new Button(shell, SWT.PUSH);
    props.setLook(wbFunction);

    wbFunction.setText(BaseMessages.getString(PKG, "SapInputDialog.FindFunctionButton.Label"));
    FormData fdbFunction = new FormData();
    fdbFunction.right = new FormAttachment(100, 0);
    fdbFunction.top = new FormAttachment(0, 0);
    wbFunction.setLayoutData(fdbFunction);
    wbFunction.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            searchString = wFunction.getText();
            getData();
          }
        });

    wFunction = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFunction);
    FormData fdFunction = new FormData();
    fdFunction.left = new FormAttachment(middle, 0);
    fdFunction.right = new FormAttachment(wbFunction, -margin);
    fdFunction.top = new FormAttachment(0, margin);
    wFunction.setLayoutData(fdFunction);
    Control lastControl = wFunction;

    // The buttons at the bottom of the dialog
    //
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOK.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        });
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        });

    // Position the buttons...
    //
    BaseStepDialog.positionBottomButtons(
        shell,
        new Button[] {
          wOK, wCancel,
        },
        Const.MARGIN,
        null);

    // The search results...
    //
    ColumnInfo[] columns =
        new ColumnInfo[] {
          new ColumnInfo(
              BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Name.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Groupname.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Application.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "SapFunctionBrowser.ResultView.Description.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
        };

    wResult =
        new TableView(
            space, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, columns, 0, null, props);
    wResult.setSortable(true);

    FormData fdResults = new FormData();
    fdResults.left = new FormAttachment(0, 0);
    fdResults.top = new FormAttachment(lastControl, margin);
    fdResults.right = new FormAttachment(100, 0);
    fdResults.bottom = new FormAttachment(wOK, -3 * margin);
    wResult.setLayoutData(fdResults);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();

    // Set the shell size, based upon previous time...
    BaseStepDialog.setSize(shell);

    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }

    return function;
  }
  public Object open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setImage(GUIResource.getInstance().getImageTransGraph());
    shell.setText(shellText);

    int margin = Const.MARGIN;

    // Filename line
    wlStepname = new Label(shell, SWT.NONE);
    wlStepname.setText(originText);
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);
    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.READ_ONLY);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(wlStepname, margin);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);

    wlFields = new Label(shell, SWT.NONE);
    wlFields.setText(BaseMessages.getString(PKG, "StepFieldsDialog.Fields.Label"));
    props.setLook(wlFields);
    fdlFields = new FormData();
    fdlFields.left = new FormAttachment(0, 0);
    fdlFields.top = new FormAttachment(wlStepname, margin);
    wlFields.setLayoutData(fdlFields);

    final int FieldsRows = input.size();

    ColumnInfo[] colinf =
        new ColumnInfo[] {
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Fieldname"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Type"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Length"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Precision"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Origin"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.StorageType"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.ConversionMask"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Currency"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Decimal"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Group"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.TrimType"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
          new ColumnInfo(
              BaseMessages.getString(PKG, "StepFieldsDialog.TableCol.Comments"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false,
              true),
        };

    wFields =
        new TableView(
            variables,
            shell,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI,
            colinf,
            FieldsRows,
            true, // read-only
            null,
            props);
    wFields.optWidth(true);

    fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(wlFields, margin);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(100, -50);
    wFields.setLayoutData(fdFields);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsEdit =
        new Listener() {
          public void handleEvent(Event e) {
            edit();
          }
        };

    Button[] buttons;
    if (showEditButton) {
      wEdit = new Button(shell, SWT.PUSH);
      wEdit.setText(BaseMessages.getString(PKG, "StepFieldsDialog.Buttons.EditOrigin"));
      wEdit.addListener(SWT.Selection, lsEdit);
      wCancel = new Button(shell, SWT.PUSH);
      wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
      wCancel.addListener(SWT.Selection, lsCancel);

      buttons = new Button[] {wEdit, wCancel};
    } else {
      wClose = new Button(shell, SWT.PUSH);
      wClose.setText(BaseMessages.getString(PKG, "System.Button.Close"));
      wClose.addListener(SWT.Selection, lsCancel);
      buttons = new Button[] {wClose};
    }

    BaseStepDialog.positionBottomButtons(shell, buttons, margin, wFields);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            edit();
          }
        };

    wStepname.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    wFields.table.addMouseListener(
        new MouseListener() {
          public void mouseDoubleClick(MouseEvent arg0) {
            edit();
          }

          public void mouseDown(MouseEvent arg0) {}

          public void mouseUp(MouseEvent arg0) {}
        });

    getData();

    BaseStepDialog.setSize(shell);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    return stepname;
  }
  public JobEntryInterface open() {
    Shell parent = getParent();
    display = parent.getDisplay();

    shell = new Shell(parent, props.getJobsDialogStyle());
    props.setLook(shell);
    JobDialog.setShellImage(shell, jobEntry);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            jobEntry.setChanged();
          }
        };
    changed = jobEntry.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.Title"));

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

    // Filename line
    wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.Label"));
    props.setLook(wlName);
    fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, 0);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    fdName = new FormData();
    fdName.left = new FormAttachment(middle, margin);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);

    // eMail address
    wMailAddress =
        new LabelTextVar(
            jobMeta,
            shell,
            BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.MailAddress.Label"),
            BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.MailAddress.Tooltip"));
    wMailAddress.addModifyListener(lsMod);
    fdMailAddress = new FormData();
    fdMailAddress.left = new FormAttachment(0, 0);
    fdMailAddress.top = new FormAttachment(wName, margin);
    fdMailAddress.right = new FormAttachment(100, 0);
    wMailAddress.setLayoutData(fdMailAddress);

    // ////////////////////////
    // START OF Settings GROUP
    // ////////////////////////

    wSettingsGroup = new Group(shell, SWT.SHADOW_NONE);
    props.setLook(wSettingsGroup);
    wSettingsGroup.setText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.Group.SettingsAddress.Label"));

    FormLayout SettingsgroupLayout = new FormLayout();
    SettingsgroupLayout.marginWidth = 10;
    SettingsgroupLayout.marginHeight = 10;
    wSettingsGroup.setLayout(SettingsgroupLayout);

    // perform SMTP check?
    wlSMTPCheck = new Label(wSettingsGroup, SWT.RIGHT);
    wlSMTPCheck.setText(BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.SMTPCheck.Label"));
    props.setLook(wlSMTPCheck);
    fdlSMTPCheck = new FormData();
    fdlSMTPCheck.left = new FormAttachment(0, 0);
    fdlSMTPCheck.top = new FormAttachment(wMailAddress, margin);
    fdlSMTPCheck.right = new FormAttachment(middle, -2 * margin);
    wlSMTPCheck.setLayoutData(fdlSMTPCheck);
    wSMTPCheck = new Button(wSettingsGroup, SWT.CHECK);
    props.setLook(wSMTPCheck);
    wSMTPCheck.setToolTipText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.SMTPCheck.Tooltip"));
    fdSMTPCheck = new FormData();
    fdSMTPCheck.left = new FormAttachment(middle, -margin);
    fdSMTPCheck.top = new FormAttachment(wMailAddress, margin);
    wSMTPCheck.setLayoutData(fdSMTPCheck);
    wSMTPCheck.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            activeSMTPCheck();
          }
        });

    // TimeOut fieldname ...
    wlTimeOut = new Label(wSettingsGroup, SWT.RIGHT);
    wlTimeOut.setText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.TimeOutField.Label"));
    props.setLook(wlTimeOut);
    fdlTimeOut = new FormData();
    fdlTimeOut.left = new FormAttachment(0, 0);
    fdlTimeOut.right = new FormAttachment(middle, -2 * margin);
    fdlTimeOut.top = new FormAttachment(wSMTPCheck, margin);
    wlTimeOut.setLayoutData(fdlTimeOut);

    wTimeOut = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTimeOut.setToolTipText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.TimeOutField.Tooltip"));
    props.setLook(wTimeOut);
    wTimeOut.addModifyListener(lsMod);
    fdTimeOut = new FormData();
    fdTimeOut.left = new FormAttachment(middle, -margin);
    fdTimeOut.top = new FormAttachment(wSMTPCheck, margin);
    fdTimeOut.right = new FormAttachment(100, 0);
    wTimeOut.setLayoutData(fdTimeOut);

    // eMailSender fieldname ...
    wleMailSender = new Label(wSettingsGroup, SWT.RIGHT);
    wleMailSender.setText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.eMailSenderField.Label"));
    props.setLook(wleMailSender);
    fdleMailSender = new FormData();
    fdleMailSender.left = new FormAttachment(0, 0);
    fdleMailSender.right = new FormAttachment(middle, -2 * margin);
    fdleMailSender.top = new FormAttachment(wTimeOut, margin);
    wleMailSender.setLayoutData(fdleMailSender);

    weMailSender = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    weMailSender.setToolTipText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.eMailSenderField.Tooltip"));
    props.setLook(weMailSender);
    weMailSender.addModifyListener(lsMod);
    fdeMailSender = new FormData();
    fdeMailSender.left = new FormAttachment(middle, -margin);
    fdeMailSender.top = new FormAttachment(wTimeOut, margin);
    fdeMailSender.right = new FormAttachment(100, 0);
    weMailSender.setLayoutData(fdeMailSender);

    // DefaultSMTP fieldname ...
    wlDefaultSMTP = new Label(wSettingsGroup, SWT.RIGHT);
    wlDefaultSMTP.setText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.DefaultSMTPField.Label"));
    props.setLook(wlDefaultSMTP);
    fdlDefaultSMTP = new FormData();
    fdlDefaultSMTP.left = new FormAttachment(0, 0);
    fdlDefaultSMTP.right = new FormAttachment(middle, -2 * margin);
    fdlDefaultSMTP.top = new FormAttachment(weMailSender, margin);
    wlDefaultSMTP.setLayoutData(fdlDefaultSMTP);

    wDefaultSMTP = new TextVar(jobMeta, wSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wDefaultSMTP.setToolTipText(
        BaseMessages.getString(PKG, "JobEntryMailValidatorDialog.DefaultSMTPField.Tooltip"));
    props.setLook(wDefaultSMTP);
    wDefaultSMTP.addModifyListener(lsMod);
    fdDefaultSMTP = new FormData();
    fdDefaultSMTP.left = new FormAttachment(middle, -margin);
    fdDefaultSMTP.top = new FormAttachment(weMailSender, margin);
    fdDefaultSMTP.right = new FormAttachment(100, 0);
    wDefaultSMTP.setLayoutData(fdDefaultSMTP);

    fdSettingsGroup = new FormData();
    fdSettingsGroup.left = new FormAttachment(0, margin);
    fdSettingsGroup.top = new FormAttachment(wMailAddress, margin);
    fdSettingsGroup.right = new FormAttachment(100, -margin);
    wSettingsGroup.setLayoutData(fdSettingsGroup);

    // ///////////////////////////////////////////////////////////
    // / END OF Settings GROUP
    // ///////////////////////////////////////////////////////////

    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    // at the bottom
    BaseStepDialog.positionBottomButtons(
        shell, new Button[] {wOK, wCancel}, margin, wSettingsGroup);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };

    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wName.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    getData();
    activeSMTPCheck();
    BaseStepDialog.setSize(shell);

    shell.open();
    props.setDialogSize(shell, "JobSuccessDialogSize");
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return jobEntry;
  }
  public Object open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX);
    props.setLook(shell);

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(
        BaseMessages.getString(
            PKG, "EnterPreviewRowsDialog.Dialog.PreviewStep.Title")); // Select the preview step:
    shell.setImage(GUIResource.getInstance().getImageLogoSmall());

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

    // Filename line
    wlStepList = new Label(shell, SWT.NONE);
    wlStepList.setText(
        BaseMessages.getString(
            PKG, "EnterPreviewRowsDialog.Dialog.PreviewStep.Message")); // Step name :
    props.setLook(wlStepList);
    fdlStepList = new FormData();
    fdlStepList.left = new FormAttachment(0, 0);
    fdlStepList.top = new FormAttachment(0, margin);
    wlStepList.setLayoutData(fdlStepList);
    wStepList =
        new List(
            shell,
            SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
    for (int i = 0; i < stepNames.size(); i++) {
      wStepList.add((String) stepNames.get(i));
    }
    wStepList.select(0);
    props.setLook(wStepList);
    fdStepList = new FormData();
    fdStepList.left = new FormAttachment(middle, 0);
    fdStepList.top = new FormAttachment(0, margin);
    fdStepList.bottom = new FormAttachment(100, -60);
    fdStepList.right = new FormAttachment(100, 0);
    wStepList.setLayoutData(fdStepList);
    wStepList.addSelectionListener(
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent arg0) {
            show();
          }
        });

    wShow = new Button(shell, SWT.PUSH);
    wShow.setText(BaseMessages.getString(PKG, "System.Button.Show"));

    wClose = new Button(shell, SWT.PUSH);
    wClose.setText(BaseMessages.getString(PKG, "System.Button.Close"));

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wShow, wClose}, margin, null);
    // Add listeners
    lsShow =
        new Listener() {
          public void handleEvent(Event e) {
            show();
          }
        };
    lsClose =
        new Listener() {
          public void handleEvent(Event e) {
            close();
          }
        };

    wShow.addListener(SWT.Selection, lsShow);
    wClose.addListener(SWT.Selection, lsClose);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            close();
          }
        });

    getData();

    BaseStepDialog.setSize(shell);

    // Immediately show the only preview entry
    if (stepNames.size() == 1) {
      wStepList.select(0);
      show();
    }

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return stepname;
  }
  public void open() {
    shell = new Shell(parentShell, style);
    props.setLook(shell);
    shell.setImage(GUIResource.getInstance().getImageSpoon());

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    if (title == null) title = BaseMessages.getString(PKG, "PreviewRowsDialog.Title");
    if (message == null)
      message = BaseMessages.getString(PKG, "PreviewRowsDialog.Header", stepname);

    if (buffer != null)
      message += " " + BaseMessages.getString(PKG, "PreviewRowsDialog.NrRows", "" + buffer.size());

    shell.setLayout(formLayout);
    shell.setText(title);

    if (addFields()) {
      return;
    }

    List<Button> buttons = new ArrayList<Button>();

    wClose = new Button(shell, SWT.PUSH);
    wClose.setText(BaseMessages.getString(PKG, "System.Button.Close"));
    wClose.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event e) {
            close();
          }
        });
    buttons.add(wClose);

    if (!Const.isEmpty(loggingText)) {
      wLog = new Button(shell, SWT.PUSH);
      wLog.setText(BaseMessages.getString(PKG, "PreviewRowsDialog.Button.ShowLog"));
      wLog.addListener(
          SWT.Selection,
          new Listener() {
            public void handleEvent(Event e) {
              log();
            }
          });
      buttons.add(wLog);
    }

    if (proposingToStop) {
      wStop = new Button(shell, SWT.PUSH);
      wStop.setText(BaseMessages.getString(PKG, "PreviewRowsDialog.Button.Stop.Label"));
      wStop.setToolTipText(BaseMessages.getString(PKG, "PreviewRowsDialog.Button.Stop.ToolTip"));
      wStop.addListener(
          SWT.Selection,
          new Listener() {
            public void handleEvent(Event e) {
              askingToStop = true;
              close();
            }
          });
      buttons.add(wStop);
    }

    if (proposingToGetMoreRows) {
      wNext = new Button(shell, SWT.PUSH);
      wNext.setText(BaseMessages.getString(PKG, "PreviewRowsDialog.Button.Next.Label"));
      wNext.setToolTipText(BaseMessages.getString(PKG, "PreviewRowsDialog.Button.Next.ToolTip"));
      wNext.addListener(
          SWT.Selection,
          new Listener() {
            public void handleEvent(Event e) {
              askingForMoreRows = true;
              close();
            }
          });
      buttons.add(wNext);
    }

    if (proposingToGetMoreRows || proposingToStop) {
      wClose.setText(BaseMessages.getString(PKG, "PreviewRowsDialog.Button.Close.Label"));
      wClose.setToolTipText(BaseMessages.getString(PKG, "PreviewRowsDialog.Button.Close.ToolTip"));
    }

    // Position the buttons...
    //
    BaseStepDialog.positionBottomButtons(
        shell, buttons.toArray(new Button[buttons.size()]), Const.MARGIN, null);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            close();
          }
        });

    getData();

    BaseStepDialog.setSize(shell);

    shell.open();

    if (!waitingForRows) {
      while (!shell.isDisposed()) {
        if (!shell.getDisplay().readAndDispatch()) shell.getDisplay().sleep();
      }
    }
  }
Example #30
0
  public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();

    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, input);

    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            input.setChanged();
          }
        };
    changed = input.hasChanged();

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "Template.Shell.Title"));

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

    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);

    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);

    // output dummy value
    wlValName = new Label(shell, SWT.RIGHT);
    wlValName.setText(BaseMessages.getString(PKG, "Template.FieldName.Label"));
    props.setLook(wlValName);
    fdlValName = new FormData();
    fdlValName.left = new FormAttachment(0, 0);
    fdlValName.right = new FormAttachment(middle, -margin);
    fdlValName.top = new FormAttachment(wStepname, margin);
    wlValName.setLayoutData(fdlValName);

    wValName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wValName);
    wValName.addModifyListener(lsMod);
    fdValName = new FormData();
    fdValName.left = new FormAttachment(middle, 0);
    fdValName.right = new FormAttachment(100, 0);
    fdValName.top = new FormAttachment(wStepname, margin);
    wValName.setLayoutData(fdValName);

    // OK and cancel buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

    BaseStepDialog.positionBottomButtons(shell, new Button[] {wOK, wCancel}, margin, wValName);

    // Add listeners
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);

    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };

    wStepname.addSelectionListener(lsDef);
    wValName.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    // Set the shell size, based upon previous time...
    setSize();

    getData();
    input.setChanged(changed);

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    return stepname;
  }