Search in sources :

Example 61 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class AccessInputDialog method getTableName.

private void getTableName() {
    Database accessDatabase = null;
    try {
        AccessInputMeta meta = new AccessInputMeta();
        getInfo(meta);
        FileInputList fileInputList = meta.getFiles(transMeta);
        if (fileInputList.nrOfFiles() > 0) {
            // Check the first file
            if (fileInputList.getFile(0).exists()) {
                // Open the file (only first file) in readOnly ...
                // 
                accessDatabase = Database.open(new File(AccessInputMeta.getFilename(fileInputList.getFile(0))), true);
                // Get user tables
                // 
                Set<String> settables = accessDatabase.getTableNames();
                // Get System tables
                settables.addAll(accessDatabase.getSystemTableNames());
                // Get system tables
                String[] tablenames = settables.toArray(new String[settables.size()]);
                Const.sortStrings(tablenames);
                EnterSelectionDialog dialog = new EnterSelectionDialog(shell, tablenames, BaseMessages.getString(PKG, "AccessInputDialog.Dialog.SelectATable.Title"), BaseMessages.getString(PKG, "AccessInputDialog.Dialog.SelectATable.Message"));
                String tablename = dialog.open();
                if (tablename != null) {
                    wTable.setText(tablename);
                }
            } else {
                // The file not exists !
                throw new KettleException(BaseMessages.getString(PKG, "AccessInputMeta.Exception.FileDoesNotExist", KettleVFS.getFilename(fileInputList.getFile(0))));
            }
        } else {
            // No file specified
            MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
            mb.setMessage(BaseMessages.getString(PKG, "AccessInputDialog.FilesMissing.DialogMessage"));
            mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
            mb.open();
        }
    } catch (Throwable e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "AccessInputDialog.UnableToGetListOfTables.Title"), BaseMessages.getString(PKG, "AccessInputDialog.UnableToGetListOfTables.Message"), e);
    } finally {
        // Don't forget to close the bugger.
        try {
            if (accessDatabase != null) {
                accessDatabase.close();
            }
        } catch (Exception e) {
        // Ignore close errors
        }
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) AccessInputMeta(org.pentaho.di.trans.steps.accessinput.AccessInputMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) KettleException(org.pentaho.di.core.exception.KettleException) MessageBox(org.eclipse.swt.widgets.MessageBox) Database(com.healthmarketscience.jackcess.Database) File(java.io.File) FileInputList(org.pentaho.di.core.fileinput.FileInputList) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog)

Example 62 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class GetFileNamesDialog method open.

