public String open()

in plugins/transforms/excel/src/main/java/org/apache/hop/pipeline/transforms/excelinput/ExcelInputDialog.java [231:1119]


  public String open() {
    Shell parent = getParent();

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

    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = PropsUi.getFormMargin();
    formLayout.marginHeight = PropsUi.getFormMargin();

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "ExcelInputDialog.DialogTitle"));

    middle = props.getMiddlePct();
    margin = PropsUi.getMargin();

    // Buttons at the bottom
    wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "ExcelInputDialog.PreviewRows.Button"));
    wPreview.addListener(SWT.Selection, e -> preview());
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    setButtonPositions(new Button[] {wOk, wPreview, wCancel}, margin, null);

    // TransformName line
    wlTransformName = new Label(shell, SWT.RIGHT);
    wlTransformName.setText(BaseMessages.getString(PKG, "System.TransformName.Label"));
    wlTransformName.setToolTipText(BaseMessages.getString(PKG, "System.TransformName.Tooltip"));
    PropsUi.setLook(wlTransformName);
    fdlTransformName = new FormData();
    fdlTransformName.left = new FormAttachment(0, 0);
    fdlTransformName.top = new FormAttachment(0, margin);
    fdlTransformName.right = new FormAttachment(middle, -margin);
    wlTransformName.setLayoutData(fdlTransformName);
    wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTransformName.setText(transformName);
    PropsUi.setLook(wTransformName);
    fdTransformName = new FormData();
    fdTransformName.left = new FormAttachment(middle, 0);
    fdTransformName.top = new FormAttachment(0, margin);
    fdTransformName.right = new FormAttachment(100, 0);
    wTransformName.setLayoutData(fdTransformName);

    // Status Message
    wlStatusMessage = new Label(shell, SWT.RIGHT);
    wlStatusMessage.setText("(This Space To Let)");
    wlStatusMessage.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_RED));
    PropsUi.setLook(wlStatusMessage);
    FormData fdlStatusMessage = new FormData();
    fdlStatusMessage.left = new FormAttachment(0, 0);
    fdlStatusMessage.top = new FormAttachment(wlTransformName, margin);
    fdlStatusMessage.right = new FormAttachment(middle, -margin);
    wlStatusMessage.setLayoutData(fdlStatusMessage);

    // Tabs
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    PropsUi.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);

    //
    // START OF FILE TAB /
    //
    wFileTab = new CTabItem(wTabFolder, SWT.NONE);
    wFileTab.setFont(GuiResource.getInstance().getFontDefault());
    wFileTab.setText(BaseMessages.getString(PKG, "ExcelInputDialog.FileTab.TabTitle"));

    Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
    PropsUi.setLook(wFileComp);

    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);

    // spreadsheet engine type
    Label wlSpreadSheetType = new Label(wFileComp, SWT.RIGHT);
    wlSpreadSheetType.setText(
        BaseMessages.getString(PKG, "ExcelInputDialog.SpreadSheetType.Label"));
    PropsUi.setLook(wlSpreadSheetType);
    FormData fdlSpreadSheetType = new FormData();
    fdlSpreadSheetType.left = new FormAttachment(0, 0);
    fdlSpreadSheetType.right = new FormAttachment(middle, -margin);
    fdlSpreadSheetType.top = new FormAttachment(0, 0);

    wlSpreadSheetType.setLayoutData(fdlSpreadSheetType);
    wSpreadSheetType = new CCombo(wFileComp, SWT.BORDER | SWT.READ_ONLY);
    wSpreadSheetType.setEditable(true);
    PropsUi.setLook(wSpreadSheetType);
    FormData fdSpreadSheetType = new FormData();
    fdSpreadSheetType.left = new FormAttachment(middle, 0);
    fdSpreadSheetType.right = new FormAttachment(100, 0);
    fdSpreadSheetType.top = new FormAttachment(0, 0);
    wSpreadSheetType.setLayoutData(fdSpreadSheetType);
    for (SpreadSheetType type : SpreadSheetType.values()) {
      wSpreadSheetType.add(type.getDescription());
    }

    // Filename line
    wlFilename = new Label(wFileComp, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "ExcelInputDialog.Filename.Label"));
    PropsUi.setLook(wlFilename);
    FormData fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wSpreadSheetType, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);

    wbbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    PropsUi.setLook(wbbFilename);
    wbbFilename.setText(BaseMessages.getString(PKG, CONST_BUTTON_BROWSE));
    wbbFilename.setToolTipText(
        BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
    FormData fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wSpreadSheetType, margin);
    wbbFilename.setLayoutData(fdbFilename);

    wbaFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    PropsUi.setLook(wbaFilename);
    wbaFilename.setText(BaseMessages.getString(PKG, "ExcelInputDialog.FilenameAdd.Button"));
    wbaFilename.setToolTipText(BaseMessages.getString(PKG, "ExcelInputDialog.FilenameAdd.Tooltip"));
    FormData fdbaFilename = new FormData();
    fdbaFilename.right = new FormAttachment(wbbFilename, -margin);
    fdbaFilename.top = new FormAttachment(wSpreadSheetType, margin);
    wbaFilename.setLayoutData(fdbaFilename);

    wFilename = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    PropsUi.setLook(wFilename);
    FormData fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.right = new FormAttachment(wbaFilename, -margin);
    fdFilename.top = new FormAttachment(wSpreadSheetType, margin);
    wFilename.setLayoutData(fdFilename);

    wlFileMask = new Label(wFileComp, SWT.RIGHT);
    wlFileMask.setText(BaseMessages.getString(PKG, "ExcelInputDialog.Filemask.Label"));
    PropsUi.setLook(wlFileMask);
    FormData fdlFilemask = new FormData();
    fdlFilemask.left = new FormAttachment(0, 0);
    fdlFilemask.top = new FormAttachment(wFilename, margin);
    fdlFilemask.right = new FormAttachment(middle, -margin);
    wlFileMask.setLayoutData(fdlFilemask);
    wFileMask = new Text(wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    PropsUi.setLook(wFileMask);
    FormData fdFilemask = new FormData();
    fdFilemask.left = new FormAttachment(middle, 0);
    fdFilemask.top = new FormAttachment(wFilename, margin);
    fdFilemask.right = new FormAttachment(wbaFilename, -margin);
    wFileMask.setLayoutData(fdFilemask);

    wlExcludeFileMask = new Label(wFileComp, SWT.RIGHT);
    wlExcludeFileMask.setText(
        BaseMessages.getString(PKG, "ExcelInputDialog.ExcludeFilemask.Label"));
    PropsUi.setLook(wlExcludeFileMask);
    FormData fdlExcludeFilemask = new FormData();
    fdlExcludeFilemask.left = new FormAttachment(0, 0);
    fdlExcludeFilemask.top = new FormAttachment(wFileMask, margin);
    fdlExcludeFilemask.right = new FormAttachment(middle, -margin);
    wlExcludeFileMask.setLayoutData(fdlExcludeFilemask);
    wExcludeFileMask = new TextVar(variables, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    PropsUi.setLook(wExcludeFileMask);
    FormData fdExcludeFilemask = new FormData();
    fdExcludeFilemask.left = new FormAttachment(middle, 0);
    fdExcludeFilemask.top = new FormAttachment(wFileMask, margin);
    fdExcludeFilemask.right = new FormAttachment(wFilename, 0, SWT.RIGHT);
    wExcludeFileMask.setLayoutData(fdExcludeFilemask);

    // Filename list line
    wlFilenameList = new Label(wFileComp, SWT.RIGHT);
    wlFilenameList.setText(BaseMessages.getString(PKG, "ExcelInputDialog.FilenameList.Label"));
    PropsUi.setLook(wlFilenameList);
    FormData fdlFilenameList = new FormData();
    fdlFilenameList.left = new FormAttachment(0, 0);
    fdlFilenameList.top = new FormAttachment(wExcludeFileMask, margin);
    fdlFilenameList.right = new FormAttachment(middle, -margin);
    wlFilenameList.setLayoutData(fdlFilenameList);

    // Buttons to the right of the screen...
    wbdFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    PropsUi.setLook(wbdFilename);
    wbdFilename.setText(BaseMessages.getString(PKG, "ExcelInputDialog.FilenameDelete.Button"));
    wbdFilename.setToolTipText(
        BaseMessages.getString(PKG, "ExcelInputDialog.FilenameDelete.Tooltip"));
    FormData fdbdFilename = new FormData();
    fdbdFilename.right = new FormAttachment(100, 0);
    fdbdFilename.top = new FormAttachment(wExcludeFileMask, 40);
    wbdFilename.setLayoutData(fdbdFilename);

    wbeFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    PropsUi.setLook(wbeFilename);
    wbeFilename.setText(BaseMessages.getString(PKG, "ExcelInputDialog.FilenameEdit.Button"));
    wbeFilename.setToolTipText(
        BaseMessages.getString(PKG, "ExcelInputDialog.FilenameEdit.Tooltip"));
    FormData fdbeFilename = new FormData();
    fdbeFilename.right = new FormAttachment(100, 0);
    fdbeFilename.left = new FormAttachment(wbdFilename, 0, SWT.LEFT);
    fdbeFilename.top = new FormAttachment(wbdFilename, margin);
    wbeFilename.setLayoutData(fdbeFilename);

    wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    PropsUi.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "ExcelInputDialog.ShowFiles.Button"));
    FormData fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.bottom = new FormAttachment(100, -margin);
    wbShowFiles.setLayoutData(fdbShowFiles);

    // Accepting filenames group
    //
    Group gAccepting = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
    gAccepting.setText(BaseMessages.getString(PKG, "ExcelInputDialog.AcceptingGroup.Label"));
    FormLayout acceptingLayout = new FormLayout();
    acceptingLayout.marginWidth = 3;
    acceptingLayout.marginHeight = 3;
    gAccepting.setLayout(acceptingLayout);
    PropsUi.setLook(gAccepting);

    // Accept filenames from previous transforms?
    //
    Label wlAccFilenames = new Label(gAccepting, SWT.RIGHT);
    wlAccFilenames.setText(BaseMessages.getString(PKG, "ExcelInputDialog.AcceptFilenames.Label"));
    PropsUi.setLook(wlAccFilenames);
    FormData fdlAccFilenames = new FormData();
    fdlAccFilenames.top = new FormAttachment(0, margin);
    fdlAccFilenames.left = new FormAttachment(0, 0);
    fdlAccFilenames.right = new FormAttachment(middle, -margin);
    wlAccFilenames.setLayoutData(fdlAccFilenames);
    wAccFilenames = new Button(gAccepting, SWT.CHECK);
    wAccFilenames.setToolTipText(
        BaseMessages.getString(PKG, "ExcelInputDialog.AcceptFilenames.Tooltip"));
    PropsUi.setLook(wAccFilenames);
    FormData fdAccFilenames = new FormData();
    fdAccFilenames.top = new FormAttachment(wlAccFilenames, 0, SWT.CENTER);
    fdAccFilenames.left = new FormAttachment(middle, 0);
    fdAccFilenames.right = new FormAttachment(100, 0);
    wAccFilenames.setLayoutData(fdAccFilenames);
    wAccFilenames.addListener(SWT.Selection, e -> setFlags());

    // Which transform to read from?
    wlAccTransform = new Label(gAccepting, SWT.RIGHT);
    wlAccTransform.setText(BaseMessages.getString(PKG, "ExcelInputDialog.AcceptTransform.Label"));
    PropsUi.setLook(wlAccTransform);
    FormData fdlAccTransform = new FormData();
    fdlAccTransform.top = new FormAttachment(wAccFilenames, margin);
    fdlAccTransform.left = new FormAttachment(0, 0);
    fdlAccTransform.right = new FormAttachment(middle, -margin);
    wlAccTransform.setLayoutData(fdlAccTransform);
    wAccTransform = new CCombo(gAccepting, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wAccTransform.setToolTipText(
        BaseMessages.getString(PKG, "ExcelInputDialog.AcceptTransform.Tooltip"));
    PropsUi.setLook(wAccTransform);
    FormData fdAccTransform = new FormData();
    fdAccTransform.top = new FormAttachment(wAccFilenames, margin);
    fdAccTransform.left = new FormAttachment(middle, 0);
    fdAccTransform.right = new FormAttachment(100, 0);
    wAccTransform.setLayoutData(fdAccTransform);

    // Which field?
    //
    wlAccField = new Label(gAccepting, SWT.RIGHT);
    wlAccField.setText(BaseMessages.getString(PKG, "ExcelInputDialog.AcceptField.Label"));
    PropsUi.setLook(wlAccField);
    FormData fdlAccField = new FormData();
    fdlAccField.top = new FormAttachment(wAccTransform, margin);
    fdlAccField.left = new FormAttachment(0, 0);
    fdlAccField.right = new FormAttachment(middle, -margin);
    wlAccField.setLayoutData(fdlAccField);

    wAccField = new CCombo(gAccepting, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    IRowMeta previousFields;
    try {
      previousFields = pipelineMeta.getPrevTransformFields(variables, transformMeta);
    } catch (HopTransformException e) {
      new ErrorDialog(
          shell,
          BaseMessages.getString(PKG, "ExcelInputDialog.ErrorDialog.UnableToGetInputFields.Title"),
          BaseMessages.getString(
              PKG, "ExcelInputDialog.ErrorDialog.UnableToGetInputFields.Message"),
          e);
      previousFields = new RowMeta();
    }
    wAccField.setItems(previousFields.getFieldNames());
    wAccField.setToolTipText(BaseMessages.getString(PKG, "ExcelInputDialog.AcceptField.Tooltip"));

    PropsUi.setLook(wAccField);
    FormData fdAccField = new FormData();
    fdAccField.top = new FormAttachment(wAccTransform, margin);
    fdAccField.left = new FormAttachment(middle, 0);
    fdAccField.right = new FormAttachment(100, 0);
    wAccField.setLayoutData(fdAccField);

    // Fill in the source transforms...
    List<TransformMeta> prevTransforms =
        pipelineMeta.findPreviousTransforms(pipelineMeta.findTransform(transformName));
    for (TransformMeta prevTransform : prevTransforms) {
      wAccTransform.add(prevTransform.getName());
    }

    FormData fdAccepting = new FormData();
    fdAccepting.left = new FormAttachment(0, margin);
    fdAccepting.right = new FormAttachment(100, 0);
    fdAccepting.bottom = new FormAttachment(wbShowFiles, -margin * 2);
    gAccepting.setLayoutData(fdAccepting);

    ColumnInfo[] colinfo = new ColumnInfo[5];
    colinfo[0] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.FileDir.Column"),
            ColumnInfo.COLUMN_TYPE_TEXT,
            false);
    colinfo[0].setUsingVariables(true);
    colinfo[1] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.Wildcard.Column"),
            ColumnInfo.COLUMN_TYPE_TEXT,
            false);
    colinfo[1].setToolTip(BaseMessages.getString(PKG, "ExcelInputDialog.Wildcard.Tooltip"));
    colinfo[2] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.Files.ExcludeWildcard.Column"),
            ColumnInfo.COLUMN_TYPE_TEXT,
            false);
    colinfo[2].setUsingVariables(true);
    colinfo[3] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.Required.Column"),
            ColumnInfo.COLUMN_TYPE_CCOMBO,
            YES_NO_COMBO);
    colinfo[3].setToolTip(BaseMessages.getString(PKG, "ExcelInputDialog.Required.Tooltip"));
    colinfo[4] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.IncludeSubDirs.Column"),
            ColumnInfo.COLUMN_TYPE_CCOMBO,
            YES_NO_COMBO);
    colinfo[4].setToolTip(BaseMessages.getString(PKG, "ExcelInputDialog.IncludeSubDirs.Tooltip"));

    wFilenameList =
        new TableView(
            variables,
            wFileComp,
            SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER,
            colinfo,
            input.getFiles().size(),
            null,
            props);
    PropsUi.setLook(wFilenameList);
    FormData fdFilenameList = new FormData();
    fdFilenameList.left = new FormAttachment(middle, 0);
    fdFilenameList.right = new FormAttachment(wbdFilename, -margin);
    fdFilenameList.top = new FormAttachment(wExcludeFileMask, margin);
    fdFilenameList.bottom = new FormAttachment(gAccepting, -margin);
    wFilenameList.setLayoutData(fdFilenameList);

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

    wFileComp.layout();
    wFileTab.setControl(wFileComp);

    //
    // / END OF FILE TAB
    //
    //
    // START OF SHEET TAB /
    //
    wSheetTab = new CTabItem(wTabFolder, SWT.NONE);
    wSheetTab.setFont(GuiResource.getInstance().getFontDefault());
    wSheetTab.setText(BaseMessages.getString(PKG, "ExcelInputDialog.SheetsTab.TabTitle"));

    Composite wSheetComp = new Composite(wTabFolder, SWT.NONE);
    PropsUi.setLook(wSheetComp);

    FormLayout sheetLayout = new FormLayout();
    sheetLayout.marginWidth = 3;
    sheetLayout.marginHeight = 3;
    wSheetComp.setLayout(sheetLayout);

    Button wbGetSheets = new Button(wSheetComp, SWT.PUSH | SWT.CENTER);
    PropsUi.setLook(wbGetSheets);
    wbGetSheets.setText(BaseMessages.getString(PKG, "ExcelInputDialog.GetSheets.Button"));
    FormData fdbGetSheets = new FormData();
    fdbGetSheets.left = new FormAttachment(middle, 0);
    fdbGetSheets.bottom = new FormAttachment(100, -margin);
    wbGetSheets.setLayoutData(fdbGetSheets);

    Label wlSheetnameList = new Label(wSheetComp, SWT.RIGHT);
    wlSheetnameList.setText(BaseMessages.getString(PKG, "ExcelInputDialog.SheetNameList.Label"));
    PropsUi.setLook(wlSheetnameList);
    FormData fdlSheetnameList = new FormData();
    fdlSheetnameList.left = new FormAttachment(0, 0);
    fdlSheetnameList.top = new FormAttachment(wFilename, margin);
    fdlSheetnameList.right = new FormAttachment(middle, -margin);
    wlSheetnameList.setLayoutData(fdlSheetnameList);

    ColumnInfo[] shinfo = new ColumnInfo[3];
    shinfo[0] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.SheetName.Column"),
            ColumnInfo.COLUMN_TYPE_TEXT,
            false);
    shinfo[1] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.StartRow.Column"),
            ColumnInfo.COLUMN_TYPE_TEXT,
            false);
    shinfo[2] =
        new ColumnInfo(
            BaseMessages.getString(PKG, "ExcelInputDialog.StartColumn.Column"),
            ColumnInfo.COLUMN_TYPE_TEXT,
            false);

    wSheetNameList =
        new TableView(
            variables,
            wSheetComp,
            SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER,
            shinfo,
            input.getSheets().size(),
            null,
            props);
    PropsUi.setLook(wSheetNameList);
    fdFilenameList = new FormData();
    fdFilenameList.left = new FormAttachment(middle, 0);
    fdFilenameList.right = new FormAttachment(100, 0);
    fdFilenameList.top = new FormAttachment(0, 0);
    fdFilenameList.bottom = new FormAttachment(wbGetSheets, -margin);
    wSheetNameList.setLayoutData(fdFilenameList);

    wSheetNameList.addModifyListener(arg0 -> checkAlerts());

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

    wSheetComp.layout();
    wSheetTab.setControl(wSheetComp);

    //
    // / END OF SHEET TAB
    //
    //
    // START OF CONTENT TAB/
    // /
    CTabItem wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setFont(GuiResource.getInstance().getFontDefault());
    wContentTab.setText(BaseMessages.getString(PKG, "ExcelInputDialog.ContentTab.TabTitle"));

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

    Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
    PropsUi.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);

    // Header checkbox
    Label wlHeader = new Label(wContentComp, SWT.RIGHT);
    wlHeader.setText(BaseMessages.getString(PKG, "ExcelInputDialog.Header.Label"));
    PropsUi.setLook(wlHeader);
    FormData fdlHeader = new FormData();
    fdlHeader.left = new FormAttachment(0, 0);
    fdlHeader.top = new FormAttachment(0, 0);
    fdlHeader.right = new FormAttachment(middle, -margin);
    wlHeader.setLayoutData(fdlHeader);
    wHeader = new Button(wContentComp, SWT.CHECK);
    PropsUi.setLook(wHeader);
    FormData fdHeader = new FormData();
    fdHeader.left = new FormAttachment(middle, 0);
    fdHeader.top = new FormAttachment(wlHeader, 0, SWT.CENTER);
    fdHeader.right = new FormAttachment(100, 0);
    wHeader.setLayoutData(fdHeader);
    wHeader.addListener(SWT.Selection, e -> setFlags());

    Label wlNoEmpty = new Label(wContentComp, SWT.RIGHT);
    wlNoEmpty.setText(BaseMessages.getString(PKG, "ExcelInputDialog.NoEmpty.Label"));
    PropsUi.setLook(wlNoEmpty);
    FormData fdlNoEmpty = new FormData();
    fdlNoEmpty.left = new FormAttachment(0, 0);
    fdlNoEmpty.top = new FormAttachment(wHeader, margin);
    fdlNoEmpty.right = new FormAttachment(middle, -margin);
    wlNoEmpty.setLayoutData(fdlNoEmpty);
    wNoEmpty = new Button(wContentComp, SWT.CHECK);
    PropsUi.setLook(wNoEmpty);
    wNoEmpty.setToolTipText(BaseMessages.getString(PKG, "ExcelInputDialog.NoEmpty.Tooltip"));
    FormData fdNoEmpty = new FormData();
    fdNoEmpty.left = new FormAttachment(middle, 0);
    fdNoEmpty.top = new FormAttachment(wlNoEmpty, 0, SWT.CENTER);
    fdNoEmpty.right = new FormAttachment(100, 0);
    wNoEmpty.setLayoutData(fdNoEmpty);
    wNoEmpty.addSelectionListener(new ComponentSelectionListener(input));

    Label wlStopOnEmpty = new Label(wContentComp, SWT.RIGHT);
    wlStopOnEmpty.setText(BaseMessages.getString(PKG, "ExcelInputDialog.StopOnEmpty.Label"));
    PropsUi.setLook(wlStopOnEmpty);
    FormData fdlStopOnEmpty = new FormData();
    fdlStopOnEmpty.left = new FormAttachment(0, 0);
    fdlStopOnEmpty.top = new FormAttachment(wNoEmpty, margin);
    fdlStopOnEmpty.right = new FormAttachment(middle, -margin);
    wlStopOnEmpty.setLayoutData(fdlStopOnEmpty);
    wStopOnEmpty = new Button(wContentComp, SWT.CHECK);
    PropsUi.setLook(wStopOnEmpty);
    wStopOnEmpty.setToolTipText(
        BaseMessages.getString(PKG, "ExcelInputDialog.StopOnEmpty.Tooltip"));
    FormData fdStopOnEmpty = new FormData();
    fdStopOnEmpty.left = new FormAttachment(middle, 0);
    fdStopOnEmpty.top = new FormAttachment(wlStopOnEmpty, 0, SWT.CENTER);
    fdStopOnEmpty.right = new FormAttachment(100, 0);
    wStopOnEmpty.setLayoutData(fdStopOnEmpty);
    wStopOnEmpty.addSelectionListener(new ComponentSelectionListener(input));

    Label wlLimit = new Label(wContentComp, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "ExcelInputDialog.Limit.Label"));
    PropsUi.setLook(wlLimit);
    FormData fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wStopOnEmpty, margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    PropsUi.setLook(wLimit);
    FormData fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wStopOnEmpty, margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);

    Label wlEncoding = new Label(wContentComp, SWT.RIGHT);
    wlEncoding.setText(BaseMessages.getString(PKG, "ExcelInputDialog.Encoding.Label"));
    PropsUi.setLook(wlEncoding);
    FormData fdlEncoding = new FormData();
    fdlEncoding.left = new FormAttachment(0, 0);
    fdlEncoding.top = new FormAttachment(wLimit, margin);
    fdlEncoding.right = new FormAttachment(middle, -margin);
    wlEncoding.setLayoutData(fdlEncoding);
    wEncoding = new CCombo(wContentComp, SWT.BORDER | SWT.READ_ONLY);
    wEncoding.setEditable(true);
    PropsUi.setLook(wEncoding);
    FormData fdEncoding = new FormData();
    fdEncoding.left = new FormAttachment(middle, 0);
    fdEncoding.top = new FormAttachment(wLimit, margin);
    fdEncoding.right = new FormAttachment(100, 0);
    wEncoding.setLayoutData(fdEncoding);
    wEncoding.addListener(
        SWT.FocusIn,
        e -> {
          Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
          shell.setCursor(busy);
          setEncodings();
          shell.setCursor(null);
          busy.dispose();
        });
    wEncoding.layout();

    //
    // START OF AddFileResult GROUP
    //
    Group wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE);
    PropsUi.setLook(wAddFileResult);
    wAddFileResult.setText(BaseMessages.getString(PKG, "ExcelInputDialog.AddFileResult.Label"));

    FormLayout addFileResultgroupLayout = new FormLayout();
    addFileResultgroupLayout.marginWidth = 10;
    addFileResultgroupLayout.marginHeight = 10;
    wAddFileResult.setLayout(addFileResultgroupLayout);

    Label wlAddResult = new Label(wAddFileResult, SWT.RIGHT);
    wlAddResult.setText(BaseMessages.getString(PKG, "ExcelInputDialog.AddResult.Label"));
    PropsUi.setLook(wlAddResult);
    FormData fdlAddResult = new FormData();
    fdlAddResult.left = new FormAttachment(0, 0);
    fdlAddResult.top = new FormAttachment(wEncoding, margin);
    fdlAddResult.right = new FormAttachment(middle, -margin);
    wlAddResult.setLayoutData(fdlAddResult);
    wAddResult = new Button(wAddFileResult, SWT.CHECK);
    PropsUi.setLook(wAddResult);
    wAddResult.setToolTipText(BaseMessages.getString(PKG, "ExcelInputDialog.AddResult.Tooltip"));
    FormData fdAddResult = new FormData();
    fdAddResult.left = new FormAttachment(middle, 0);
    fdAddResult.top = new FormAttachment(wlAddResult, 0, SWT.CENTER);
    wAddResult.setLayoutData(fdAddResult);
    wAddResult.addSelectionListener(new ComponentSelectionListener(input));

    FormData fdAddFileResult = new FormData();
    fdAddFileResult.left = new FormAttachment(0, margin);
    fdAddFileResult.top = new FormAttachment(wEncoding, margin);
    fdAddFileResult.right = new FormAttachment(100, -margin);
    wAddFileResult.setLayoutData(fdAddFileResult);

    //
    // / END OF AddFileResult GROUP
    //
    FormData fdContentComp = new FormData();
    fdContentComp.left = new FormAttachment(0, 0);
    fdContentComp.top = new FormAttachment(0, 0);
    fdContentComp.right = new FormAttachment(100, 0);
    fdContentComp.bottom = new FormAttachment(100, 0);
    wContentComp.setLayoutData(fdContentComp);

    wContentComp.layout();
    wContentTab.setControl(wContentComp);

    //
    // / END OF CONTENT TAB
    //
    //
    // / START OF CONTENT TAB
    //
    addErrorTab();

    // Fields tab...
    //
    wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setFont(GuiResource.getInstance().getFontDefault());
    wFieldsTab.setText(BaseMessages.getString(PKG, "ExcelInputDialog.FieldsTab.TabTitle"));

    SelectionListener lsSelection =
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            fillFieldsLayoutFromSchema();
            input.setChanged();
          }
        };

    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = PropsUi.getFormMargin();
    fieldsLayout.marginHeight = PropsUi.getFormMargin();

    Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);

    wSchemaDefinition =
        new MetaSelectionLine<>(
            variables,
            metadataProvider,
            SchemaDefinition.class,
            wFieldsComp,
            SWT.NONE,
            BaseMessages.getString(PKG, "ExcelInputDialog.SchemaDefinition.Label"),
            BaseMessages.getString(PKG, "ExcelInputDialog.SchemaDefinition.Tooltip"));

    PropsUi.setLook(wSchemaDefinition);
    FormData fdSchemaDefinition = new FormData();
    fdSchemaDefinition.left = new FormAttachment(0, 0);
    fdSchemaDefinition.top = new FormAttachment(0, margin);
    fdSchemaDefinition.right = new FormAttachment(100, 0);
    wSchemaDefinition.setLayoutData(fdSchemaDefinition);

    try {
      wSchemaDefinition.fillItems();
    } catch (Exception e) {
      log.logError("Error getting schema definition items", e);
    }

    wSchemaDefinition.addSelectionListener(lsSelection);

    Group wManualSchemaDefinition = new Group(wFieldsComp, SWT.SHADOW_NONE);
    PropsUi.setLook(wManualSchemaDefinition);
    wManualSchemaDefinition.setText(
        BaseMessages.getString(PKG, "ExcelInputDialog.ManualSchemaDefinition.Label"));

    FormLayout manualSchemaDefinitionLayout = new FormLayout();
    manualSchemaDefinitionLayout.marginWidth = 10;
    manualSchemaDefinitionLayout.marginHeight = 10;
    wManualSchemaDefinition.setLayout(manualSchemaDefinitionLayout);

    wbGetFields = new Button(wManualSchemaDefinition, SWT.PUSH | SWT.CENTER);
    PropsUi.setLook(wbGetFields);
    wbGetFields.setText(BaseMessages.getString(PKG, "ExcelInputDialog.GetFields.Button"));

    setButtonPositions(new Button[] {wbGetFields}, margin, null);

    final int FieldsRows = input.getFields().size();
    int fieldsWidth = 600;
    int fieldsHeight = 150;

    ColumnInfo[] colinf =
        new ColumnInfo[] {
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Name.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Type.Column"),
              ColumnInfo.COLUMN_TYPE_CCOMBO,
              ValueMetaFactory.getValueMetaNames()),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Length.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Precision.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT,
              false),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.TrimType.Column"),
              ColumnInfo.COLUMN_TYPE_CCOMBO,
              IValueMeta.TrimType.getDescriptions()),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Repeat.Column"),
              ColumnInfo.COLUMN_TYPE_CCOMBO,
              BaseMessages.getString(PKG, CONST_COMBO_YES),
              BaseMessages.getString(PKG, CONST_COMBO_NO)),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Format.Column"),
              ColumnInfo.COLUMN_TYPE_FORMAT,
              2),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Currency.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Decimal.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT),
          new ColumnInfo(
              BaseMessages.getString(PKG, "ExcelInputDialog.Grouping.Column"),
              ColumnInfo.COLUMN_TYPE_TEXT)
        };

    colinf[5].setToolTip(BaseMessages.getString(PKG, "ExcelInputDialog.Repeat.Tooltip"));

    wFields =
        new TableView(
            variables,
            wManualSchemaDefinition,
            SWT.FULL_SELECTION | SWT.MULTI,
            colinf,
            FieldsRows,
            null,
            props);
    wFields.setSize(fieldsWidth, fieldsHeight);
    wFields.addModifyListener(arg0 -> checkAlerts());

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

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

    wFieldsComp.layout();

    FormData fdManualSchemaDefinitionComp = new FormData();
    fdManualSchemaDefinitionComp.left = new FormAttachment(0, 0);
    fdManualSchemaDefinitionComp.top = new FormAttachment(wSchemaDefinition, 0);
    fdManualSchemaDefinitionComp.right = new FormAttachment(100, 0);
    fdManualSchemaDefinitionComp.bottom = new FormAttachment(100, 0);
    wManualSchemaDefinition.setLayoutData(fdManualSchemaDefinitionComp);

    wFieldsTab.setControl(wFieldsComp);
    PropsUi.setLook(wFieldsComp);

    addAdditionalFieldsTab();

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

    // Add the file to the list of files...
    SelectionAdapter selA =
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            wFilenameList.add(
                wFilename.getText(),
                wFileMask.getText(),
                wExcludeFileMask.getText(),
                RequiredFilesCode[0],
                RequiredFilesCode[0]);
            wFilename.setText("");
            wFileMask.setText("");
            wExcludeFileMask.setText("");
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
            wFilenameList.optWidth(true);
            checkAlerts();
          }
        };
    wbaFilename.addSelectionListener(selA);
    wFilename.addSelectionListener(selA);

    // Delete files from the list of files...
    wbdFilename.addListener(
        SWT.Selection,
        e -> {
          int[] idx = wFilenameList.getSelectionIndices();
          wFilenameList.remove(idx);
          wFilenameList.removeEmptyRows();
          wFilenameList.setRowNums();
          checkAlerts();
        });

    // Edit the selected file & remove from the list...
    wbeFilename.addListener(
        SWT.Selection,
        e -> {
          int idx = wFilenameList.getSelectionIndex();
          if (idx >= 0) {
            String[] string = wFilenameList.getItem(idx);
            wFilename.setText(string[0]);
            wFileMask.setText(string[1]);
            wExcludeFileMask.setText(string[2]);
            wFilenameList.remove(idx);
          }
          wFilenameList.removeEmptyRows();
          wFilenameList.setRowNums();
        });

    // Show the files that are selected at this time...
    wbShowFiles.addListener(SWT.Selection, e -> showFiles());

    // Whenever something changes, set the tooltip to the expanded version of the filename:
    wFilename.addModifyListener(
        e -> wFilename.setToolTipText(variables.resolve(wFilename.getText())));

    // Listen to the Browse... button
    wbbFilename.addListener(
        SWT.Selection,
        e -> {
          if (!Utils.isEmpty(wFileMask.getText())
              || !Utils.isEmpty(wExcludeFileMask.getText())) { // A mask: a directory!
            BaseDialog.presentDirectoryDialog(shell, wFilename, variables);
          } else {
            String[] extensions;
            SpreadSheetType type =
                SpreadSheetType.getSpreadSheetTypeByDescription(wSpreadSheetType.getText());
            if (type == null) {
              return;
            }
            switch (type) {
              case SAX_POI:
                extensions = new String[] {"*.xlsx;*.XLSX;*.xlsm;*.XLSM", "*"};
                break;
              case ODS:
                extensions = new String[] {"*.ods;*.ODS;", "*"};
                break;
              case POI:
              default:
                extensions = new String[] {"*.xls;*.XLS;*.xlsx;*.XLSX;*.xlsm;*.XLSM", "*"};
                break;
            }

            BaseDialog.presentFileDialog(
                shell,
                wFilename,
                variables,
                extensions,
                new String[] {
                  BaseMessages.getString(PKG, "ExcelInputDialog.FilterNames.ExcelFiles"),
                  BaseMessages.getString(PKG, "System.FileType.AllFiles")
                },
                true);
          }
        });

    // Get a list of the sheet names.
    wbGetSheets.addListener(SWT.Selection, e -> getSheets());
    wbGetFields.addListener(SWT.Selection, e -> getFields());

    wTabFolder.setSelection(0);

    getData(input);
    wFields.optWidth(true);
    checkAlerts(); // resyncing after setup

    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());

    return transformName;
  }