public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, input);
    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, "GetFileNamesDialog.DialogTitle"));
    middle = props.getMiddlePct();
    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.top = new FormAttachment(0, margin);
    fdlStepname.right = new FormAttachment(middle, -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);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF FILE TAB ///
    // ////////////////////////
    wFileTab = new CTabItem(wTabFolder, SWT.NONE);
    wFileTab.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.FileTab.TabTitle"));
    wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    // ///////////////////////////////
    // START OF Origin files GROUP //
    // ///////////////////////////////
    wOriginFiles = new Group(wFileComp, SWT.SHADOW_NONE);
    props.setLook(wOriginFiles);
    wOriginFiles.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.wOriginFiles.Label"));
    FormLayout OriginFilesgroupLayout = new FormLayout();
    OriginFilesgroupLayout.marginWidth = 10;
    OriginFilesgroupLayout.marginHeight = 10;
    wOriginFiles.setLayout(OriginFilesgroupLayout);
    // Is Filename defined in a Field
    wlFileField = new Label(wOriginFiles, SWT.RIGHT);
    wlFileField.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.FileField.Label"));
    props.setLook(wlFileField);
    fdlFileField = new FormData();
    fdlFileField.left = new FormAttachment(0, -margin);
    fdlFileField.top = new FormAttachment(0, margin);
    fdlFileField.right = new FormAttachment(middle, -2 * margin);
    wlFileField.setLayoutData(fdlFileField);
    wFileField = new Button(wOriginFiles, SWT.CHECK);
    props.setLook(wFileField);
    wFileField.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.FileField.Tooltip"));
    fdFileField = new FormData();
    fdFileField.left = new FormAttachment(middle, -margin);
    fdFileField.top = new FormAttachment(0, margin);
    wFileField.setLayoutData(fdFileField);
    SelectionAdapter lfilefield = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            ActiveFileField();
            setFileField();
            input.setChanged();
        }
    };
    wFileField.addSelectionListener(lfilefield);
    // Filename field
    wlFilenameField = new Label(wOriginFiles, SWT.RIGHT);
    wlFilenameField.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.wlFilenameField.Label"));
    props.setLook(wlFilenameField);
    fdlFilenameField = new FormData();
    fdlFilenameField.left = new FormAttachment(0, -margin);
    fdlFilenameField.top = new FormAttachment(wFileField, margin);
    fdlFilenameField.right = new FormAttachment(middle, -2 * margin);
    wlFilenameField.setLayoutData(fdlFilenameField);
    wFilenameField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
    wFilenameField.setEditable(true);
    props.setLook(wFilenameField);
    wFilenameField.addModifyListener(lsMod);
    fdFilenameField = new FormData();
    fdFilenameField.left = new FormAttachment(middle, -margin);
    fdFilenameField.top = new FormAttachment(wFileField, margin);
    fdFilenameField.right = new FormAttachment(100, -margin);
    wFilenameField.setLayoutData(fdFilenameField);
    // Wildcard field
    wlWildcardField = new Label(wOriginFiles, SWT.RIGHT);
    wlWildcardField.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.wlWildcardField.Label"));
    props.setLook(wlWildcardField);
    fdlWildcardField = new FormData();
    fdlWildcardField.left = new FormAttachment(0, -margin);
    fdlWildcardField.top = new FormAttachment(wFilenameField, margin);
    fdlWildcardField.right = new FormAttachment(middle, -2 * margin);
    wlWildcardField.setLayoutData(fdlWildcardField);
    wWildcardField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
    wWildcardField.setEditable(true);
    props.setLook(wWildcardField);
    wWildcardField.addModifyListener(lsMod);
    fdWildcardField = new FormData();
    fdWildcardField.left = new FormAttachment(middle, -margin);
    fdWildcardField.top = new FormAttachment(wFilenameField, margin);
    fdWildcardField.right = new FormAttachment(100, -margin);
    wWildcardField.setLayoutData(fdWildcardField);
    // ExcludeWildcard field
    wlExcludeWildcardField = new Label(wOriginFiles, SWT.RIGHT);
    wlExcludeWildcardField.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.wlExcludeWildcardField.Label"));
    props.setLook(wlExcludeWildcardField);
    fdlExcludeWildcardField = new FormData();
    fdlExcludeWildcardField.left = new FormAttachment(0, -margin);
    fdlExcludeWildcardField.top = new FormAttachment(wWildcardField, margin);
    fdlExcludeWildcardField.right = new FormAttachment(middle, -2 * margin);
    wlExcludeWildcardField.setLayoutData(fdlExcludeWildcardField);
    wExcludeWildcardField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
    wExcludeWildcardField.setEditable(true);
    props.setLook(wExcludeWildcardField);
    wExcludeWildcardField.addModifyListener(lsMod);
    fdExcludeWildcardField = new FormData();
    fdExcludeWildcardField.left = new FormAttachment(middle, -margin);
    fdExcludeWildcardField.top = new FormAttachment(wWildcardField, margin);
    fdExcludeWildcardField.right = new FormAttachment(100, -margin);
    wExcludeWildcardField.setLayoutData(fdExcludeWildcardField);
    // Is includeSubFoldername defined in a Field
    wlIncludeSubFolder = new Label(wOriginFiles, SWT.RIGHT);
    wlIncludeSubFolder.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.includeSubFolder.Label"));
    props.setLook(wlIncludeSubFolder);
    fdlIncludeSubFolder = new FormData();
    fdlIncludeSubFolder.left = new FormAttachment(0, -margin);
    fdlIncludeSubFolder.top = new FormAttachment(wExcludeWildcardField, margin);
    fdlIncludeSubFolder.right = new FormAttachment(middle, -2 * margin);
    wlIncludeSubFolder.setLayoutData(fdlIncludeSubFolder);
    wIncludeSubFolder = new Button(wOriginFiles, SWT.CHECK);
    props.setLook(wIncludeSubFolder);
    wIncludeSubFolder.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.includeSubFolder.Tooltip"));
    fdIncludeSubFolder = new FormData();
    fdIncludeSubFolder.left = new FormAttachment(middle, -margin);
    fdIncludeSubFolder.top = new FormAttachment(wExcludeWildcardField, margin);
    wIncludeSubFolder.setLayoutData(fdIncludeSubFolder);
    wIncludeSubFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            input.setChanged();
        }
    });
    fdOriginFiles = new FormData();
    fdOriginFiles.left = new FormAttachment(0, margin);
    fdOriginFiles.top = new FormAttachment(wFilenameList, margin);
    fdOriginFiles.right = new FormAttachment(100, -margin);
    wOriginFiles.setLayoutData(fdOriginFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Origin files GROUP
    // ///////////////////////////////////////////////////////////
    // Filename line
    wlFilename = new Label(wFileComp, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wOriginFiles, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbFilename);
    wbbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wOriginFiles, margin);
    wbbFilename.setLayoutData(fdbFilename);
    wbaFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbaFilename);
    wbaFilename.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilenameAdd.Button"));
    wbaFilename.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilenameAdd.Tooltip"));
    fdbaFilename = new FormData();
    fdbaFilename.right = new FormAttachment(wbbFilename, -margin);
    fdbaFilename.top = new FormAttachment(wOriginFiles, margin);
    wbaFilename.setLayoutData(fdbaFilename);
    wFilename = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.right = new FormAttachment(wbaFilename, -margin);
    fdFilename.top = new FormAttachment(wOriginFiles, margin);
    wFilename.setLayoutData(fdFilename);
    wlFilemask = new Label(wFileComp, SWT.RIGHT);
    wlFilemask.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.Filemask.Label"));
    props.setLook(wlFilemask);
    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 TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilemask);
    wFilemask.addModifyListener(lsMod);
    fdFilemask = new FormData();
    fdFilemask.left = new FormAttachment(middle, 0);
    fdFilemask.top = new FormAttachment(wFilename, margin);
    fdFilemask.right = new FormAttachment(wFilename, 0, SWT.RIGHT);
    wFilemask.setLayoutData(fdFilemask);
    wlExcludeFilemask = new Label(wFileComp, SWT.RIGHT);
    wlExcludeFilemask.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.ExcludeFilemask.Label"));
    props.setLook(wlExcludeFilemask);
    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(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wExcludeFilemask);
    wExcludeFilemask.addModifyListener(lsMod);
    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, "GetFileNamesDialog.FilenameList.Label"));
    props.setLook(wlFilenameList);
    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);
    props.setLook(wbdFilename);
    wbdFilename.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilenameDelete.Button"));
    wbdFilename.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilenameDelete.Tooltip"));
    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);
    props.setLook(wbeFilename);
    wbeFilename.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilenameEdit.Button"));
    wbeFilename.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilenameEdit.Tooltip"));
    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);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.ShowFiles.Button"));
    fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.bottom = new FormAttachment(100, 0);
    wbShowFiles.setLayoutData(fdbShowFiles);
    ColumnInfo[] colinfo = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "GetFileNamesDialog.FileDirColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "GetFileNamesDialog.WildcardColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "GetFileNamesDialog.ExcludeWildcardColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "GetFileNamesDialog.Required.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO), new ColumnInfo(BaseMessages.getString(PKG, "GetFileNamesDialog.IncludeSubDirs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, YES_NO_COMBO) };
    colinfo[0].setUsingVariables(true);
    colinfo[1].setUsingVariables(true);
    colinfo[1].setToolTip(BaseMessages.getString(PKG, "GetFileNamesDialog.RegExpColumn.Column"));
    colinfo[2].setUsingVariables(true);
    colinfo[2].setToolTip(BaseMessages.getString(PKG, "GetFileNamesDialog.ExcludeRegExpColumn.Column"));
    colinfo[3].setToolTip(BaseMessages.getString(PKG, "GetFileNamesDialog.Required.Tooltip"));
    colinfo[4].setToolTip(BaseMessages.getString(PKG, "GetFileNamesDialog.IncludeSubDirs.ToolTip"));
    wFilenameList = new TableView(transMeta, wFileComp, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, colinfo.length, lsMod, props);
    props.setLook(wFilenameList);
    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(wbShowFiles, -margin);
    wFilenameList.setLayoutData(fdFilenameList);
    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
    // ///////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wStepname, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    // ////////////////////////
    // START OF Filter TAB ///
    // ////////////////////////
    wFilterTab = new CTabItem(wTabFolder, SWT.NONE);
    wFilterTab.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilterTab.TabTitle"));
    wFilterComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFilterComp);
    FormLayout filesettingLayout = new FormLayout();
    filesettingLayout.marginWidth = 3;
    filesettingLayout.marginHeight = 3;
    wFilterComp.setLayout(fileLayout);
    // Filter File Type
    wlFilterFileType = new Label(wFilterComp, SWT.RIGHT);
    wlFilterFileType.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.FilterTab.FileType.Label"));
    props.setLook(wlFilterFileType);
    fdlFilterFileType = new FormData();
    fdlFilterFileType.left = new FormAttachment(0, 0);
    fdlFilterFileType.right = new FormAttachment(middle, 0);
    fdlFilterFileType.top = new FormAttachment(0, 3 * margin);
    wlFilterFileType.setLayoutData(fdlFilterFileType);
    wFilterFileType = new CCombo(wFilterComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wFilterFileType.add(BaseMessages.getString(PKG, "GetFileNamesDialog.FilterTab.FileType.All.Label"));
    wFilterFileType.add(BaseMessages.getString(PKG, "GetFileNamesDialog.FilterTab.FileType.OnlyFile.Label"));
    wFilterFileType.add(BaseMessages.getString(PKG, "GetFileNamesDialog.FilterTab.FileType.OnlyFolder.Label"));
    // wFilterFileType.select(0); // +1: starts at -1
    props.setLook(wFilterFileType);
    fdFilterFileType = new FormData();
    fdFilterFileType.left = new FormAttachment(middle, 0);
    fdFilterFileType.top = new FormAttachment(0, 3 * margin);
    fdFilterFileType.right = new FormAttachment(100, 0);
    wFilterFileType.setLayoutData(fdFilterFileType);
    wFilterFileType.addModifyListener(lsMod);
    // /////////////////////////////////
    // START OF Additional Fields GROUP
    // /////////////////////////////////
    wAdditionalGroup = new Group(wFilterComp, SWT.SHADOW_NONE);
    props.setLook(wAdditionalGroup);
    wAdditionalGroup.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.Group.AdditionalGroup.Label"));
    FormLayout additionalgroupLayout = new FormLayout();
    additionalgroupLayout.marginWidth = 10;
    additionalgroupLayout.marginHeight = 10;
    wAdditionalGroup.setLayout(additionalgroupLayout);
    wlInclRownum = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclRownum.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.InclRownum.Label"));
    props.setLook(wlInclRownum);
    fdlInclRownum = new FormData();
    fdlInclRownum.left = new FormAttachment(0, 0);
    fdlInclRownum.top = new FormAttachment(wFilterFileType, 2 * margin);
    fdlInclRownum.right = new FormAttachment(middle, -margin);
    wlInclRownum.setLayoutData(fdlInclRownum);
    wInclRownum = new Button(wAdditionalGroup, SWT.CHECK);
    props.setLook(wInclRownum);
    wInclRownum.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.InclRownum.Tooltip"));
    fdRownum = new FormData();
    fdRownum.left = new FormAttachment(middle, 0);
    fdRownum.top = new FormAttachment(wFilterFileType, 2 * margin);
    wInclRownum.setLayoutData(fdRownum);
    wInclRownum.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            input.setChanged();
        }
    });
    wlInclRownumField = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclRownumField.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.InclRownumField.Label"));
    props.setLook(wlInclRownumField);
    fdlInclRownumField = new FormData();
    fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
    fdlInclRownumField.top = new FormAttachment(wFilterFileType, 2 * margin);
    wlInclRownumField.setLayoutData(fdlInclRownumField);
    wInclRownumField = new TextVar(transMeta, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclRownumField);
    wInclRownumField.addModifyListener(lsMod);
    fdInclRownumField = new FormData();
    fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
    fdInclRownumField.top = new FormAttachment(wFilterFileType, 2 * margin);
    fdInclRownumField.right = new FormAttachment(100, 0);
    wInclRownumField.setLayoutData(fdInclRownumField);
    fdAdditionalGroup = new FormData();
    fdAdditionalGroup.left = new FormAttachment(0, margin);
    fdAdditionalGroup.top = new FormAttachment(wFilterFileType, margin);
    fdAdditionalGroup.right = new FormAttachment(100, -margin);
    wAdditionalGroup.setLayoutData(fdAdditionalGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF DESTINATION ADDRESS GROUP
    // ///////////////////////////////////////////////////////////
    // do not fail if no files?
    wldoNotFailIfNoFile = new Label(wFilterComp, SWT.RIGHT);
    wldoNotFailIfNoFile.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.doNotFailIfNoFile.Label"));
    props.setLook(wldoNotFailIfNoFile);
    fdldoNotFailIfNoFile = new FormData();
    fdldoNotFailIfNoFile.left = new FormAttachment(0, 0);
    fdldoNotFailIfNoFile.top = new FormAttachment(wAdditionalGroup, 2 * margin);
    fdldoNotFailIfNoFile.right = new FormAttachment(middle, -margin);
    wldoNotFailIfNoFile.setLayoutData(fdldoNotFailIfNoFile);
    wdoNotFailIfNoFile = new Button(wFilterComp, SWT.CHECK);
    props.setLook(wdoNotFailIfNoFile);
    wdoNotFailIfNoFile.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.doNotFailIfNoFile.Tooltip"));
    fddoNotFailIfNoFile = new FormData();
    fddoNotFailIfNoFile.left = new FormAttachment(middle, 0);
    fddoNotFailIfNoFile.top = new FormAttachment(wAdditionalGroup, 2 * margin);
    wdoNotFailIfNoFile.setLayoutData(fddoNotFailIfNoFile);
    wdoNotFailIfNoFile.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            input.setChanged();
        }
    });
    wlLimit = new Label(wFilterComp, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.Limit.Label"));
    props.setLook(wlLimit);
    fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wdoNotFailIfNoFile, margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(wFilterComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLimit);
    wLimit.addModifyListener(lsMod);
    fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wdoNotFailIfNoFile, margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    // ///////////////////////////////
    // START OF AddFileResult GROUP //
    // ///////////////////////////////
    wAddFileResult = new Group(wFilterComp, SWT.SHADOW_NONE);
    props.setLook(wAddFileResult);
    wAddFileResult.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.wAddFileResult.Label"));
    FormLayout AddFileResultgroupLayout = new FormLayout();
    AddFileResultgroupLayout.marginWidth = 10;
    AddFileResultgroupLayout.marginHeight = 10;
    wAddFileResult.setLayout(AddFileResultgroupLayout);
    wlAddResult = new Label(wAddFileResult, SWT.RIGHT);
    wlAddResult.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.AddResult.Label"));
    props.setLook(wlAddResult);
    fdlAddResult = new FormData();
    fdlAddResult.left = new FormAttachment(0, 0);
    fdlAddResult.top = new FormAttachment(wLimit, margin);
    fdlAddResult.right = new FormAttachment(middle, -margin);
    wlAddResult.setLayoutData(fdlAddResult);
    wAddResult = new Button(wAddFileResult, SWT.CHECK);
    props.setLook(wAddResult);
    wAddResult.setToolTipText(BaseMessages.getString(PKG, "GetFileNamesDialog.AddResult.Tooltip"));
    fdAddResult = new FormData();
    fdAddResult.left = new FormAttachment(middle, 0);
    fdAddResult.top = new FormAttachment(wLimit, margin);
    wAddResult.setLayoutData(fdAddResult);
    wAddResult.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            input.setChanged();
        }
    });
    fdAddFileResult = new FormData();
    fdAddFileResult.left = new FormAttachment(0, margin);
    fdAddFileResult.top = new FormAttachment(wLimit, margin);
    fdAddFileResult.right = new FormAttachment(100, -margin);
    wAddFileResult.setLayoutData(fdAddFileResult);
    // ///////////////////////////////////////////////////////////
    // / END OF AddFileResult GROUP
    // ///////////////////////////////////////////////////////////
    fdFilterComp = new FormData();
    fdFilterComp.left = new FormAttachment(0, 0);
    fdFilterComp.top = new FormAttachment(0, 0);
    fdFilterComp.right = new FormAttachment(100, 0);
    fdFilterComp.bottom = new FormAttachment(100, 0);
    wFilterComp.setLayoutData(fdFilterComp);
    wFilterComp.layout();
    wFilterTab.setControl(wFilterComp);
    // ///////////////////////////////////////////////////////////
    // / END OF FILE Filter TAB
    // ///////////////////////////////////////////////////////////
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "GetFileNamesDialog.Preview.Button"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

        public void handleEvent(Event e) {
            preview();
        }
    };
    lsCancel = new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wPreview.addListener(SWT.Selection, lsPreview);
    wCancel.addListener(SWT.Selection, lsCancel);
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    // Add the file to the list of files...
    SelectionAdapter selA = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            wFilenameList.add(new String[] { wFilename.getText(), wFilemask.getText(), wExcludeFilemask.getText(), GetFileNamesMeta.RequiredFilesCode[0], GetFileNamesMeta.RequiredFilesCode[0] });
            wFilename.setText("");
            wFilemask.setText("");
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
            wFilenameList.optWidth(true);
        }
    };
    wbaFilename.addSelectionListener(selA);
    wFilename.addSelectionListener(selA);
    // Delete files from the list of files...
    wbdFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            int[] idx = wFilenameList.getSelectionIndices();
            wFilenameList.remove(idx);
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
            input.setChanged();
        }
    });
    // Edit the selected file & remove from the list...
    wbeFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            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();
            input.setChanged();
        }
    });
    // Show the files that are selected at this time...
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            GetFileNamesMeta tfii = new GetFileNamesMeta();
            getInfo(tfii);
            String[] files = tfii.getFilePaths(transMeta);
            if (files != null && files.length > 0) {
                EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, "Files read", "Files read:");
                esd.setViewOnly();
                esd.open();
            } else {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                mb.setMessage(BaseMessages.getString(PKG, "GetFileNamesDialog.NoFilesFound.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                mb.open();
            }
        }
    });
    // Listen to the Browse... button
    wbbFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (!Utils.isEmpty(wFilemask.getText()) || !Utils.isEmpty(wExcludeFilemask.getText())) {
                DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
                if (wFilename.getText() != null) {
                    String fpath = transMeta.environmentSubstitute(wFilename.getText());
                    dialog.setFilterPath(fpath);
                }
                if (dialog.open() != null) {
                    String str = dialog.getFilterPath();
                    wFilename.setText(str);
                }
            } else {
                FileDialog dialog = new FileDialog(shell, SWT.OPEN);
                dialog.setFilterExtensions(new String[] { "*.txt;*.csv", "*.csv", "*.txt", "*" });
                if (wFilename.getText() != null) {
                    String fname = transMeta.environmentSubstitute(wFilename.getText());
                    dialog.setFileName(fname);
                }
                dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "GetFileNamesDialog.FileType.TextAndCSVFiles"), BaseMessages.getString(PKG, "System.FileType.CSVFiles"), BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
                if (dialog.open() != null) {
                    String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
                    wFilename.setText(str);
                }
            }
        }
    });
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setFileField();
    getData(input);
    ActiveFileField();
    setSize();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) CTabFolder(org.eclipse.swt.custom.CTabFolder) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) GetFileNamesMeta(org.pentaho.di.trans.steps.getfilenames.GetFileNamesMeta) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) TableView(org.pentaho.di.ui.core.widget.TableView) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) MessageBox(org.eclipse.swt.widgets.MessageBox) CCombo(org.eclipse.swt.custom.CCombo) Event(org.eclipse.swt.widgets.Event) ModifyEvent(org.eclipse.swt.events.ModifyEvent) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 63 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class GetFilesRowsCountDialog method open.

public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    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, "GetFilesRowsCountDialog.DialogTitle"));
    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.top = new FormAttachment(0, margin);
    fdlStepname.right = new FormAttachment(middle, -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);
    wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF FILE TAB ///
    // ////////////////////////
    wFileTab = new CTabItem(wTabFolder, SWT.NONE);
    wFileTab.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.File.Tab"));
    wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    // ///////////////////////////////
    // START OF Origin files GROUP //
    // ///////////////////////////////
    wOriginFiles = new Group(wFileComp, SWT.SHADOW_NONE);
    props.setLook(wOriginFiles);
    wOriginFiles.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.wOriginFiles.Label"));
    FormLayout OriginFilesgroupLayout = new FormLayout();
    OriginFilesgroupLayout.marginWidth = 10;
    OriginFilesgroupLayout.marginHeight = 10;
    wOriginFiles.setLayout(OriginFilesgroupLayout);
    // Is Filename defined in a Field
    wlFileField = new Label(wOriginFiles, SWT.RIGHT);
    wlFileField.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FileField.Label"));
    props.setLook(wlFileField);
    fdlFileField = new FormData();
    fdlFileField.left = new FormAttachment(0, -margin);
    fdlFileField.top = new FormAttachment(0, margin);
    fdlFileField.right = new FormAttachment(middle, -2 * margin);
    wlFileField.setLayoutData(fdlFileField);
    wFileField = new Button(wOriginFiles, SWT.CHECK);
    props.setLook(wFileField);
    wFileField.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FileField.Tooltip"));
    fdFileField = new FormData();
    fdFileField.left = new FormAttachment(middle, -margin);
    fdFileField.top = new FormAttachment(0, margin);
    wFileField.setLayoutData(fdFileField);
    SelectionAdapter lfilefield = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            ActiveFileField();
            input.setChanged();
        }
    };
    wFileField.addSelectionListener(lfilefield);
    // Filename field
    wlFilenameField = new Label(wOriginFiles, SWT.RIGHT);
    wlFilenameField.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameField.Label"));
    props.setLook(wlFilenameField);
    fdlFilenameField = new FormData();
    fdlFilenameField.left = new FormAttachment(0, -margin);
    fdlFilenameField.top = new FormAttachment(wFileField, margin);
    fdlFilenameField.right = new FormAttachment(middle, -2 * margin);
    wlFilenameField.setLayoutData(fdlFilenameField);
    wFilenameField = new CCombo(wOriginFiles, SWT.BORDER | SWT.READ_ONLY);
    wFilenameField.setEditable(true);
    props.setLook(wFilenameField);
    wFilenameField.addModifyListener(lsMod);
    fdFilenameField = new FormData();
    fdFilenameField.left = new FormAttachment(middle, -margin);
    fdFilenameField.top = new FormAttachment(wFileField, margin);
    fdFilenameField.right = new FormAttachment(100, -margin);
    wFilenameField.setLayoutData(fdFilenameField);
    wFilenameField.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);
            setFileField();
            shell.setCursor(null);
            busy.dispose();
        }
    });
    fdOriginFiles = new FormData();
    fdOriginFiles.left = new FormAttachment(0, margin);
    fdOriginFiles.top = new FormAttachment(wFilenameList, margin);
    fdOriginFiles.right = new FormAttachment(100, -margin);
    wOriginFiles.setLayoutData(fdOriginFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Origin files GROUP
    // ///////////////////////////////////////////////////////////
    // Filename line
    wlFilename = new Label(wFileComp, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(wOriginFiles, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbbFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbbFilename);
    wbbFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameBrowse.Button"));
    wbbFilename.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.BrowseForFileOrDirAndAdd"));
    fdbFilename = new FormData();
    fdbFilename.right = new FormAttachment(100, 0);
    fdbFilename.top = new FormAttachment(wOriginFiles, margin);
    wbbFilename.setLayoutData(fdbFilename);
    wbaFilename = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbaFilename);
    wbaFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameAdd.Button"));
    wbaFilename.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameAdd.Tooltip"));
    fdbaFilename = new FormData();
    fdbaFilename.right = new FormAttachment(wbbFilename, -margin);
    fdbaFilename.top = new FormAttachment(wOriginFiles, margin);
    wbaFilename.setLayoutData(fdbaFilename);
    wFilename = new TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.right = new FormAttachment(wbaFilename, -margin);
    fdFilename.top = new FormAttachment(wOriginFiles, margin);
    wFilename.setLayoutData(fdFilename);
    wlFilemask = new Label(wFileComp, SWT.RIGHT);
    wlFilemask.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RegExp.Label"));
    props.setLook(wlFilemask);
    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 TextVar(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilemask);
    wFilemask.addModifyListener(lsMod);
    fdFilemask = new FormData();
    fdFilemask.left = new FormAttachment(middle, 0);
    fdFilemask.top = new FormAttachment(wFilename, margin);
    fdFilemask.right = new FormAttachment(100, 0);
    wFilemask.setLayoutData(fdFilemask);
    wlExcludeFilemask = new Label(wFileComp, SWT.RIGHT);
    wlExcludeFilemask.setText(BaseMessages.getString(PKG, "GetFilesRowsDialog.ExcludeFilemask.Label"));
    props.setLook(wlExcludeFilemask);
    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(transMeta, wFileComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wExcludeFilemask);
    wExcludeFilemask.addModifyListener(lsMod);
    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, "GetFilesRowsCountDialog.FilenameList.Label"));
    props.setLook(wlFilenameList);
    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);
    props.setLook(wbdFilename);
    wbdFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameRemove.Button"));
    wbdFilename.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameRemove.Tooltip"));
    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);
    props.setLook(wbeFilename);
    wbeFilename.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameEdit.Button"));
    wbeFilename.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilenameEdit.Tooltip"));
    fdbeFilename = new FormData();
    fdbeFilename.right = new FormAttachment(100, 0);
    fdbeFilename.top = new FormAttachment(wbdFilename, margin);
    wbeFilename.setLayoutData(fdbeFilename);
    wbShowFiles = new Button(wFileComp, SWT.PUSH | SWT.CENTER);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.ShowFiles.Button"));
    fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.bottom = new FormAttachment(100, 0);
    wbShowFiles.setLayoutData(fdbShowFiles);
    ColumnInfo[] colinfo = new ColumnInfo[5];
    colinfo[0] = new ColumnInfo(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Files.Filename.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[1] = new ColumnInfo(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Files.Wildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[2] = new ColumnInfo(BaseMessages.getString(PKG, "GetFilesRowsDialog.Files.ExcludeWildcard.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false);
    colinfo[3] = new ColumnInfo(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Required.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, GetFilesRowsCountMeta.RequiredFilesDesc);
    colinfo[4] = new ColumnInfo(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.IncludeSubDirs.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, GetFilesRowsCountMeta.RequiredFilesDesc);
    colinfo[0].setUsingVariables(true);
    colinfo[1].setUsingVariables(true);
    colinfo[1].setToolTip(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Files.Wildcard.Tooltip"));
    colinfo[2].setUsingVariables(true);
    colinfo[2].setToolTip(BaseMessages.getString(PKG, "GetFilesRowsDialog.Files.ExcludeWildcard.Tooltip"));
    wFilenameList = new TableView(transMeta, wFileComp, SWT.FULL_SELECTION | SWT.SINGLE | SWT.BORDER, colinfo, 2, lsMod, props);
    props.setLook(wFilenameList);
    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(wbShowFiles, -margin);
    wFilenameList.setLayoutData(fdFilenameList);
    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 CONTENT TAB///
    // /
    wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Content.Tab"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    // /////////////////////////////////
    // START OF Files Count Field GROUP
    // /////////////////////////////////
    wFilesCountFieldGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wFilesCountFieldGroup);
    wFilesCountFieldGroup.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Group.CountFilesFieldGroup.Label"));
    FormLayout countfilesfieldgroupLayout = new FormLayout();
    countfilesfieldgroupLayout.marginWidth = 10;
    countfilesfieldgroupLayout.marginHeight = 10;
    wFilesCountFieldGroup.setLayout(countfilesfieldgroupLayout);
    wlRowsCountField = new Label(wFilesCountFieldGroup, SWT.RIGHT);
    wlRowsCountField.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowsCountField.Label"));
    props.setLook(wlRowsCountField);
    fdlRowsCountField = new FormData();
    fdlRowsCountField.left = new FormAttachment(wInclFilesCount, margin);
    fdlRowsCountField.top = new FormAttachment(0, margin);
    wlRowsCountField.setLayoutData(fdlRowsCountField);
    wRowsCountField = new TextVar(transMeta, wFilesCountFieldGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wRowsCountField);
    wRowsCountField.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowsCountField.Tooltip"));
    wRowsCountField.addModifyListener(lsMod);
    fdRowsCountField = new FormData();
    fdRowsCountField.left = new FormAttachment(wlRowsCountField, margin);
    fdRowsCountField.top = new FormAttachment(0, margin);
    fdRowsCountField.right = new FormAttachment(100, 0);
    wRowsCountField.setLayoutData(fdRowsCountField);
    fdFilesCountFieldGroup = new FormData();
    fdFilesCountFieldGroup.left = new FormAttachment(0, margin);
    fdFilesCountFieldGroup.top = new FormAttachment(0, margin);
    fdFilesCountFieldGroup.right = new FormAttachment(100, -margin);
    wFilesCountFieldGroup.setLayoutData(fdFilesCountFieldGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF ADDITIONNAL FIELDS GROUP
    // ///////////////////////////////////////////////////////////
    // /////////////////////////////////
    // START OF Row separator GROUP
    // /////////////////////////////////
    wRowSeparatorGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wRowSeparatorGroup);
    wRowSeparatorGroup.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Group.RowSeparator.Label"));
    FormLayout rowseparatorgroupLayout = new FormLayout();
    rowseparatorgroupLayout.marginWidth = 10;
    rowseparatorgroupLayout.marginHeight = 10;
    wRowSeparatorGroup.setLayout(rowseparatorgroupLayout);
    wlRowSeparatorFormat = new Label(wRowSeparatorGroup, SWT.RIGHT);
    wlRowSeparatorFormat.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.Label"));
    props.setLook(wlRowSeparatorFormat);
    fdlRowSeparatorFormat = new FormData();
    fdlRowSeparatorFormat.left = new FormAttachment(0, 0);
    fdlRowSeparatorFormat.top = new FormAttachment(wFilesCountFieldGroup, margin);
    fdlRowSeparatorFormat.right = new FormAttachment(middle, -margin);
    wlRowSeparatorFormat.setLayoutData(fdlRowSeparatorFormat);
    wRowSeparatorFormat = new CCombo(wRowSeparatorGroup, SWT.BORDER | SWT.READ_ONLY);
    props.setLook(wRowSeparatorFormat);
    wRowSeparatorFormat.add(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.CR.Label"));
    wRowSeparatorFormat.add(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.LF.Label"));
    wRowSeparatorFormat.add(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.CRLF.Label"));
    wRowSeparatorFormat.add(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.TAB.Label"));
    wRowSeparatorFormat.add(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparatorFormat.CUSTOM.Label"));
    wRowSeparatorFormat.select(0);
    wRowSeparatorFormat.addModifyListener(lsMod);
    fdRowSeparatorFormat = new FormData();
    fdRowSeparatorFormat.left = new FormAttachment(middle, 0);
    fdRowSeparatorFormat.top = new FormAttachment(wFilesCountFieldGroup, margin);
    fdRowSeparatorFormat.right = new FormAttachment(100, 0);
    wRowSeparatorFormat.setLayoutData(fdRowSeparatorFormat);
    wRowSeparatorFormat.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            ActiveRowSeparator();
        }
    });
    wlRowSeparator = new Label(wRowSeparatorGroup, SWT.RIGHT);
    wlRowSeparator.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparator.Label"));
    props.setLook(wlRowSeparator);
    fdlRowSeparator = new FormData();
    fdlRowSeparator.left = new FormAttachment(wInclFilesCount, margin);
    fdlRowSeparator.top = new FormAttachment(wRowSeparatorFormat, margin);
    wlRowSeparator.setLayoutData(fdlRowSeparator);
    wRowSeparator = new TextVar(transMeta, wRowSeparatorGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wRowSeparator);
    wRowSeparator.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.RowSeparator.Tooltip"));
    wRowSeparator.addModifyListener(lsMod);
    fdRowSeparator = new FormData();
    fdRowSeparator.left = new FormAttachment(wlRowSeparator, margin);
    fdRowSeparator.top = new FormAttachment(wRowSeparatorFormat, margin);
    fdRowSeparator.right = new FormAttachment(100, 0);
    wRowSeparator.setLayoutData(fdRowSeparator);
    wlSmartCount = new Label(wRowSeparatorGroup, SWT.RIGHT);
    wlSmartCount.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.SmartCount.Label"));
    props.setLook(wlSmartCount);
    fdlSmartCount = new FormData();
    fdlSmartCount.left = new FormAttachment(0, 0);
    fdlSmartCount.top = new FormAttachment(wRowSeparator, margin);
    fdlSmartCount.right = new FormAttachment(middle, -margin);
    wlSmartCount.setLayoutData(fdlSmartCount);
    wSmartCount = new Button(wRowSeparatorGroup, SWT.CHECK);
    props.setLook(wSmartCount);
    wSmartCount.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.SmartCount.Tooltip"));
    fdSmartCount = new FormData();
    fdSmartCount.left = new FormAttachment(middle, 0);
    fdSmartCount.top = new FormAttachment(wRowSeparator, margin);
    wSmartCount.setLayoutData(fdSmartCount);
    wSmartCount.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            input.setChanged();
        }
    });
    fdRowSeparatorGroup = new FormData();
    fdRowSeparatorGroup.left = new FormAttachment(0, margin);
    fdRowSeparatorGroup.top = new FormAttachment(wFilesCountFieldGroup, margin);
    fdRowSeparatorGroup.right = new FormAttachment(100, -margin);
    wRowSeparatorGroup.setLayoutData(fdRowSeparatorGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF ROW SEPARATOR GROUP
    // ///////////////////////////////////////////////////////////
    // /////////////////////////////////
    // START OF Additional Fields GROUP
    // /////////////////////////////////
    wAdditionalGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAdditionalGroup);
    wAdditionalGroup.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Group.AdditionalGroup.Label"));
    FormLayout additionalgroupLayout = new FormLayout();
    additionalgroupLayout.marginWidth = 10;
    additionalgroupLayout.marginHeight = 10;
    wAdditionalGroup.setLayout(additionalgroupLayout);
    wlInclFilesCount = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclFilesCount.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.InclCountFiles.Label"));
    props.setLook(wlInclFilesCount);
    fdlInclFilesCount = new FormData();
    fdlInclFilesCount.left = new FormAttachment(0, 0);
    fdlInclFilesCount.top = new FormAttachment(wRowSeparatorGroup, margin);
    fdlInclFilesCount.right = new FormAttachment(middle, -margin);
    wlInclFilesCount.setLayoutData(fdlInclFilesCount);
    wInclFilesCount = new Button(wAdditionalGroup, SWT.CHECK);
    props.setLook(wInclFilesCount);
    wInclFilesCount.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.InclCountFiles.Tooltip"));
    fdFilesCount = new FormData();
    fdFilesCount.left = new FormAttachment(middle, 0);
    fdFilesCount.top = new FormAttachment(wRowSeparatorGroup, margin);
    wInclFilesCount.setLayoutData(fdFilesCount);
    wlInclFilesCountField = new Label(wAdditionalGroup, SWT.RIGHT);
    wlInclFilesCountField.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.InclCountFilesField.Label"));
    props.setLook(wlInclFilesCountField);
    fdlInclFilesCountField = new FormData();
    fdlInclFilesCountField.left = new FormAttachment(wInclFilesCount, margin);
    fdlInclFilesCountField.top = new FormAttachment(wRowSeparatorGroup, margin);
    wlInclFilesCountField.setLayoutData(fdlInclFilesCountField);
    wInclFilesCountField = new TextVar(transMeta, wAdditionalGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wInclFilesCountField);
    wInclFilesCountField.addModifyListener(lsMod);
    fdInclFilesCountField = new FormData();
    fdInclFilesCountField.left = new FormAttachment(wlInclFilesCountField, margin);
    fdInclFilesCountField.top = new FormAttachment(wRowSeparatorGroup, margin);
    fdInclFilesCountField.right = new FormAttachment(100, 0);
    wInclFilesCountField.setLayoutData(fdInclFilesCountField);
    fdAdditionalGroup = new FormData();
    fdAdditionalGroup.left = new FormAttachment(0, margin);
    fdAdditionalGroup.top = new FormAttachment(wRowSeparatorGroup, margin);
    fdAdditionalGroup.right = new FormAttachment(100, -margin);
    wAdditionalGroup.setLayoutData(fdAdditionalGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF ADDITIONNAL FIELDS GROUP
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////
    // START OF AddFileResult GROUP //
    // ///////////////////////////////
    wAddFileResult = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wAddFileResult);
    wAddFileResult.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.wAddFileResult.Label"));
    FormLayout AddFileResultgroupLayout = new FormLayout();
    AddFileResultgroupLayout.marginWidth = 10;
    AddFileResultgroupLayout.marginHeight = 10;
    wAddFileResult.setLayout(AddFileResultgroupLayout);
    wlAddResult = new Label(wAddFileResult, SWT.RIGHT);
    wlAddResult.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.AddResult.Label"));
    props.setLook(wlAddResult);
    fdlAddResult = new FormData();
    fdlAddResult.left = new FormAttachment(0, 0);
    fdlAddResult.top = new FormAttachment(wAdditionalGroup, margin);
    fdlAddResult.right = new FormAttachment(middle, -margin);
    wlAddResult.setLayoutData(fdlAddResult);
    wAddResult = new Button(wAddFileResult, SWT.CHECK);
    props.setLook(wAddResult);
    wAddResult.setToolTipText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.AddResult.Tooltip"));
    fdAddResult = new FormData();
    fdAddResult.left = new FormAttachment(middle, 0);
    fdAddResult.top = new FormAttachment(wAdditionalGroup, margin);
    wAddResult.setLayoutData(fdAddResult);
    wAddResult.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            input.setChanged();
        }
    });
    fdAddFileResult = new FormData();
    fdAddFileResult.left = new FormAttachment(0, margin);
    fdAddFileResult.top = new FormAttachment(wAdditionalGroup, margin);
    fdAddFileResult.right = new FormAttachment(100, -margin);
    wAddFileResult.setLayoutData(fdAddFileResult);
    // ///////////////////////////////////////////////////////////
    // / END OF AddFileResult GROUP
    // ////////////////////////////////////
    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
    // ///////////////////////////////////////////////////////////
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wStepname, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, -50);
    wTabFolder.setLayoutData(fdTabFolder);
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.Button.PreviewRows"));
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
    // Add listeners
    lsOK = new Listener() {

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

        public void handleEvent(Event e) {
            preview();
        }
    };
    lsCancel = new Listener() {

        public void handleEvent(Event e) {
            cancel();
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wPreview.addListener(SWT.Selection, lsPreview);
    wCancel.addListener(SWT.Selection, lsCancel);
    lsDef = new SelectionAdapter() {

        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    wInclFilesCountField.addSelectionListener(lsDef);
    // Add the file to the list of files...
    SelectionAdapter selA = new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            wFilenameList.add(new String[] { wFilename.getText(), wFilemask.getText(), wExcludeFilemask.getText(), GetFilesRowsCountMeta.RequiredFilesCode[0], GetFilesRowsCountMeta.RequiredFilesCode[0] });
            wFilename.setText("");
            wFilemask.setText("");
            wExcludeFilemask.setText("");
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
            wFilenameList.optWidth(true);
        }
    };
    wbaFilename.addSelectionListener(selA);
    wFilename.addSelectionListener(selA);
    // Delete files from the list of files...
    wbdFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            int[] idx = wFilenameList.getSelectionIndices();
            wFilenameList.remove(idx);
            wFilenameList.removeEmptyRows();
            wFilenameList.setRowNums();
            input.setChanged();
        }
    });
    // Edit the selected file & remove from the list...
    wbeFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent arg0) {
            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();
            input.setChanged();
        }
    });
    // Show the files that are selected at this time...
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            try {
                GetFilesRowsCountMeta tfii = new GetFilesRowsCountMeta();
                getInfo(tfii);
                FileInputList fileInputList = tfii.getFiles(transMeta);
                String[] files = fileInputList.getFileStrings();
                if (files.length > 0) {
                    EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilesReadSelection.DialogTitle"), BaseMessages.getString(PKG, "GetFilesRowsCountDialog.FilesReadSelection.DialogMessage"));
                    esd.setViewOnly();
                    esd.open();
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                    mb.setMessage(BaseMessages.getString(PKG, "GetFilesRowsCountDialog.NoFileFound.DialogMessage"));
                    mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                    mb.open();
                }
            } catch (KettleException ex) {
                new ErrorDialog(shell, BaseMessages.getString(PKG, "GetFilesRowsCountDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "GetFilesRowsCountDialog.ErrorParsingData.DialogMessage"), ex);
            }
        }
    });
    // Enable/disable the right fields to allow a row number to be added to each row...
    wInclFilesCount.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            setIncludeRownum();
            input.setChanged();
        }
    });
    // Whenever something changes, set the tooltip to the expanded version of the filename:
    wFilename.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            // StringUtil.environmentSubstitute( wFilename.getText() ) );
            wFilename.setToolTipText("");
        }
    });
    // Listen to the Browse... button
    wbbFilename.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (!Utils.isEmpty(wFilemask.getText()) || !Utils.isEmpty(wExcludeFilemask.getText())) {
                // A mask: a directory!
                DirectoryDialog dialog = new DirectoryDialog(shell, SWT.OPEN);
                if (wFilename.getText() != null) {
                    // StringUtil.environmentSubstitute(wFilename.getText());
                    String fpath = "";
                    dialog.setFilterPath(fpath);
                }
                if (dialog.open() != null) {
                    String str = dialog.getFilterPath();
                    wFilename.setText(str);
                }
            } else {
                FileDialog dialog = new FileDialog(shell, SWT.OPEN);
                dialog.setFilterExtensions(new String[] { "*" });
                if (wFilename.getText() != null) {
                    // StringUtil.environmentSubstitute(wFilename.getText());
                    String fname = "";
                    dialog.setFileName(fname);
                }
                dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "System.FileType.AllFiles") });
                if (dialog.open() != null) {
                    String str = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
                    wFilename.setText(str);
                }
            }
        }
    });
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    wTabFolder.setSelection(0);
    // Set the shell size, based upon previous time...
    setSize();
    getData(input);
    ActiveFileField();
    ActiveRowSeparator();
    input.setChanged(changed);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) KettleException(org.pentaho.di.core.exception.KettleException) CTabFolder(org.eclipse.swt.custom.CTabFolder) FocusListener(org.eclipse.swt.events.FocusListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) Cursor(org.eclipse.swt.graphics.Cursor) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) FileInputList(org.pentaho.di.core.fileinput.FileInputList) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) TableView(org.pentaho.di.ui.core.widget.TableView) DirectoryDialog(org.eclipse.swt.widgets.DirectoryDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GetFilesRowsCountMeta(org.pentaho.di.trans.steps.getfilesrowscount.GetFilesRowsCountMeta) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) Text(org.eclipse.swt.widgets.Text) TextVar(org.pentaho.di.ui.core.widget.TextVar) MessageBox(org.eclipse.swt.widgets.MessageBox) CCombo(org.eclipse.swt.custom.CCombo) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusListener(org.eclipse.swt.events.FocusListener) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 64 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class ExcelWriterStepDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    Display display = parent.getDisplay();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    setShellImage(shell, input);
    SelectionAdapter lsSel = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
        }
    };
    ModifyListener lsMod = new ModifyListener() {

        @Override
        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, "ExcelWriterDialog.DialogTitle"));
    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.top = new FormAttachment(0, margin);
    fdlStepname.right = new FormAttachment(middle, -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);
    ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);
    wTabFolder = new CTabFolder(sc, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF FILE TAB///
    // /
    wFileTab = new CTabItem(wTabFolder, SWT.NONE);
    wFileTab.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.FileTab.TabTitle"));
    Composite wFileComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFileComp);
    FormLayout fileLayout = new FormLayout();
    fileLayout.marginWidth = 3;
    fileLayout.marginHeight = 3;
    wFileComp.setLayout(fileLayout);
    Group fileGroup = new Group(wFileComp, SWT.SHADOW_NONE);
    props.setLook(fileGroup);
    fileGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.fileGroup.Label"));
    FormLayout fileGroupgroupLayout = new FormLayout();
    fileGroupgroupLayout.marginWidth = 10;
    fileGroupgroupLayout.marginHeight = 10;
    fileGroup.setLayout(fileGroupgroupLayout);
    // Filename line
    wlFilename = new Label(fileGroup, SWT.RIGHT);
    wlFilename.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Filename.Label"));
    props.setLook(wlFilename);
    fdlFilename = new FormData();
    fdlFilename.left = new FormAttachment(0, 0);
    fdlFilename.top = new FormAttachment(0, margin);
    fdlFilename.right = new FormAttachment(middle, -margin);
    wlFilename.setLayoutData(fdlFilename);
    wbFilename = new Button(fileGroup, 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(0, 0);
    wbFilename.setLayoutData(fdbFilename);
    wFilename = new TextVar(transMeta, fileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilename);
    wFilename.addModifyListener(lsMod);
    wFilename.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Filename.Tooltip"));
    fdFilename = new FormData();
    fdFilename.left = new FormAttachment(middle, 0);
    fdFilename.top = new FormAttachment(0, margin);
    fdFilename.right = new FormAttachment(wbFilename, -margin);
    wFilename.setLayoutData(fdFilename);
    // Extension line
    wlExtension = new Label(fileGroup, SWT.RIGHT);
    wlExtension.setText(BaseMessages.getString(PKG, "System.Label.Extension"));
    props.setLook(wlExtension);
    fdlExtension = new FormData();
    fdlExtension.left = new FormAttachment(0, 0);
    fdlExtension.top = new FormAttachment(wFilename, margin);
    fdlExtension.right = new FormAttachment(middle, -margin);
    wlExtension.setLayoutData(fdlExtension);
    wExtension = new CCombo(fileGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
    String xlsLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLS.Label");
    String xlsxLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLSX.Label");
    wExtension.setItems(new String[] { xlsLabel, xlsxLabel });
    wExtension.setData(xlsLabel, "xls");
    wExtension.setData(xlsxLabel, "xlsx");
    props.setLook(wExtension);
    wExtension.addModifyListener(lsMod);
    wExtension.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            enableExtension();
        }
    });
    wExtension.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Extension.Tooltip"));
    fdExtension = new FormData();
    fdExtension.left = new FormAttachment(middle, 0);
    fdExtension.top = new FormAttachment(wFilename, margin);
    fdExtension.right = new FormAttachment(wbFilename, -margin);
    wExtension.setLayoutData(fdExtension);
    wlStreamData = new Label(fileGroup, SWT.RIGHT);
    wlStreamData.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.StreamData.Label"));
    props.setLook(wlStreamData);
    fdlStreamData = new FormData();
    fdlStreamData.left = new FormAttachment(0, 0);
    fdlStreamData.top = new FormAttachment(wExtension, margin);
    fdlStreamData.right = new FormAttachment(middle, -margin);
    wlStreamData.setLayoutData(fdlStreamData);
    wStreamData = new Button(fileGroup, SWT.CHECK);
    props.setLook(wStreamData);
    fdStreamData = new FormData();
    fdStreamData.left = new FormAttachment(middle, 0);
    fdStreamData.top = new FormAttachment(wExtension, margin);
    fdStreamData.right = new FormAttachment(100, 0);
    wStreamData.setLayoutData(fdStreamData);
    wStreamData.addSelectionListener(lsSel);
    // split every x rows
    wlSplitEvery = new Label(fileGroup, SWT.RIGHT);
    wlSplitEvery.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.SplitEvery.Label"));
    props.setLook(wlSplitEvery);
    fdlSplitEvery = new FormData();
    fdlSplitEvery.left = new FormAttachment(0, 0);
    fdlSplitEvery.top = new FormAttachment(wStreamData, margin);
    fdlSplitEvery.right = new FormAttachment(middle, -margin);
    wlSplitEvery.setLayoutData(fdlSplitEvery);
    wSplitEvery = new Text(fileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSplitEvery);
    wSplitEvery.addModifyListener(lsMod);
    wSplitEvery.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.SplitEvery.Tooltip"));
    fdSplitEvery = new FormData();
    fdSplitEvery.left = new FormAttachment(middle, 0);
    fdSplitEvery.top = new FormAttachment(wStreamData, margin);
    fdSplitEvery.right = new FormAttachment(100, 0);
    wSplitEvery.setLayoutData(fdSplitEvery);
    // Create multi-part file?
    wlAddStepnr = new Label(fileGroup, SWT.RIGHT);
    wlAddStepnr.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddStepnr.Label"));
    props.setLook(wlAddStepnr);
    fdlAddStepnr = new FormData();
    fdlAddStepnr.left = new FormAttachment(0, 0);
    fdlAddStepnr.top = new FormAttachment(wSplitEvery, margin);
    fdlAddStepnr.right = new FormAttachment(middle, -margin);
    wlAddStepnr.setLayoutData(fdlAddStepnr);
    wAddStepnr = new Button(fileGroup, SWT.CHECK);
    props.setLook(wAddStepnr);
    fdAddStepnr = new FormData();
    fdAddStepnr.left = new FormAttachment(middle, 0);
    fdAddStepnr.top = new FormAttachment(wSplitEvery, margin);
    fdAddStepnr.right = new FormAttachment(100, 0);
    wAddStepnr.setLayoutData(fdAddStepnr);
    wAddStepnr.addSelectionListener(lsSel);
    // Create multi-part file?
    wlAddDate = new Label(fileGroup, SWT.RIGHT);
    wlAddDate.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddDate.Label"));
    props.setLook(wlAddDate);
    fdlAddDate = new FormData();
    fdlAddDate.left = new FormAttachment(0, 0);
    fdlAddDate.top = new FormAttachment(wAddStepnr, margin);
    fdlAddDate.right = new FormAttachment(middle, -margin);
    wlAddDate.setLayoutData(fdlAddDate);
    wAddDate = new Button(fileGroup, SWT.CHECK);
    props.setLook(wAddDate);
    fdAddDate = new FormData();
    fdAddDate.left = new FormAttachment(middle, 0);
    fdAddDate.top = new FormAttachment(wAddStepnr, margin);
    fdAddDate.right = new FormAttachment(100, 0);
    wAddDate.setLayoutData(fdAddDate);
    wAddDate.addSelectionListener(lsSel);
    // Create multi-part file?
    wlAddTime = new Label(fileGroup, SWT.RIGHT);
    wlAddTime.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddTime.Label"));
    props.setLook(wlAddTime);
    fdlAddTime = new FormData();
    fdlAddTime.left = new FormAttachment(0, 0);
    fdlAddTime.top = new FormAttachment(wAddDate, margin);
    fdlAddTime.right = new FormAttachment(middle, -margin);
    wlAddTime.setLayoutData(fdlAddTime);
    wAddTime = new Button(fileGroup, SWT.CHECK);
    props.setLook(wAddTime);
    fdAddTime = new FormData();
    fdAddTime.left = new FormAttachment(middle, 0);
    fdAddTime.top = new FormAttachment(wAddDate, margin);
    fdAddTime.right = new FormAttachment(100, 0);
    wAddTime.setLayoutData(fdAddTime);
    wAddTime.addSelectionListener(lsSel);
    // Specify date time format?
    wlSpecifyFormat = new Label(fileGroup, SWT.RIGHT);
    wlSpecifyFormat.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.SpecifyFormat.Label"));
    props.setLook(wlSpecifyFormat);
    fdlSpecifyFormat = new FormData();
    fdlSpecifyFormat.left = new FormAttachment(0, 0);
    fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
    fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
    wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
    wSpecifyFormat = new Button(fileGroup, SWT.CHECK);
    props.setLook(wSpecifyFormat);
    wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.SpecifyFormat.Tooltip"));
    fdSpecifyFormat = new FormData();
    fdSpecifyFormat.left = new FormAttachment(middle, 0);
    fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
    fdSpecifyFormat.right = new FormAttachment(100, 0);
    wSpecifyFormat.setLayoutData(fdSpecifyFormat);
    wSpecifyFormat.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            setDateTimeFormat();
        }
    });
    // Prepare a list of possible DateTimeFormats...
    String[] dats = Const.getDateFormats();
    // DateTimeFormat
    wlDateTimeFormat = new Label(fileGroup, SWT.RIGHT);
    wlDateTimeFormat.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.DateTimeFormat.Label"));
    props.setLook(wlDateTimeFormat);
    fdlDateTimeFormat = new FormData();
    fdlDateTimeFormat.left = new FormAttachment(0, 0);
    fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
    fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
    wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
    wDateTimeFormat = new CCombo(fileGroup, SWT.BORDER | SWT.READ_ONLY);
    wDateTimeFormat.setEditable(true);
    props.setLook(wDateTimeFormat);
    wDateTimeFormat.addModifyListener(lsMod);
    fdDateTimeFormat = new FormData();
    fdDateTimeFormat.left = new FormAttachment(middle, 0);
    fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
    fdDateTimeFormat.right = new FormAttachment(100, 0);
    wDateTimeFormat.setLayoutData(fdDateTimeFormat);
    for (int x = 0; x < dats.length; x++) {
        wDateTimeFormat.add(dats[x]);
    }
    wbShowFiles = new Button(fileGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbShowFiles);
    wbShowFiles.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ShowFiles.Button"));
    fdbShowFiles = new FormData();
    fdbShowFiles.left = new FormAttachment(middle, 0);
    fdbShowFiles.top = new FormAttachment(wDateTimeFormat, margin * 3);
    wbShowFiles.setLayoutData(fdbShowFiles);
    wbShowFiles.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            ExcelWriterStepMeta tfoi = new ExcelWriterStepMeta();
            getInfo(tfoi);
            String[] files = tfoi.getFiles(transMeta);
            if (files != null && files.length > 0) {
                EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, BaseMessages.getString(PKG, "ExcelWriterDialog.SelectOutputFiles.DialogTitle"), BaseMessages.getString(PKG, "ExcelWriterDialog.SelectOutputFiles.DialogMessage"));
                esd.setViewOnly();
                esd.open();
            } else {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
                mb.setMessage(BaseMessages.getString(PKG, "ExcelWriterDialog.NoFilesFound.DialogMessage"));
                mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
                mb.open();
            }
        }
    });
    // If output file exists line
    wlIfFileExists = new Label(fileGroup, SWT.RIGHT);
    wlIfFileExists.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.Label"));
    props.setLook(wlIfFileExists);
    fdlIfFileExists = new FormData();
    fdlIfFileExists.left = new FormAttachment(0, 0);
    fdlIfFileExists.top = new FormAttachment(wbShowFiles, 2 * margin, margin);
    fdlIfFileExists.right = new FormAttachment(middle, -margin);
    wlIfFileExists.setLayoutData(fdlIfFileExists);
    // wIfFileExists=new TextVar(transMeta,wFileComp, SWT.SINGLE | SWT.LEFT |
    // SWT.BORDER);
    wIfFileExists = new CCombo(fileGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
    String createNewLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.CreateNew.Label");
    String reuseLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.Reuse.Label");
    wIfFileExists.setItems(new String[] { createNewLabel, reuseLabel });
    wIfFileExists.setData(createNewLabel, ExcelWriterStepMeta.IF_FILE_EXISTS_CREATE_NEW);
    wIfFileExists.setData(reuseLabel, ExcelWriterStepMeta.IF_FILE_EXISTS_REUSE);
    props.setLook(wIfFileExists);
    wIfFileExists.addModifyListener(lsMod);
    wIfFileExists.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfFileExists.Tooltip"));
    FormData fdIfFileExists = new FormData();
    fdIfFileExists.left = new FormAttachment(middle, 0);
    fdIfFileExists.top = new FormAttachment(wbShowFiles, 2 * margin, margin);
    fdIfFileExists.right = new FormAttachment(100, 0);
    wIfFileExists.setLayoutData(fdIfFileExists);
    // Open new File at Init
    wlDoNotOpenNewFileInit = new Label(fileGroup, SWT.RIGHT);
    wlDoNotOpenNewFileInit.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Label"));
    props.setLook(wlDoNotOpenNewFileInit);
    fdlDoNotOpenNewFileInit = new FormData();
    fdlDoNotOpenNewFileInit.left = new FormAttachment(0, 0);
    fdlDoNotOpenNewFileInit.top = new FormAttachment(wIfFileExists, 2 * margin, margin);
    fdlDoNotOpenNewFileInit.right = new FormAttachment(middle, -margin);
    wlDoNotOpenNewFileInit.setLayoutData(fdlDoNotOpenNewFileInit);
    wDoNotOpenNewFileInit = new Button(fileGroup, SWT.CHECK);
    wDoNotOpenNewFileInit.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.DoNotOpenNewFileInit.Tooltip"));
    props.setLook(wDoNotOpenNewFileInit);
    fdDoNotOpenNewFileInit = new FormData();
    fdDoNotOpenNewFileInit.left = new FormAttachment(middle, 0);
    fdDoNotOpenNewFileInit.top = new FormAttachment(wIfFileExists, 2 * margin, margin);
    fdDoNotOpenNewFileInit.right = new FormAttachment(100, 0);
    wDoNotOpenNewFileInit.setLayoutData(fdDoNotOpenNewFileInit);
    wDoNotOpenNewFileInit.addSelectionListener(lsSel);
    // Add File to the result files name
    wlAddToResult = new Label(fileGroup, SWT.RIGHT);
    wlAddToResult.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddFileToResult.Label"));
    props.setLook(wlAddToResult);
    fdlAddToResult = new FormData();
    fdlAddToResult.left = new FormAttachment(0, 0);
    fdlAddToResult.top = new FormAttachment(wDoNotOpenNewFileInit);
    fdlAddToResult.right = new FormAttachment(middle, -margin);
    wlAddToResult.setLayoutData(fdlAddToResult);
    wAddToResult = new Button(fileGroup, SWT.CHECK);
    wAddToResult.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.AddFileToResult.Tooltip"));
    props.setLook(wAddToResult);
    fdAddToResult = new FormData();
    fdAddToResult.left = new FormAttachment(middle, 0);
    fdAddToResult.top = new FormAttachment(wDoNotOpenNewFileInit);
    fdAddToResult.right = new FormAttachment(100, 0);
    wAddToResult.setLayoutData(fdAddToResult);
    wAddToResult.addSelectionListener(lsSel);
    FormData fsFileGroup = new FormData();
    fsFileGroup.left = new FormAttachment(0, margin);
    fsFileGroup.top = new FormAttachment(0, margin);
    fsFileGroup.right = new FormAttachment(100, -margin);
    fileGroup.setLayoutData(fsFileGroup);
    // END OF FILE GROUP
    Group sheetGroup = new Group(wFileComp, SWT.SHADOW_NONE);
    props.setLook(sheetGroup);
    sheetGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.sheetGroup.Label"));
    FormLayout sheetGroupLayout = new FormLayout();
    sheetGroupLayout.marginWidth = 10;
    sheetGroupLayout.marginHeight = 10;
    sheetGroup.setLayout(sheetGroupLayout);
    // Sheet name line
    wlSheetname = new Label(sheetGroup, SWT.RIGHT);
    wlSheetname.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Sheetname.Label"));
    props.setLook(wlSheetname);
    fdlSheetname = new FormData();
    fdlSheetname.left = new FormAttachment(0, 0);
    fdlSheetname.top = new FormAttachment(0, margin);
    fdlSheetname.right = new FormAttachment(middle, -margin);
    wlSheetname.setLayoutData(fdlSheetname);
    wSheetname = new TextVar(transMeta, sheetGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSheetname.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Sheetname.Tooltip"));
    props.setLook(wSheetname);
    wSheetname.addModifyListener(lsMod);
    fdSheetname = new FormData();
    fdSheetname.left = new FormAttachment(middle, 0);
    fdSheetname.top = new FormAttachment(0, margin);
    fdSheetname.right = new FormAttachment(100, 0);
    wSheetname.setLayoutData(fdSheetname);
    // Make sheet active Sheet Line
    Label wlMakeActiveSheet = new Label(sheetGroup, SWT.RIGHT);
    wlMakeActiveSheet.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.MakeActiveSheet.Label"));
    props.setLook(wlMakeActiveSheet);
    FormData fdlMakeActiveSheet = new FormData();
    fdlMakeActiveSheet.left = new FormAttachment(0, 0);
    fdlMakeActiveSheet.top = new FormAttachment(wSheetname, margin);
    fdlMakeActiveSheet.right = new FormAttachment(middle, -margin);
    wlMakeActiveSheet.setLayoutData(fdlMakeActiveSheet);
    wMakeActiveSheet = new Button(sheetGroup, SWT.CHECK);
    wMakeActiveSheet.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.MakeActiveSheet.Tooltip"));
    props.setLook(wMakeActiveSheet);
    FormData fdMakeActiveSheet = new FormData();
    fdMakeActiveSheet.left = new FormAttachment(middle, 0);
    fdMakeActiveSheet.top = new FormAttachment(wSheetname, margin);
    fdMakeActiveSheet.right = new FormAttachment(100, 0);
    wMakeActiveSheet.setLayoutData(fdMakeActiveSheet);
    wMakeActiveSheet.addSelectionListener(lsSel);
    // If output sheet exists line
    wlIfSheetExists = new Label(sheetGroup, SWT.RIGHT);
    wlIfSheetExists.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.Label"));
    props.setLook(wlIfSheetExists);
    FormData fdlIfSheetExists = new FormData();
    fdlIfSheetExists.left = new FormAttachment(0, 0);
    fdlIfSheetExists.top = new FormAttachment(wMakeActiveSheet, margin);
    fdlIfSheetExists.right = new FormAttachment(middle, -margin);
    wlIfSheetExists.setLayoutData(fdlIfSheetExists);
    wIfSheetExists = new CCombo(sheetGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
    String replaceSheetNewLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.CreateNew.Label");
    String reuseSheetLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.Reuse.Label");
    wIfSheetExists.setItems(new String[] { replaceSheetNewLabel, reuseSheetLabel });
    wIfSheetExists.setData(replaceSheetNewLabel, ExcelWriterStepMeta.IF_SHEET_EXISTS_CREATE_NEW);
    wIfSheetExists.setData(reuseSheetLabel, ExcelWriterStepMeta.IF_SHEET_EXISTS_REUSE);
    props.setLook(wIfSheetExists);
    wIfSheetExists.addModifyListener(lsMod);
    wIfSheetExists.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.IfSheetExists.Tooltip"));
    FormData fdIfSheetExists = new FormData();
    fdIfSheetExists.left = new FormAttachment(middle, 0);
    fdIfSheetExists.top = new FormAttachment(wMakeActiveSheet, margin);
    fdIfSheetExists.right = new FormAttachment(100, 0);
    wIfSheetExists.setLayoutData(fdIfSheetExists);
    // Protect Sheet?
    wlProtectSheet = new Label(sheetGroup, SWT.RIGHT);
    wlProtectSheet.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectSheet.Label"));
    props.setLook(wlProtectSheet);
    fdlProtectSheet = new FormData();
    fdlProtectSheet.left = new FormAttachment(0, 0);
    fdlProtectSheet.top = new FormAttachment(wIfSheetExists, margin);
    fdlProtectSheet.right = new FormAttachment(middle, -margin);
    wlProtectSheet.setLayoutData(fdlProtectSheet);
    wProtectSheet = new Button(sheetGroup, SWT.CHECK);
    wProtectSheet.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectSheet.Tooltip"));
    props.setLook(wProtectSheet);
    fdProtectSheet = new FormData();
    fdProtectSheet.left = new FormAttachment(middle, 0);
    fdProtectSheet.top = new FormAttachment(wIfSheetExists, margin);
    fdProtectSheet.right = new FormAttachment(100, 0);
    wProtectSheet.setLayoutData(fdProtectSheet);
    wProtectSheet.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            enablePassword();
        }
    });
    // Protected by line
    Label wlProtectedBy = new Label(sheetGroup, SWT.RIGHT);
    wlProtectedBy.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectedBy.Label"));
    props.setLook(wlProtectedBy);
    FormData fdlProtectedBy = new FormData();
    fdlProtectedBy.left = new FormAttachment(0, 0);
    fdlProtectedBy.top = new FormAttachment(wProtectSheet, margin);
    fdlProtectedBy.right = new FormAttachment(middle, -margin);
    wlProtectedBy.setLayoutData(fdlProtectedBy);
    wProtectedBy = new TextVar(transMeta, sheetGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wProtectedBy.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectedBy.Tooltip"));
    props.setLook(wProtectedBy);
    wProtectedBy.addModifyListener(lsMod);
    FormData fdProtectedBy = new FormData();
    fdProtectedBy.left = new FormAttachment(middle, 0);
    fdProtectedBy.top = new FormAttachment(wProtectSheet, margin);
    fdProtectedBy.right = new FormAttachment(100, 0);
    wProtectedBy.setLayoutData(fdProtectedBy);
    // Password line
    wlPassword = new Label(sheetGroup, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Password.Label"));
    props.setLook(wlPassword);
    fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wProtectedBy, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(transMeta, sheetGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wPassword.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Password.Tooltip"));
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wProtectedBy, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    FormData fsSheetGroup = new FormData();
    fsSheetGroup.left = new FormAttachment(0, margin);
    fsSheetGroup.top = new FormAttachment(fileGroup, margin);
    fsSheetGroup.right = new FormAttachment(100, -margin);
    sheetGroup.setLayoutData(fsSheetGroup);
    // END OF SHEET GROUP
    // ///////////////////////////////
    // START OF Template Group GROUP //
    // ///////////////////////////////
    wTemplateGroup = new Group(wFileComp, SWT.SHADOW_NONE);
    props.setLook(wTemplateGroup);
    wTemplateGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateGroup.Label"));
    FormLayout TemplateGroupgroupLayout = new FormLayout();
    TemplateGroupgroupLayout.marginWidth = 10;
    TemplateGroupgroupLayout.marginHeight = 10;
    wTemplateGroup.setLayout(TemplateGroupgroupLayout);
    // Use template
    wlTemplate = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplate.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Template.Label"));
    props.setLook(wlTemplate);
    fdlTemplate = new FormData();
    fdlTemplate.left = new FormAttachment(0, 0);
    fdlTemplate.top = new FormAttachment(0, margin);
    fdlTemplate.right = new FormAttachment(middle, -margin);
    wlTemplate.setLayoutData(fdlTemplate);
    wTemplate = new Button(wTemplateGroup, SWT.CHECK);
    props.setLook(wTemplate);
    fdTemplate = new FormData();
    fdTemplate.left = new FormAttachment(middle, 0);
    fdTemplate.top = new FormAttachment(0, margin);
    fdTemplate.right = new FormAttachment(100, 0);
    wTemplate.setLayoutData(fdTemplate);
    wTemplate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            enableTemplate();
        }
    });
    wTemplate.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Template.Tooltip"));
    // TemplateFilename line
    wlTemplateFilename = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateFilename.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateFilename.Label"));
    props.setLook(wlTemplateFilename);
    fdlTemplateFilename = new FormData();
    fdlTemplateFilename.left = new FormAttachment(0, 0);
    fdlTemplateFilename.top = new FormAttachment(wTemplate, margin);
    fdlTemplateFilename.right = new FormAttachment(middle, -margin);
    wlTemplateFilename.setLayoutData(fdlTemplateFilename);
    wbTemplateFilename = new Button(wTemplateGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTemplateFilename);
    wbTemplateFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    fdbTemplateFilename = new FormData();
    fdbTemplateFilename.right = new FormAttachment(100, 0);
    fdbTemplateFilename.top = new FormAttachment(wTemplate, 0);
    wbTemplateFilename.setLayoutData(fdbTemplateFilename);
    wTemplateFilename = new TextVar(transMeta, wTemplateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTemplateFilename);
    wTemplateFilename.addModifyListener(lsMod);
    fdTemplateFilename = new FormData();
    fdTemplateFilename.left = new FormAttachment(middle, 0);
    fdTemplateFilename.top = new FormAttachment(wTemplate, margin);
    fdTemplateFilename.right = new FormAttachment(wbTemplateFilename, -margin);
    wTemplateFilename.setLayoutData(fdTemplateFilename);
    // Use template sheet
    wlTemplateSheet = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateSheet.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheet.Label"));
    props.setLook(wlTemplateSheet);
    FormData fdlTemplateSheet = new FormData();
    fdlTemplateSheet.left = new FormAttachment(0, 0);
    fdlTemplateSheet.top = new FormAttachment(wTemplateFilename, margin);
    fdlTemplateSheet.right = new FormAttachment(middle, -margin);
    wlTemplateSheet.setLayoutData(fdlTemplateSheet);
    wTemplateSheet = new Button(wTemplateGroup, SWT.CHECK);
    wTemplateSheet.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheet.Tooltip"));
    props.setLook(wTemplateSheet);
    FormData fdTemplateSheet = new FormData();
    fdTemplateSheet.left = new FormAttachment(middle, 0);
    fdTemplateSheet.top = new FormAttachment(wTemplateFilename, margin);
    fdTemplateSheet.right = new FormAttachment(100, 0);
    wTemplateSheet.setLayoutData(fdTemplateSheet);
    wTemplateSheet.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            enableTemplateSheet();
        }
    });
    // TemplateSheetname line
    wlTemplateSheetname = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateSheetname.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheetname.Label"));
    props.setLook(wlTemplateSheetname);
    FormData fdlTemplateSheetname = new FormData();
    fdlTemplateSheetname.left = new FormAttachment(0, 0);
    fdlTemplateSheetname.top = new FormAttachment(wTemplateSheet, margin);
    fdlTemplateSheetname.right = new FormAttachment(middle, -margin);
    wlTemplateSheetname.setLayoutData(fdlTemplateSheetname);
    wTemplateSheetname = new TextVar(transMeta, wTemplateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTemplateSheetname);
    wTemplateSheetname.addModifyListener(lsMod);
    FormData fdTemplateSheetname = new FormData();
    fdTemplateSheetname.left = new FormAttachment(middle, 0);
    fdTemplateSheetname.top = new FormAttachment(wTemplateSheet, margin);
    fdTemplateSheetname.right = new FormAttachment(wbTemplateFilename, -margin);
    wTemplateSheetname.setLayoutData(fdTemplateSheetname);
    // Hide Template Sheet
    wlTemplateSheetHide = new Label(wTemplateGroup, SWT.RIGHT);
    wlTemplateSheetHide.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheetHide.Label"));
    props.setLook(wlTemplateSheetHide);
    FormData fdlTemplateSheetHide = new FormData();
    fdlTemplateSheetHide.left = new FormAttachment(0, 0);
    fdlTemplateSheetHide.top = new FormAttachment(wTemplateSheetname, margin);
    fdlTemplateSheetHide.right = new FormAttachment(middle, -margin);
    wlTemplateSheetHide.setLayoutData(fdlTemplateSheetHide);
    wTemplateSheetHide = new Button(wTemplateGroup, SWT.CHECK);
    wTemplateSheetHide.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.TemplateSheetHide.Tooltip"));
    props.setLook(wTemplateSheetHide);
    FormData fdTemplateSheetHide = new FormData();
    fdTemplateSheetHide.left = new FormAttachment(middle, 0);
    fdTemplateSheetHide.top = new FormAttachment(wTemplateSheetname, margin);
    fdTemplateSheetHide.right = new FormAttachment(100, 0);
    wTemplateSheetHide.setLayoutData(fdTemplateSheetHide);
    wTemplateSheetHide.addSelectionListener(lsSel);
    fdTemplateGroup = new FormData();
    fdTemplateGroup.left = new FormAttachment(0, margin);
    fdTemplateGroup.top = new FormAttachment(sheetGroup, margin);
    fdTemplateGroup.right = new FormAttachment(100, -margin);
    wTemplateGroup.setLayoutData(fdTemplateGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Write to existing Group GROUP
    // ///////////////////////////////////////////////////////////
    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 CONTENT TAB///
    // /
    wContentTab = new CTabItem(wTabFolder, SWT.NONE);
    wContentTab.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ContentTab.TabTitle"));
    FormLayout contentLayout = new FormLayout();
    contentLayout.marginWidth = 3;
    contentLayout.marginHeight = 3;
    Composite wContentComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wContentComp);
    wContentComp.setLayout(contentLayout);
    Group wContentGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(wContentGroup);
    wContentGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ContentGroup.Label"));
    FormLayout ContentGroupgroupLayout = new FormLayout();
    ContentGroupgroupLayout.marginWidth = 10;
    ContentGroupgroupLayout.marginHeight = 10;
    wContentGroup.setLayout(ContentGroupgroupLayout);
    // starting cell
    wlStartingCell = new Label(wContentGroup, SWT.RIGHT);
    wlStartingCell.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.StartingCell.Label"));
    props.setLook(wlStartingCell);
    FormData fdlStartingCell = new FormData();
    fdlStartingCell.left = new FormAttachment(0, 0);
    fdlStartingCell.top = new FormAttachment(wIfSheetExists, margin);
    fdlStartingCell.right = new FormAttachment(middle, -margin);
    wlStartingCell.setLayoutData(fdlStartingCell);
    wStartingCell = new TextVar(transMeta, wContentGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStartingCell.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.StartingCell.Tooltip"));
    props.setLook(wStartingCell);
    wStartingCell.addModifyListener(lsMod);
    FormData fdStartingCell = new FormData();
    fdStartingCell.left = new FormAttachment(middle, 0);
    fdStartingCell.top = new FormAttachment(wIfSheetExists, margin);
    fdStartingCell.right = new FormAttachment(100, 0);
    wStartingCell.setLayoutData(fdStartingCell);
    // row writing method line
    wlRowWritingMethod = new Label(wContentGroup, SWT.RIGHT);
    wlRowWritingMethod.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.Label"));
    props.setLook(wlRowWritingMethod);
    FormData fdlRowWritingMethod = new FormData();
    fdlRowWritingMethod.left = new FormAttachment(0, 0);
    fdlRowWritingMethod.top = new FormAttachment(wStartingCell, margin);
    fdlRowWritingMethod.right = new FormAttachment(middle, -margin);
    wlRowWritingMethod.setLayoutData(fdlRowWritingMethod);
    wRowWritingMethod = new CCombo(wContentGroup, SWT.LEFT | SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
    String overwriteLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.Overwrite.Label");
    String pushDownLabel = BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.PushDown.Label");
    wRowWritingMethod.setItems(new String[] { overwriteLabel, pushDownLabel });
    wRowWritingMethod.setData(overwriteLabel, ExcelWriterStepMeta.ROW_WRITE_OVERWRITE);
    wRowWritingMethod.setData(pushDownLabel, ExcelWriterStepMeta.ROW_WRITE_PUSH_DOWN);
    wRowWritingMethod.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.RowWritingMethod.Tooltip"));
    props.setLook(wRowWritingMethod);
    wRowWritingMethod.addModifyListener(lsMod);
    // wRowWritingMethod.addSelectionListener(new SelectionAdapter() {
    // public void widgetSelected(SelectionEvent e) {
    // input.setChanged();
    // EnableRowWritingMethod();
    // }
    // });
    FormData fdRowWritingMethod = new FormData();
    fdRowWritingMethod.left = new FormAttachment(middle, 0);
    fdRowWritingMethod.top = new FormAttachment(wStartingCell, margin);
    fdRowWritingMethod.right = new FormAttachment(100, 0);
    wRowWritingMethod.setLayoutData(fdRowWritingMethod);
    wlHeader = new Label(wContentGroup, SWT.RIGHT);
    wlHeader.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Header.Label"));
    props.setLook(wlHeader);
    fdlHeader = new FormData();
    fdlHeader.left = new FormAttachment(0, 0);
    fdlHeader.top = new FormAttachment(wRowWritingMethod, margin);
    fdlHeader.right = new FormAttachment(middle, -margin);
    wlHeader.setLayoutData(fdlHeader);
    wHeader = new Button(wContentGroup, SWT.CHECK);
    props.setLook(wHeader);
    fdHeader = new FormData();
    fdHeader.left = new FormAttachment(middle, 0);
    fdHeader.top = new FormAttachment(wRowWritingMethod, margin);
    fdHeader.right = new FormAttachment(100, 0);
    wHeader.setLayoutData(fdHeader);
    wHeader.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Header.Tooltip"));
    wHeader.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            enableHeader();
        }
    });
    wlFooter = new Label(wContentGroup, SWT.RIGHT);
    wlFooter.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.Footer.Label"));
    props.setLook(wlFooter);
    fdlFooter = new FormData();
    fdlFooter.left = new FormAttachment(0, 0);
    fdlFooter.top = new FormAttachment(wHeader, margin);
    fdlFooter.right = new FormAttachment(middle, -margin);
    wlFooter.setLayoutData(fdlFooter);
    wFooter = new Button(wContentGroup, SWT.CHECK);
    props.setLook(wFooter);
    fdFooter = new FormData();
    fdFooter.left = new FormAttachment(middle, 0);
    fdFooter.top = new FormAttachment(wHeader, margin);
    fdFooter.right = new FormAttachment(100, 0);
    wFooter.setLayoutData(fdFooter);
    wFooter.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Footer.Tooltip"));
    wFooter.addSelectionListener(lsSel);
    // auto size columns?
    wlAutoSize = new Label(wContentGroup, SWT.RIGHT);
    wlAutoSize.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AutoSize.Label"));
    props.setLook(wlAutoSize);
    fdlAutoSize = new FormData();
    fdlAutoSize.left = new FormAttachment(0, 0);
    fdlAutoSize.top = new FormAttachment(wFooter, margin);
    fdlAutoSize.right = new FormAttachment(middle, -margin);
    wlAutoSize.setLayoutData(fdlAutoSize);
    wAutoSize = new Button(wContentGroup, SWT.CHECK);
    props.setLook(wAutoSize);
    wAutoSize.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.AutoSize.Tooltip"));
    fdAutoSize = new FormData();
    fdAutoSize.left = new FormAttachment(middle, 0);
    fdAutoSize.top = new FormAttachment(wFooter, margin);
    fdAutoSize.right = new FormAttachment(100, 0);
    wAutoSize.setLayoutData(fdAutoSize);
    wAutoSize.addSelectionListener(lsSel);
    // force formula recalculation?
    wlForceFormulaRecalculation = new Label(wContentGroup, SWT.RIGHT);
    wlForceFormulaRecalculation.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.ForceFormulaRecalculation.Label"));
    props.setLook(wlForceFormulaRecalculation);
    fdlForceFormulaRecalculation = new FormData();
    fdlForceFormulaRecalculation.left = new FormAttachment(0, 0);
    fdlForceFormulaRecalculation.top = new FormAttachment(wAutoSize, margin);
    fdlForceFormulaRecalculation.right = new FormAttachment(middle, -margin);
    wlForceFormulaRecalculation.setLayoutData(fdlForceFormulaRecalculation);
    wForceFormulaRecalculation = new Button(wContentGroup, SWT.CHECK);
    props.setLook(wForceFormulaRecalculation);
    wForceFormulaRecalculation.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.ForceFormulaRecalculation.Tooltip"));
    fdForceFormulaRecalculation = new FormData();
    fdForceFormulaRecalculation.left = new FormAttachment(middle, 0);
    fdForceFormulaRecalculation.top = new FormAttachment(wAutoSize, margin);
    fdForceFormulaRecalculation.right = new FormAttachment(100, 0);
    wForceFormulaRecalculation.setLayoutData(fdForceFormulaRecalculation);
    wForceFormulaRecalculation.addSelectionListener(lsSel);
    // leave existing styles alone?
    wlLeaveExistingStylesUnchanged = new Label(wContentGroup, SWT.RIGHT);
    wlLeaveExistingStylesUnchanged.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.LeaveExistingStylesUnchanged.Label"));
    props.setLook(wlLeaveExistingStylesUnchanged);
    fdlLeaveExistingStylesUnchanged = new FormData();
    fdlLeaveExistingStylesUnchanged.left = new FormAttachment(0, 0);
    fdlLeaveExistingStylesUnchanged.top = new FormAttachment(wForceFormulaRecalculation, margin);
    fdlLeaveExistingStylesUnchanged.right = new FormAttachment(middle, -margin);
    wlLeaveExistingStylesUnchanged.setLayoutData(fdlLeaveExistingStylesUnchanged);
    wLeaveExistingStylesUnchanged = new Button(wContentGroup, SWT.CHECK);
    props.setLook(wLeaveExistingStylesUnchanged);
    wLeaveExistingStylesUnchanged.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.LeaveExistingStylesUnchanged.Tooltip"));
    fdLeaveExistingStylesUnchanged = new FormData();
    fdLeaveExistingStylesUnchanged.left = new FormAttachment(middle, 0);
    fdLeaveExistingStylesUnchanged.top = new FormAttachment(wForceFormulaRecalculation, margin);
    fdLeaveExistingStylesUnchanged.right = new FormAttachment(100, 0);
    wLeaveExistingStylesUnchanged.setLayoutData(fdLeaveExistingStylesUnchanged);
    wLeaveExistingStylesUnchanged.addSelectionListener(lsSel);
    FormData fdContentGroup = new FormData();
    fdContentGroup.left = new FormAttachment(0, margin);
    fdContentGroup.top = new FormAttachment(0, margin);
    fdContentGroup.right = new FormAttachment(100, -margin);
    wContentGroup.setLayoutData(fdContentGroup);
    // / END OF CONTENT GROUP
    Group writeToExistingGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(writeToExistingGroup);
    writeToExistingGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.writeToExistingGroup.Label"));
    FormLayout writeToExistingGroupgroupLayout = new FormLayout();
    writeToExistingGroupgroupLayout.marginWidth = 10;
    writeToExistingGroupgroupLayout.marginHeight = 10;
    writeToExistingGroup.setLayout(writeToExistingGroupgroupLayout);
    // Use AppendLines
    Label wlAppendLines = new Label(writeToExistingGroup, SWT.RIGHT);
    wlAppendLines.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.AppendLines.Label"));
    props.setLook(wlAppendLines);
    FormData fdlAppendLines = new FormData();
    fdlAppendLines.left = new FormAttachment(0, 0);
    fdlAppendLines.top = new FormAttachment(0, margin);
    fdlAppendLines.right = new FormAttachment(middle, -margin);
    wlAppendLines.setLayoutData(fdlAppendLines);
    wAppendLines = new Button(writeToExistingGroup, SWT.CHECK);
    wAppendLines.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.AppendLines.Tooltip"));
    props.setLook(wAppendLines);
    FormData fdAppendLines = new FormData();
    fdAppendLines.left = new FormAttachment(middle, 0);
    fdAppendLines.top = new FormAttachment(0, margin);
    fdAppendLines.right = new FormAttachment(100, 0);
    wAppendLines.setLayoutData(fdAppendLines);
    // wAppendLines.addSelectionListener(lsMod);
    wAppendLines.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            input.setChanged();
            enableAppend();
        }
    });
    // SkipRows line
    Label wlSkipRows = new Label(writeToExistingGroup, SWT.RIGHT);
    wlSkipRows.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.SkipRows.Label"));
    props.setLook(wlSkipRows);
    FormData fdlSkipRows = new FormData();
    fdlSkipRows.left = new FormAttachment(0, 0);
    fdlSkipRows.top = new FormAttachment(wAppendLines, margin);
    fdlSkipRows.right = new FormAttachment(middle, -margin);
    wlSkipRows.setLayoutData(fdlSkipRows);
    wSkipRows = new Text(writeToExistingGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wSkipRows.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.SkipRows.Tooltip"));
    props.setLook(wSkipRows);
    wSkipRows.addModifyListener(lsMod);
    FormData fdSkipRows = new FormData();
    fdSkipRows.left = new FormAttachment(middle, 0);
    fdSkipRows.top = new FormAttachment(wAppendLines, margin);
    fdSkipRows.right = new FormAttachment(100, 0);
    wSkipRows.setLayoutData(fdSkipRows);
    // EmptyRows line
    Label wlEmptyRows = new Label(writeToExistingGroup, SWT.RIGHT);
    wlEmptyRows.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.EmptyRows.Label"));
    props.setLook(wlEmptyRows);
    FormData fdlEmptyRows = new FormData();
    fdlEmptyRows.left = new FormAttachment(0, 0);
    fdlEmptyRows.top = new FormAttachment(wSkipRows, margin);
    fdlEmptyRows.right = new FormAttachment(middle, -margin);
    wlEmptyRows.setLayoutData(fdlEmptyRows);
    wEmptyRows = new Text(writeToExistingGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wEmptyRows.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.EmptyRows.Tooltip"));
    props.setLook(wEmptyRows);
    wEmptyRows.addModifyListener(lsMod);
    FormData fdEmptyRows = new FormData();
    fdEmptyRows.left = new FormAttachment(middle, 0);
    fdEmptyRows.top = new FormAttachment(wSkipRows, margin);
    fdEmptyRows.right = new FormAttachment(100, 0);
    wEmptyRows.setLayoutData(fdEmptyRows);
    // Use AppendLines
    Label wlOmitHeader = new Label(writeToExistingGroup, SWT.RIGHT);
    wlOmitHeader.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.OmitHeader.Label"));
    props.setLook(wlOmitHeader);
    FormData fdlOmitHeader = new FormData();
    fdlOmitHeader.left = new FormAttachment(0, 0);
    fdlOmitHeader.top = new FormAttachment(wEmptyRows, margin);
    fdlOmitHeader.right = new FormAttachment(middle, -margin);
    wlOmitHeader.setLayoutData(fdlOmitHeader);
    wOmitHeader = new Button(writeToExistingGroup, SWT.CHECK);
    wOmitHeader.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.OmitHeader.Tooltip"));
    props.setLook(wOmitHeader);
    FormData fdOmitHeader = new FormData();
    fdOmitHeader.left = new FormAttachment(middle, 0);
    fdOmitHeader.top = new FormAttachment(wEmptyRows, margin);
    fdOmitHeader.right = new FormAttachment(100, 0);
    wOmitHeader.setLayoutData(fdOmitHeader);
    wOmitHeader.addSelectionListener(lsSel);
    FormData fdWriteToExistingGroup = new FormData();
    fdWriteToExistingGroup.left = new FormAttachment(0, margin);
    fdWriteToExistingGroup.top = new FormAttachment(wContentGroup, margin);
    fdWriteToExistingGroup.right = new FormAttachment(100, -margin);
    writeToExistingGroup.setLayoutData(fdWriteToExistingGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF Write to existing Group GROUP
    // ///////////////////////////////////////////////////////////
    Group fieldGroup = new Group(wContentComp, SWT.SHADOW_NONE);
    props.setLook(fieldGroup);
    fieldGroup.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.fieldGroup.Label"));
    FormLayout fieldGroupgroupLayout = new FormLayout();
    fieldGroupgroupLayout.marginWidth = 10;
    fieldGroupgroupLayout.marginHeight = 10;
    fieldGroup.setLayout(fieldGroupgroupLayout);
    wGet = new Button(fieldGroup, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "System.Button.GetFields"));
    wGet.setToolTipText(BaseMessages.getString(PKG, "System.Tooltip.GetFields"));
    wMinWidth = new Button(fieldGroup, SWT.PUSH);
    wMinWidth.setText(BaseMessages.getString(PKG, "ExcelWriterDialog.MinWidth.Button"));
    wMinWidth.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.MinWidth.Tooltip"));
    setButtonPositions(new Button[] { wGet, wMinWidth }, margin, null);
    final int FieldsRows = input.getOutputFields().length;
    // Prepare a list of possible formats, filtering reserved internal formats away
    String[] formats = BuiltinFormats.getAll();
    List<String> allFormats = Arrays.asList(BuiltinFormats.getAll());
    List<String> nonReservedFormats = new ArrayList<String>(allFormats.size());
    for (String format : allFormats) {
        if (!format.startsWith("reserved")) {
            nonReservedFormats.add(format);
        }
    }
    Collections.sort(nonReservedFormats);
    formats = nonReservedFormats.toArray(new String[0]);
    colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.NameColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.TypeColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames()), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.FormatColumn.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, formats), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.UseStyleCell.Column"), ColumnInfo.COLUMN_TYPE_TEXT), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.TitleColumn.Column"), ColumnInfo.COLUMN_TYPE_TEXT), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.UseTitleStyleCell.Column"), ColumnInfo.COLUMN_TYPE_TEXT), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.FormulaField.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "N", "Y" }, true), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.HyperLinkField.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.CommentField.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "ExcelWriterDialog.CommentAuthor.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false) };
    wFields = new TableView(transMeta, fieldGroup, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    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(wGet, -margin);
    wFields.setLayoutData(fdFields);
    wFields.addModifyListener(lsMod);
    // Search the fields in the background
    final Runnable runnable = new Runnable() {

        @Override
        public void run() {
            StepMeta stepMeta = transMeta.findStep(stepname);
            if (stepMeta != null) {
                try {
                    RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);
                    // Remember these fields...
                    for (int i = 0; i < row.size(); i++) {
                        inputFields.put(row.getValueMeta(i).getName(), Integer.valueOf(i));
                    }
                    setComboBoxes();
                } catch (KettleException e) {
                    logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
                }
            }
        }
    };
    new Thread(runnable).start();
    FormData fdFieldGroup = new FormData();
    fdFieldGroup.left = new FormAttachment(0, margin);
    fdFieldGroup.top = new FormAttachment(writeToExistingGroup, margin);
    fdFieldGroup.bottom = new FormAttachment(100, 0);
    fdFieldGroup.right = new FormAttachment(100, -margin);
    fieldGroup.setLayoutData(fdFieldGroup);
    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);
    fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(0, 0);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(100, 0);
    wTabFolder.setLayoutData(fdTabFolder);
    FormData fdSc = new FormData();
    fdSc.left = new FormAttachment(0, 0);
    fdSc.top = new FormAttachment(wStepname, margin);
    fdSc.right = new FormAttachment(100, 0);
    fdSc.bottom = new FormAttachment(100, -50);
    sc.setLayoutData(fdSc);
    sc.setContent(wTabFolder);
    // ///////////////////////////////////////////////////////////
    // / END OF CONTENT TAB
    // ///////////////////////////////////////////////////////////
    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"));
    setButtonPositions(new Button[] { wOK, wCancel }, margin, sc);
    // Add listeners
    lsOK = new Listener() {

        @Override
        public void handleEvent(Event e) {
            ok();
        }
    };
    lsGet = new Listener() {

        @Override
        public void handleEvent(Event e) {
            get();
        }
    };
    lsMinWidth = new Listener() {

        @Override
        public void handleEvent(Event e) {
            setMinimalWidth();
        }
    };
    lsCancel = new Listener() {

        @Override
        public void handleEvent(Event e) {
            cancel();
        }
    };
    wOK.addListener(SWT.Selection, lsOK);
    wGet.addListener(SWT.Selection, lsGet);
    wMinWidth.addListener(SWT.Selection, lsMinWidth);
    wCancel.addListener(SWT.Selection, lsCancel);
    lsDef = new SelectionAdapter() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            ok();
        }
    };
    wStepname.addSelectionListener(lsDef);
    wFilename.addSelectionListener(lsDef);
    wTemplateFilename.addSelectionListener(lsDef);
    // Whenever something changes, set the tooltip to the expanded version:
    wFilename.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wFilename.setToolTipText(transMeta.environmentSubstitute(wFilename.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.Filename.Tooltip"));
        }
    });
    wTemplateFilename.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wTemplateFilename.setToolTipText(transMeta.environmentSubstitute(wTemplateFilename.getText()));
        }
    });
    wSheetname.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wSheetname.setToolTipText(transMeta.environmentSubstitute(wSheetname.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.Sheetname.Tooltip"));
        }
    });
    wTemplateSheetname.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wTemplateSheetname.setToolTipText(transMeta.environmentSubstitute(wTemplateSheetname.getText()));
        }
    });
    wStartingCell.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wStartingCell.setToolTipText(transMeta.environmentSubstitute(wStartingCell.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.StartingCell.Tooltip"));
        }
    });
    wPassword.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wPassword.setToolTipText(BaseMessages.getString(PKG, "ExcelWriterDialog.Password.Tooltip"));
        }
    });
    wProtectedBy.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            wProtectedBy.setToolTipText(transMeta.environmentSubstitute(wProtectedBy.getText()) + "\n\n" + BaseMessages.getString(PKG, "ExcelWriterDialog.ProtectedBy.Tooltip"));
        }
    });
    wbFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.SAVE);
            dialog.setFilterExtensions(new String[] { "*.xls", "*.xlsx", "*.*" });
            if (wFilename.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wFilename.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLS.Label"), BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLSX.Label"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    wbTemplateFilename.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(shell, SWT.OPEN);
            dialog.setFilterExtensions(new String[] { "*.xls", "*.xlsx", "*.*" });
            if (wTemplateFilename.getText() != null) {
                dialog.setFileName(transMeta.environmentSubstitute(wTemplateFilename.getText()));
            }
            dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLS.Label"), BaseMessages.getString(PKG, "ExcelWriterDialog.FormatXLSX.Label"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
            if (dialog.open() != null) {
                wTemplateFilename.setText(dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName());
            }
        }
    });
    // Detect X or ALT-F4 or something that kills this window...
    shell.addShellListener(new ShellAdapter() {

        @Override
        public void shellClosed(ShellEvent e) {
            cancel();
        }
    });
    wTabFolder.setSelection(0);
    getData();
    setDateTimeFormat();
    enableExtension();
    enableAppend();
    enableHeader();
    enableTemplateSheet();
    input.setChanged(changed);
    // artificially reduce table size
    for (int t = 0; t < wFields.table.getColumnCount(); t++) {
        wFields.table.getColumn(t).setWidth(20);
    }
    wFields.layout();
    wFields.pack();
    // determine scrollable area
    sc.setMinSize(wTabFolder.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    // set window size
    setSize(shell, 600, 600, true);
    // restore optimal column widths
    wFields.optWidth(true);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    return stepname;
}
Also used : Group(org.eclipse.swt.widgets.Group) KettleException(org.pentaho.di.core.exception.KettleException) CTabFolder(org.eclipse.swt.custom.CTabFolder) TableItemInsertListener(org.pentaho.di.ui.trans.step.TableItemInsertListener) Listener(org.eclipse.swt.widgets.Listener) ModifyListener(org.eclipse.swt.events.ModifyListener) ModifyListener(org.eclipse.swt.events.ModifyListener) Label(org.eclipse.swt.widgets.Label) ArrayList(java.util.ArrayList) ColumnInfo(org.pentaho.di.ui.core.widget.ColumnInfo) ShellEvent(org.eclipse.swt.events.ShellEvent) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) CTabItem(org.eclipse.swt.custom.CTabItem) Shell(org.eclipse.swt.widgets.Shell) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) FormAttachment(org.eclipse.swt.layout.FormAttachment) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) TableView(org.pentaho.di.ui.core.widget.TableView) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) ShellAdapter(org.eclipse.swt.events.ShellAdapter) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) StepMeta(org.pentaho.di.trans.step.StepMeta) BaseStepMeta(org.pentaho.di.trans.step.BaseStepMeta) ExcelWriterStepMeta(org.pentaho.di.trans.steps.excelwriter.ExcelWriterStepMeta) TextVar(org.pentaho.di.ui.core.widget.TextVar) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) MessageBox(org.eclipse.swt.widgets.MessageBox) PasswordTextVar(org.pentaho.di.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) ExcelWriterStepMeta(org.pentaho.di.trans.steps.excelwriter.ExcelWriterStepMeta) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Event(org.eclipse.swt.widgets.Event) ShellEvent(org.eclipse.swt.events.ShellEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FileDialog(org.eclipse.swt.widgets.FileDialog) Display(org.eclipse.swt.widgets.Display)

Example 65 with EnterSelectionDialog

use of org.pentaho.di.ui.core.dialog.EnterSelectionDialog in project pentaho-kettle by pentaho.

the class TextFileInputDialog method showFiles.

private void showFiles() {
    TextFileInputMeta tfii = new TextFileInputMeta();
    getInfo(tfii, true);
    String[] files = FileInputList.createFilePathList(transMeta, tfii.inputFiles.fileName, tfii.inputFiles.fileMask, tfii.inputFiles.excludeFileMask, tfii.inputFiles.fileRequired, tfii.inputFiles.includeSubFolderBoolean());
    if (files != null && files.length > 0) {
        EnterSelectionDialog esd = new EnterSelectionDialog(shell, files, "Files read", "Files read:");
        esd.setViewOnly();
        esd.open();
    } else {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
        mb.setMessage(BaseMessages.getString(PKG, "TextFileInputDialog.NoFilesFound.DialogMessage"));
        mb.setText(BaseMessages.getString(PKG, "System.Dialog.Error.Title"));
        mb.open();
    }
}
Also used : TextFileInputMeta(org.pentaho.di.trans.steps.fileinput.text.TextFileInputMeta) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) EnterSelectionDialog(org.pentaho.di.ui.core.dialog.EnterSelectionDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

EnterSelectionDialog (org.pentaho.di.ui.core.dialog.EnterSelectionDialog)75 MessageBox (org.eclipse.swt.widgets.MessageBox)42 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)42 KettleException (org.pentaho.di.core.exception.KettleException)41 SelectionEvent (org.eclipse.swt.events.SelectionEvent)30 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)29 ModifyEvent (org.eclipse.swt.events.ModifyEvent)28 ModifyListener (org.eclipse.swt.events.ModifyListener)28 ShellEvent (org.eclipse.swt.events.ShellEvent)28 FormAttachment (org.eclipse.swt.layout.FormAttachment)28 FormData (org.eclipse.swt.layout.FormData)28 FormLayout (org.eclipse.swt.layout.FormLayout)28 Event (org.eclipse.swt.widgets.Event)28 Listener (org.eclipse.swt.widgets.Listener)28 Shell (org.eclipse.swt.widgets.Shell)28 ShellAdapter (org.eclipse.swt.events.ShellAdapter)27 Button (org.eclipse.swt.widgets.Button)27 Display (org.eclipse.swt.widgets.Display)27 Label (org.eclipse.swt.widgets.Label)27 Text (org.eclipse.swt.widgets.Text)27