Search in sources :

Example 1 with PasswordTextVar

use of org.apache.hop.ui.core.widget.PasswordTextVar in project hop by apache.

the class ActionSftpPutDialog method open.

@Override
public IAction open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
    props.setLook(shell);
    WorkflowDialog.setShellImage(shell, action);
    ModifyListener lsMod = e -> {
        sftpclient = null;
        action.setChanged();
    };
    changed = action.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "ActionSftpPut.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Filename line
    Label wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "ActionSftpPut.Name.Label"));
    props.setLook(wlName);
    FormData fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    FormData fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    // The buttons at the bottom
    // 
    Button wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    Button wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
    // The tab folder between the name and the buttons
    // 
    CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "ActionSftpPut.Tab.General.Label"));
    Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    Group wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "ActionSftpPut.ServerSettings.Group.Label"));
    FormLayout serverSettingsgroupLayout = new FormLayout();
    serverSettingsgroupLayout.marginWidth = 10;
    serverSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(serverSettingsgroupLayout);
    // ServerName line
    Label wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "ActionSftpPut.Server.Label"));
    props.setLook(wlServerName);
    FormData fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(wName, margin);
    fdlServerName.right = new FormAttachment(middle, -margin);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    FormData fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, 0);
    fdServerName.top = new FormAttachment(wName, margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // ServerPort line
    Label wlServerPort = new Label(wServerSettings, SWT.RIGHT);
    wlServerPort.setText(BaseMessages.getString(PKG, "ActionSftpPut.Port.Label"));
    props.setLook(wlServerPort);
    FormData fdlServerPort = new FormData();
    fdlServerPort.left = new FormAttachment(0, 0);
    fdlServerPort.top = new FormAttachment(wServerName, margin);
    fdlServerPort.right = new FormAttachment(middle, -margin);
    wlServerPort.setLayoutData(fdlServerPort);
    wServerPort = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerPort);
    wServerPort.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.Port.Tooltip"));
    wServerPort.addModifyListener(lsMod);
    FormData fdServerPort = new FormData();
    fdServerPort.left = new FormAttachment(middle, 0);
    fdServerPort.top = new FormAttachment(wServerName, margin);
    fdServerPort.right = new FormAttachment(100, 0);
    wServerPort.setLayoutData(fdServerPort);
    // UserName line
    Label wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "ActionSftpPut.Username.Label"));
    props.setLook(wlUserName);
    FormData fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wServerPort, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.Username.Tooltip"));
    wUserName.addModifyListener(lsMod);
    FormData fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wServerPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    Label wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "ActionSftpPut.Password.Label"));
    props.setLook(wlPassword);
    FormData fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wUserName, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    FormData fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // usePublicKey
    Label wlUsePublicKey = new Label(wServerSettings, SWT.RIGHT);
    wlUsePublicKey.setText(BaseMessages.getString(PKG, "ActionSftpPut.useKeyFile.Label"));
    props.setLook(wlUsePublicKey);
    FormData fdlUsePublicKey = new FormData();
    fdlUsePublicKey.left = new FormAttachment(0, 0);
    fdlUsePublicKey.top = new FormAttachment(wPassword, margin);
    fdlUsePublicKey.right = new FormAttachment(middle, -margin);
    wlUsePublicKey.setLayoutData(fdlUsePublicKey);
    wUsePublicKey = new Button(wServerSettings, SWT.CHECK);
    wUsePublicKey.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.useKeyFile.Tooltip"));
    props.setLook(wUsePublicKey);
    FormData fdUsePublicKey = new FormData();
    fdUsePublicKey.left = new FormAttachment(middle, 0);
    fdUsePublicKey.top = new FormAttachment(wlUsePublicKey, 0, SWT.CENTER);
    fdUsePublicKey.right = new FormAttachment(100, 0);
    wUsePublicKey.setLayoutData(fdUsePublicKey);
    wUsePublicKey.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            activeUseKey();
            action.setChanged();
        }
    });
    // Key File
    wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
    wlKeyFilename.setText(BaseMessages.getString(PKG, "ActionSftpPut.KeyFilename.Label"));
    props.setLook(wlKeyFilename);
    FormData fdlKeyFilename = new FormData();
    fdlKeyFilename.left = new FormAttachment(0, 0);
    fdlKeyFilename.top = new FormAttachment(wlUsePublicKey, 2 * margin);
    fdlKeyFilename.right = new FormAttachment(middle, -margin);
    wlKeyFilename.setLayoutData(fdlKeyFilename);
    wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbKeyFilename);
    wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    FormData fdbKeyFilename = new FormData();
    fdbKeyFilename.right = new FormAttachment(100, 0);
    fdbKeyFilename.top = new FormAttachment(wUsePublicKey, 0);
    wbKeyFilename.setLayoutData(fdbKeyFilename);
    wKeyFilename = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.KeyFilename.Tooltip"));
    props.setLook(wKeyFilename);
    wKeyFilename.addModifyListener(lsMod);
    FormData fdKeyFilename = new FormData();
    fdKeyFilename.left = new FormAttachment(middle, 0);
    fdKeyFilename.top = new FormAttachment(wUsePublicKey, margin);
    fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
    wKeyFilename.setLayoutData(fdKeyFilename);
    wbKeyFilename.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wKeyFilename, variables, new String[] { "*.pem", "*" }, FILETYPES, true));
    // keyfilePass line
    wKeyFilePass = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionSftpPut.keyfilePass.Label"), BaseMessages.getString(PKG, "ActionSftpPut.keyfilePass.Tooltip"), true, false);
    props.setLook(wKeyFilePass);
    wKeyFilePass.addModifyListener(lsMod);
    FormData fdkeyfilePass = new FormData();
    fdkeyfilePass.left = new FormAttachment(0, -margin);
    fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
    fdkeyfilePass.right = new FormAttachment(100, 0);
    wKeyFilePass.setLayoutData(fdkeyfilePass);
    Label wlProxyType = new Label(wServerSettings, SWT.RIGHT);
    wlProxyType.setText(BaseMessages.getString(PKG, "ActionSftpPut.ProxyType.Label"));
    props.setLook(wlProxyType);
    FormData fdlProxyType = new FormData();
    fdlProxyType.left = new FormAttachment(0, 0);
    fdlProxyType.right = new FormAttachment(middle, -margin);
    fdlProxyType.top = new FormAttachment(wKeyFilePass, 2 * margin);
    wlProxyType.setLayoutData(fdlProxyType);
    wProxyType = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProxyType.add(SftpClient.PROXY_TYPE_HTTP);
    wProxyType.add(SftpClient.PROXY_TYPE_SOCKS5);
    // +1: starts at -1
    wProxyType.select(0);
    props.setLook(wProxyType);
    FormData fdProxyType = new FormData();
    fdProxyType.left = new FormAttachment(middle, 0);
    fdProxyType.top = new FormAttachment(wKeyFilePass, 2 * margin);
    fdProxyType.right = new FormAttachment(100, 0);
    wProxyType.setLayoutData(fdProxyType);
    wProxyType.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setDefaultProxyPort();
        }
    });
    // Proxy host line
    wProxyHost = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionSftpPut.ProxyHost.Label"), BaseMessages.getString(PKG, "ActionSftpPut.ProxyHost.Tooltip"), false, false);
    props.setLook(wProxyHost);
    wProxyHost.addModifyListener(lsMod);
    FormData fdProxyHost = new FormData();
    fdProxyHost.left = new FormAttachment(0, -2 * margin);
    fdProxyHost.top = new FormAttachment(wProxyType, margin);
    fdProxyHost.right = new FormAttachment(100, 0);
    wProxyHost.setLayoutData(fdProxyHost);
    // Proxy port line
    wProxyPort = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionSftpPut.ProxyPort.Label"), BaseMessages.getString(PKG, "ActionSftpPut.ProxyPort.Tooltip"), false, false);
    props.setLook(wProxyPort);
    wProxyPort.addModifyListener(lsMod);
    FormData fdProxyPort = new FormData();
    fdProxyPort.left = new FormAttachment(0, -2 * margin);
    fdProxyPort.top = new FormAttachment(wProxyHost, margin);
    fdProxyPort.right = new FormAttachment(100, 0);
    wProxyPort.setLayoutData(fdProxyPort);
    // Proxy username line
    wProxyUsername = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionSftpPut.ProxyUsername.Label"), BaseMessages.getString(PKG, "ActionSftpPut.ProxyUsername.Tooltip"), false, false);
    props.setLook(wProxyUsername);
    wProxyUsername.addModifyListener(lsMod);
    FormData fdProxyUsername = new FormData();
    fdProxyUsername.left = new FormAttachment(0, -2 * margin);
    fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
    fdProxyUsername.right = new FormAttachment(100, 0);
    wProxyUsername.setLayoutData(fdProxyUsername);
    // Proxy password line
    wProxyPassword = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionSftpPut.ProxyPassword.Label"), BaseMessages.getString(PKG, "ActionSftpPut.ProxyPassword.Tooltip"), true, false);
    props.setLook(wProxyPassword);
    wProxyPassword.addModifyListener(lsMod);
    FormData fdProxyPasswd = new FormData();
    fdProxyPasswd.left = new FormAttachment(0, -2 * margin);
    fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
    fdProxyPasswd.right = new FormAttachment(100, 0);
    wProxyPassword.setLayoutData(fdProxyPasswd);
    // Test connection button
    Button wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "ActionSftpPut.TestConnection.Label"));
    props.setLook(wTest);
    FormData fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProxyPassword, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    wTest.addListener(SWT.Selection, e -> test());
    FormData fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wName, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    Label wlCompression = new Label(wGeneralComp, SWT.RIGHT);
    wlCompression.setText(BaseMessages.getString(PKG, "ActionSftpPut.Compression.Label"));
    props.setLook(wlCompression);
    FormData fdlCompression = new FormData();
    fdlCompression.left = new FormAttachment(0, -margin);
    fdlCompression.right = new FormAttachment(middle, 0);
    fdlCompression.top = new FormAttachment(wServerSettings, margin);
    wlCompression.setLayoutData(fdlCompression);
    wCompression = new CCombo(wGeneralComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wCompression.add("none");
    wCompression.add("zlib");
    // +1: starts at -1
    wCompression.select(0);
    props.setLook(wCompression);
    FormData fdCompression = new FormData();
    fdCompression.left = new FormAttachment(middle, margin);
    fdCompression.top = new FormAttachment(wServerSettings, margin);
    fdCompression.right = new FormAttachment(100, 0);
    wCompression.setLayoutData(fdCompression);
    FormData fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Files TAB ///
    // ////////////////////////
    CTabItem wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
    wFilesTab.setText(BaseMessages.getString(PKG, "ActionSftpPut.Tab.Files.Label"));
    Composite wFilesComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFilesComp);
    FormLayout filesLayout = new FormLayout();
    filesLayout.marginWidth = 3;
    filesLayout.marginHeight = 3;
    wFilesComp.setLayout(filesLayout);
    // ////////////////////////
    // START OF Source files GROUP///
    // /
    Group wgSourceFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wgSourceFiles);
    wgSourceFiles.setText(BaseMessages.getString(PKG, "ActionSftpPut.SourceFiles.Group.Label"));
    FormLayout sourceFilesGroupLayout = new FormLayout();
    sourceFilesGroupLayout.marginWidth = 10;
    sourceFilesGroupLayout.marginHeight = 10;
    wgSourceFiles.setLayout(sourceFilesGroupLayout);
    // Get arguments from previous result...
    Label wlGetPrevious = new Label(wgSourceFiles, SWT.RIGHT);
    wlGetPrevious.setText(BaseMessages.getString(PKG, "ActionSftpPut.getPrevious.Label"));
    props.setLook(wlGetPrevious);
    FormData fdlGetPrevious = new FormData();
    fdlGetPrevious.left = new FormAttachment(0, 0);
    fdlGetPrevious.top = new FormAttachment(0, margin);
    fdlGetPrevious.right = new FormAttachment(middle, -margin);
    wlGetPrevious.setLayoutData(fdlGetPrevious);
    wGetPrevious = new Button(wgSourceFiles, SWT.CHECK);
    props.setLook(wGetPrevious);
    wGetPrevious.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.getPrevious.Tooltip"));
    FormData fdGetPrevious = new FormData();
    fdGetPrevious.left = new FormAttachment(middle, 0);
    fdGetPrevious.top = new FormAttachment(wlGetPrevious, 0, SWT.CENTER);
    fdGetPrevious.right = new FormAttachment(100, 0);
    wGetPrevious.setLayoutData(fdGetPrevious);
    wGetPrevious.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (wGetPrevious.getSelection()) {
                // only one is allowed
                wGetPreviousFiles.setSelection(false);
            }
            activeCopyFromPrevious();
            action.setChanged();
        }
    });
    // Get arguments from previous files result...
    Label wlGetPreviousFiles = new Label(wgSourceFiles, SWT.RIGHT);
    wlGetPreviousFiles.setText(BaseMessages.getString(PKG, "ActionSftpPut.getPreviousFiles.Label"));
    props.setLook(wlGetPreviousFiles);
    FormData fdlGetPreviousFiles = new FormData();
    fdlGetPreviousFiles.left = new FormAttachment(0, 0);
    fdlGetPreviousFiles.top = new FormAttachment(wlGetPrevious, 2 * margin);
    fdlGetPreviousFiles.right = new FormAttachment(middle, -margin);
    wlGetPreviousFiles.setLayoutData(fdlGetPreviousFiles);
    wGetPreviousFiles = new Button(wgSourceFiles, SWT.CHECK);
    props.setLook(wGetPreviousFiles);
    wGetPreviousFiles.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.getPreviousFiles.Tooltip"));
    FormData fdGetPreviousFiles = new FormData();
    fdGetPreviousFiles.left = new FormAttachment(middle, 0);
    fdGetPreviousFiles.top = new FormAttachment(wlGetPreviousFiles, 0, SWT.CENTER);
    fdGetPreviousFiles.right = new FormAttachment(100, 0);
    wGetPreviousFiles.setLayoutData(fdGetPreviousFiles);
    wGetPreviousFiles.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (wGetPreviousFiles.getSelection()) {
                // only one is allowed
                wGetPrevious.setSelection(false);
            }
            activeCopyFromPrevious();
            action.setChanged();
        }
    });
    // Local Directory line
    wlLocalDirectory = new Label(wgSourceFiles, SWT.RIGHT);
    wlLocalDirectory.setText(BaseMessages.getString(PKG, "ActionSftpPut.LocalDir.Label"));
    props.setLook(wlLocalDirectory);
    FormData fdlLocalDirectory = new FormData();
    fdlLocalDirectory.left = new FormAttachment(0, 0);
    fdlLocalDirectory.top = new FormAttachment(wlGetPreviousFiles, 2 * margin);
    fdlLocalDirectory.right = new FormAttachment(middle, -margin);
    wlLocalDirectory.setLayoutData(fdlLocalDirectory);
    // Browse folders button ...
    wbLocalDirectory = new Button(wgSourceFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbLocalDirectory);
    wbLocalDirectory.setText(BaseMessages.getString(PKG, "ActionSftpPut.BrowseFolders.Label"));
    FormData fdbLocalDirectory = new FormData();
    fdbLocalDirectory.right = new FormAttachment(100, 0);
    fdbLocalDirectory.top = new FormAttachment(wlLocalDirectory, 0, SWT.CENTER);
    wbLocalDirectory.setLayoutData(fdbLocalDirectory);
    wbLocalDirectory.addListener(SWT.Selection, e -> BaseDialog.presentDirectoryDialog(shell, wLocalDirectory, variables));
    wLocalDirectory = new TextVar(variables, wgSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLocalDirectory);
    wLocalDirectory.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.LocalDir.Tooltip"));
    wLocalDirectory.addModifyListener(lsMod);
    FormData fdLocalDirectory = new FormData();
    fdLocalDirectory.left = new FormAttachment(middle, 0);
    fdLocalDirectory.top = new FormAttachment(wlLocalDirectory, 0, SWT.CENTER);
    fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, -margin);
    wLocalDirectory.setLayoutData(fdLocalDirectory);
    // Wildcard line
    wlWildcard = new Label(wgSourceFiles, SWT.RIGHT);
    wlWildcard.setText(BaseMessages.getString(PKG, "ActionSftpPut.Wildcard.Label"));
    props.setLook(wlWildcard);
    FormData fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wbLocalDirectory, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);
    wWildcard = new TextVar(variables, wgSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wWildcard);
    wWildcard.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.Wildcard.Tooltip"));
    wWildcard.addModifyListener(lsMod);
    FormData fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wbLocalDirectory, margin);
    fdWildcard.right = new FormAttachment(100, 0);
    wWildcard.setLayoutData(fdWildcard);
    // Success when there is no file...
    Label wlSuccessWhenNoFile = new Label(wgSourceFiles, SWT.RIGHT);
    wlSuccessWhenNoFile.setText(BaseMessages.getString(PKG, "ActionSftpPut.SuccessWhenNoFile.Label"));
    props.setLook(wlSuccessWhenNoFile);
    FormData fdlSuccessWhenNoFile = new FormData();
    fdlSuccessWhenNoFile.left = new FormAttachment(0, 0);
    fdlSuccessWhenNoFile.top = new FormAttachment(wWildcard, margin);
    fdlSuccessWhenNoFile.right = new FormAttachment(middle, -margin);
    wlSuccessWhenNoFile.setLayoutData(fdlSuccessWhenNoFile);
    wSuccessWhenNoFile = new Button(wgSourceFiles, SWT.CHECK);
    props.setLook(wSuccessWhenNoFile);
    wSuccessWhenNoFile.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.SuccessWhenNoFile.Tooltip"));
    FormData fdSuccessWhenNoFile = new FormData();
    fdSuccessWhenNoFile.left = new FormAttachment(middle, 0);
    fdSuccessWhenNoFile.top = new FormAttachment(wlSuccessWhenNoFile, 0, SWT.CENTER);
    fdSuccessWhenNoFile.right = new FormAttachment(100, 0);
    wSuccessWhenNoFile.setLayoutData(fdSuccessWhenNoFile);
    wSuccessWhenNoFile.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            action.setChanged();
        }
    });
    // After FTP Put
    Label wlAfterFtpPut = new Label(wgSourceFiles, SWT.RIGHT);
    wlAfterFtpPut.setText(BaseMessages.getString(PKG, "ActionSftpPut.AfterFTPPut.Label"));
    props.setLook(wlAfterFtpPut);
    FormData fdlAfterFtpPut = new FormData();
    fdlAfterFtpPut.left = new FormAttachment(0, 0);
    fdlAfterFtpPut.right = new FormAttachment(middle, -margin);
    fdlAfterFtpPut.top = new FormAttachment(wlSuccessWhenNoFile, 2 * margin);
    wlAfterFtpPut.setLayoutData(fdlAfterFtpPut);
    wAfterFtpPut = new CCombo(wgSourceFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wAfterFtpPut.add(BaseMessages.getString(PKG, "ActionSftpPut.AfterSFTP.DoNothing.Label"));
    wAfterFtpPut.add(BaseMessages.getString(PKG, "ActionSftpPut.AfterSFTP.Delete.Label"));
    wAfterFtpPut.add(BaseMessages.getString(PKG, "ActionSftpPut.AfterSFTP.Move.Label"));
    // +1: starts at -1
    wAfterFtpPut.select(0);
    props.setLook(wAfterFtpPut);
    FormData fdAfterFtpPut = new FormData();
    fdAfterFtpPut.left = new FormAttachment(middle, 0);
    fdAfterFtpPut.top = new FormAttachment(wSuccessWhenNoFile, 2 * margin);
    fdAfterFtpPut.right = new FormAttachment(100, -margin);
    wAfterFtpPut.setLayoutData(fdAfterFtpPut);
    wAfterFtpPut.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            afterFtpPutActivate();
        }
    });
    // moveTo Directory
    wlDestinationFolder = new Label(wgSourceFiles, SWT.RIGHT);
    wlDestinationFolder.setText(BaseMessages.getString(PKG, "ActionSftpPut.DestinationFolder.Label"));
    props.setLook(wlDestinationFolder);
    FormData fdlDestinationFolder = new FormData();
    fdlDestinationFolder.left = new FormAttachment(0, 0);
    fdlDestinationFolder.top = new FormAttachment(wAfterFtpPut, margin);
    fdlDestinationFolder.right = new FormAttachment(middle, -margin);
    wlDestinationFolder.setLayoutData(fdlDestinationFolder);
    // Browse folders button ...
    wbMovetoDirectory = new Button(wgSourceFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbMovetoDirectory);
    wbMovetoDirectory.setText(BaseMessages.getString(PKG, "ActionSftpPut.BrowseFolders.Label"));
    FormData fdbMovetoDirectory = new FormData();
    fdbMovetoDirectory.right = new FormAttachment(100, 0);
    fdbMovetoDirectory.top = new FormAttachment(wAfterFtpPut, margin);
    wbMovetoDirectory.setLayoutData(fdbMovetoDirectory);
    wbMovetoDirectory.addListener(SWT.Selection, e -> BaseDialog.presentDirectoryDialog(shell, wDestinationFolder, variables));
    wDestinationFolder = new TextVar(variables, wgSourceFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionSftpPut.DestinationFolder.Tooltip"));
    props.setLook(wDestinationFolder);
    wDestinationFolder.addModifyListener(lsMod);
    FormData fdDestinationFolder = new FormData();
    fdDestinationFolder.left = new FormAttachment(middle, 0);
    fdDestinationFolder.top = new FormAttachment(wAfterFtpPut, margin);
    fdDestinationFolder.right = new FormAttachment(wbMovetoDirectory, -margin);
    wDestinationFolder.setLayoutData(fdDestinationFolder);
    // Whenever something changes, set the tooltip to the expanded version:
    wDestinationFolder.addModifyListener(e -> wDestinationFolder.setToolTipText(variables.resolve(wDestinationFolder.getText())));
    // Create destination folder if necessary ...
    wlCreateDestinationFolder = new Label(wgSourceFiles, SWT.RIGHT);
    wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "ActionSftpPut.CreateDestinationFolder.Label"));
    props.setLook(wlCreateDestinationFolder);
    FormData fdlCreateDestinationFolder = new FormData();
    fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
    fdlCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
    fdlCreateDestinationFolder.right = new FormAttachment(middle, -margin);
    wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
    wCreateDestinationFolder = new Button(wgSourceFiles, SWT.CHECK);
    wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.CreateDestinationFolder.Tooltip"));
    props.setLook(wCreateDestinationFolder);
    FormData fdCreateDestinationFolder = new FormData();
    fdCreateDestinationFolder.left = new FormAttachment(middle, 0);
    fdCreateDestinationFolder.top = new FormAttachment(wlCreateDestinationFolder, 0, SWT.CENTER);
    fdCreateDestinationFolder.right = new FormAttachment(100, 0);
    wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
    // Add filenames to result filenames...
    wlAddFilenameToResult = new Label(wgSourceFiles, SWT.RIGHT);
    wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "ActionSftpPut.AddfilenametoResult.Label"));
    props.setLook(wlAddFilenameToResult);
    FormData fdlAddFilenameToResult = new FormData();
    fdlAddFilenameToResult.left = new FormAttachment(0, 0);
    fdlAddFilenameToResult.top = new FormAttachment(wlCreateDestinationFolder, 2 * margin);
    fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
    wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
    wAddFilenameToResult = new Button(wgSourceFiles, SWT.CHECK);
    wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.AddfilenametoResult.Tooltip"));
    props.setLook(wAddFilenameToResult);
    FormData fdAddFilenameToResult = new FormData();
    fdAddFilenameToResult.left = new FormAttachment(middle, 0);
    fdAddFilenameToResult.top = new FormAttachment(wlAddFilenameToResult, 0, SWT.CENTER);
    fdAddFilenameToResult.right = new FormAttachment(100, 0);
    wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
    FormData fdSourceFiles = new FormData();
    fdSourceFiles.left = new FormAttachment(0, margin);
    fdSourceFiles.top = new FormAttachment(wServerSettings, 2 * margin);
    fdSourceFiles.right = new FormAttachment(100, -margin);
    wgSourceFiles.setLayoutData(fdSourceFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Source files GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Target files GROUP///
    // /
    Group wTargetFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wTargetFiles);
    wTargetFiles.setText(BaseMessages.getString(PKG, "ActionSftpPut.TargetFiles.Group.Label"));
    FormLayout targetFilesgroupLayout = new FormLayout();
    targetFilesgroupLayout.marginWidth = 10;
    targetFilesgroupLayout.marginHeight = 10;
    wTargetFiles.setLayout(targetFilesgroupLayout);
    // FtpDirectory line
    Label wlScpDirectory = new Label(wTargetFiles, SWT.RIGHT);
    wlScpDirectory.setText(BaseMessages.getString(PKG, "ActionSftpPut.RemoteDir.Label"));
    props.setLook(wlScpDirectory);
    FormData fdlScpDirectory = new FormData();
    fdlScpDirectory.left = new FormAttachment(0, 0);
    fdlScpDirectory.top = new FormAttachment(wgSourceFiles, margin);
    fdlScpDirectory.right = new FormAttachment(middle, -margin);
    wlScpDirectory.setLayoutData(fdlScpDirectory);
    // Test remote folder button ...
    wbTestChangeFolderExists = new Button(wTargetFiles, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTestChangeFolderExists);
    wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "ActionSftpPut.TestFolderExists.Label"));
    FormData fdbTestChangeFolderExists = new FormData();
    fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
    fdbTestChangeFolderExists.top = new FormAttachment(wgSourceFiles, margin);
    wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
    wbTestChangeFolderExists.addListener(SWT.Selection, e -> checkRemoteFolder());
    // Target (remote) folder
    wScpDirectory = new TextVar(variables, wTargetFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wScpDirectory);
    wScpDirectory.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.RemoteDir.Tooltip"));
    wScpDirectory.addModifyListener(lsMod);
    FormData fdScpDirectory = new FormData();
    fdScpDirectory.left = new FormAttachment(middle, 0);
    fdScpDirectory.top = new FormAttachment(wgSourceFiles, margin);
    fdScpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
    wScpDirectory.setLayoutData(fdScpDirectory);
    // CreateRemoteFolder files after retrieval...
    Label wlCreateRemoteFolder = new Label(wTargetFiles, SWT.RIGHT);
    wlCreateRemoteFolder.setText(BaseMessages.getString(PKG, "ActionSftpPut.CreateRemoteFolderFiles.Label"));
    props.setLook(wlCreateRemoteFolder);
    FormData fdlCreateRemoteFolder = new FormData();
    fdlCreateRemoteFolder.left = new FormAttachment(0, 0);
    fdlCreateRemoteFolder.top = new FormAttachment(wScpDirectory, margin);
    fdlCreateRemoteFolder.right = new FormAttachment(middle, -margin);
    wlCreateRemoteFolder.setLayoutData(fdlCreateRemoteFolder);
    wCreateRemoteFolder = new Button(wTargetFiles, SWT.CHECK);
    props.setLook(wCreateRemoteFolder);
    FormData fdCreateRemoteFolder = new FormData();
    wCreateRemoteFolder.setToolTipText(BaseMessages.getString(PKG, "ActionSftpPut.CreateRemoteFolderFiles.Tooltip"));
    fdCreateRemoteFolder.left = new FormAttachment(middle, 0);
    fdCreateRemoteFolder.top = new FormAttachment(wlCreateRemoteFolder, 0, SWT.CENTER);
    fdCreateRemoteFolder.right = new FormAttachment(100, 0);
    wCreateRemoteFolder.setLayoutData(fdCreateRemoteFolder);
    wCreateRemoteFolder.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            action.setChanged();
        }
    });
    FormData fdTargetFiles = new FormData();
    fdTargetFiles.left = new FormAttachment(0, margin);
    fdTargetFiles.top = new FormAttachment(wgSourceFiles, margin);
    fdTargetFiles.right = new FormAttachment(100, -margin);
    wTargetFiles.setLayoutData(fdTargetFiles);
    // ///////////////////////////////////////////////////////////
    // / END OF Target files GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdFilesComp = new FormData();
    fdFilesComp.left = new FormAttachment(0, 0);
    fdFilesComp.top = new FormAttachment(0, 0);
    fdFilesComp.right = new FormAttachment(100, 0);
    fdFilesComp.bottom = new FormAttachment(100, 0);
    wFilesComp.setLayoutData(fdFilesComp);
    wFilesComp.layout();
    wFilesTab.setControl(wFilesComp);
    props.setLook(wFilesComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Files TAB
    // ///////////////////////////////////////////////////////////
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
    wTabFolder.setLayoutData(fdTabFolder);
    wTabFolder.setSelection(0);
    getData();
    activeCopyFromPrevious();
    activeUseKey();
    afterFtpPutActivate();
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return action;
}
Also used : Utils(org.apache.hop.core.util.Utils) IVariables(org.apache.hop.core.variables.IVariables) IActionDialog(org.apache.hop.workflow.action.IActionDialog) Props(org.apache.hop.core.Props) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) InetAddress(java.net.InetAddress) WindowProperty(org.apache.hop.ui.core.gui.WindowProperty) ActionDialog(org.apache.hop.ui.workflow.action.ActionDialog) CCombo(org.eclipse.swt.custom.CCombo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SftpClient(org.apache.hop.workflow.actions.sftp.SftpClient) BaseMessages(org.apache.hop.i18n.BaseMessages) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) FormLayout(org.eclipse.swt.layout.FormLayout) WorkflowDialog(org.apache.hop.ui.workflow.dialog.WorkflowDialog) BaseDialog(org.apache.hop.ui.core.dialog.BaseDialog) FormData(org.eclipse.swt.layout.FormData) org.eclipse.swt.widgets(org.eclipse.swt.widgets) LabelTextVar(org.apache.hop.ui.core.widget.LabelTextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment) Const(org.apache.hop.core.Const) CTabItem(org.eclipse.swt.custom.CTabItem) TextVar(org.apache.hop.ui.core.widget.TextVar) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IAction(org.apache.hop.workflow.action.IAction) BaseTransformDialog(org.apache.hop.ui.pipeline.transform.BaseTransformDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CTabFolder(org.eclipse.swt.custom.CTabFolder) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) CTabItem(org.eclipse.swt.custom.CTabItem) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) LabelTextVar(org.apache.hop.ui.core.widget.LabelTextVar) TextVar(org.apache.hop.ui.core.widget.TextVar) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) LabelTextVar(org.apache.hop.ui.core.widget.LabelTextVar) CCombo(org.eclipse.swt.custom.CCombo) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 2 with PasswordTextVar

use of org.apache.hop.ui.core.widget.PasswordTextVar in project hop by apache.

the class ActionFtpPutDialog method open.

@Override
public IAction open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
    props.setLook(shell);
    WorkflowDialog.setShellImage(shell, action);
    WorkflowMeta workflowMeta = getWorkflowMeta();
    ModifyListener lsMod = e -> {
        ftpclient = null;
        pwdFolder = null;
        action.setChanged();
    };
    changed = action.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "ActionFtpPut.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Filename line
    Label wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "ActionFtpPut.Name.Label"));
    props.setLook(wlName);
    FormData fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    FormData fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    // The buttons at the bottom
    // 
    Button wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    Button wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
    // The tab folder between the name and the buttons
    // 
    CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "ActionFtpPut.Tab.General.Label"));
    Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    Group wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.ServerSettings.Group.Label"));
    FormLayout serverSettingsgroupLayout = new FormLayout();
    serverSettingsgroupLayout.marginWidth = 10;
    serverSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(serverSettingsgroupLayout);
    // ServerName line
    Label wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "ActionFtpPut.Server.Label"));
    props.setLook(wlServerName);
    FormData fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(wName, margin);
    fdlServerName.right = new FormAttachment(middle, 0);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    FormData fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, margin);
    fdServerName.top = new FormAttachment(wName, margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // ServerPort line
    Label wlServerPort = new Label(wServerSettings, SWT.RIGHT);
    wlServerPort.setText(BaseMessages.getString(PKG, "ActionFtpPut.Port.Label"));
    props.setLook(wlServerPort);
    FormData fdlServerPort = new FormData();
    fdlServerPort.left = new FormAttachment(0, 0);
    fdlServerPort.top = new FormAttachment(wServerName, margin);
    fdlServerPort.right = new FormAttachment(middle, 0);
    wlServerPort.setLayoutData(fdlServerPort);
    wServerPort = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerPort);
    wServerPort.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.Port.Tooltip"));
    wServerPort.addModifyListener(lsMod);
    FormData fdServerPort = new FormData();
    fdServerPort.left = new FormAttachment(middle, margin);
    fdServerPort.top = new FormAttachment(wServerName, margin);
    fdServerPort.right = new FormAttachment(100, 0);
    wServerPort.setLayoutData(fdServerPort);
    // UserName line
    Label wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "ActionFtpPut.Username.Label"));
    props.setLook(wlUserName);
    FormData fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wServerPort, margin);
    fdlUserName.right = new FormAttachment(middle, 0);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.addModifyListener(lsMod);
    FormData fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, margin);
    fdUserName.top = new FormAttachment(wServerPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    Label wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "ActionFtpPut.Password.Label"));
    props.setLook(wlPassword);
    FormData fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wUserName, margin);
    fdlPassword.right = new FormAttachment(middle, 0);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    FormData fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, margin);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // Proxy host line
    wProxyHost = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyHost.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyHost.Tooltip"), false, false);
    props.setLook(wProxyHost);
    wProxyHost.addModifyListener(lsMod);
    FormData fdProxyHost = new FormData();
    fdProxyHost.left = new FormAttachment(0, 0);
    fdProxyHost.top = new FormAttachment(wPassword, 2 * margin);
    fdProxyHost.right = new FormAttachment(100, 0);
    wProxyHost.setLayoutData(fdProxyHost);
    // Proxy port line
    wProxyPort = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyPort.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyPort.Tooltip"), false, false);
    props.setLook(wProxyPort);
    wProxyPort.addModifyListener(lsMod);
    FormData fdProxyPort = new FormData();
    fdProxyPort.left = new FormAttachment(0, 0);
    fdProxyPort.top = new FormAttachment(wProxyHost, margin);
    fdProxyPort.right = new FormAttachment(100, 0);
    wProxyPort.setLayoutData(fdProxyPort);
    // Proxy username line
    wProxyUsername = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyUsername.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyUsername.Tooltip"), false, false);
    props.setLook(wProxyUsername);
    wProxyUsername.addModifyListener(lsMod);
    FormData fdProxyUsername = new FormData();
    fdProxyUsername.left = new FormAttachment(0, 0);
    fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
    fdProxyUsername.right = new FormAttachment(100, 0);
    wProxyUsername.setLayoutData(fdProxyUsername);
    // Proxy password line
    wProxyPassword = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyPassword.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyPassword.Tooltip"), true, false);
    props.setLook(wProxyPassword);
    wProxyPassword.addModifyListener(lsMod);
    FormData fdProxyPasswd = new FormData();
    fdProxyPasswd.left = new FormAttachment(0, 0);
    fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
    fdProxyPasswd.right = new FormAttachment(100, 0);
    wProxyPassword.setLayoutData(fdProxyPasswd);
    // Test connection button
    Button wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "ActionFtpPut.TestConnection.Label"));
    props.setLook(wTest);
    FormData fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProxyPassword, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    wTest.addListener(SWT.Selection, e -> test());
    FormData fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wName, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Advanced SETTINGS GROUP///
    // /
    Group wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wAdvancedSettings);
    wAdvancedSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.AdvancedSettings.Group.Label"));
    FormLayout advancedSettingsgroupLayout = new FormLayout();
    advancedSettingsgroupLayout.marginWidth = 10;
    advancedSettingsgroupLayout.marginHeight = 10;
    wAdvancedSettings.setLayout(advancedSettingsgroupLayout);
    // Binary mode selection...
    Label wlBinaryMode = new Label(wAdvancedSettings, SWT.RIGHT);
    wlBinaryMode.setText(BaseMessages.getString(PKG, "ActionFtpPut.BinaryMode.Label"));
    props.setLook(wlBinaryMode);
    FormData fdlBinaryMode = new FormData();
    fdlBinaryMode.left = new FormAttachment(0, 0);
    fdlBinaryMode.top = new FormAttachment(wServerSettings, margin);
    fdlBinaryMode.right = new FormAttachment(middle, 0);
    wlBinaryMode.setLayoutData(fdlBinaryMode);
    wBinaryMode = new Button(wAdvancedSettings, SWT.CHECK);
    props.setLook(wBinaryMode);
    wBinaryMode.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.BinaryMode.Tooltip"));
    FormData fdBinaryMode = new FormData();
    fdBinaryMode.left = new FormAttachment(middle, 0);
    fdBinaryMode.top = new FormAttachment(wlBinaryMode, 0, SWT.CENTER);
    fdBinaryMode.right = new FormAttachment(100, 0);
    wBinaryMode.setLayoutData(fdBinaryMode);
    // TimeOut...
    Label wlTimeout = new Label(wAdvancedSettings, SWT.RIGHT);
    wlTimeout.setText(BaseMessages.getString(PKG, "ActionFtpPut.Timeout.Label"));
    props.setLook(wlTimeout);
    FormData fdlTimeout = new FormData();
    fdlTimeout.left = new FormAttachment(0, 0);
    fdlTimeout.top = new FormAttachment(wlBinaryMode, 2 * margin);
    fdlTimeout.right = new FormAttachment(middle, 0);
    wlTimeout.setLayoutData(fdlTimeout);
    wTimeout = new TextVar(variables, wAdvancedSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.Timeout.Tooltip"));
    props.setLook(wTimeout);
    wTimeout.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.Timeout.Tooltip"));
    FormData fdTimeout = new FormData();
    fdTimeout.left = new FormAttachment(middle, 0);
    fdTimeout.top = new FormAttachment(wBinaryMode, margin);
    fdTimeout.right = new FormAttachment(100, 0);
    wTimeout.setLayoutData(fdTimeout);
    // active connection?
    Label wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
    wlActive.setText(BaseMessages.getString(PKG, "ActionFtpPut.ActiveConns.Label"));
    props.setLook(wlActive);
    FormData fdlActive = new FormData();
    fdlActive.left = new FormAttachment(0, 0);
    fdlActive.top = new FormAttachment(wTimeout, margin);
    fdlActive.right = new FormAttachment(middle, 0);
    wlActive.setLayoutData(fdlActive);
    wActive = new Button(wAdvancedSettings, SWT.CHECK);
    wActive.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.ActiveConns.Tooltip"));
    props.setLook(wActive);
    FormData fdActive = new FormData();
    fdActive.left = new FormAttachment(middle, 0);
    fdActive.top = new FormAttachment(wlActive, 0, SWT.CENTER);
    fdActive.right = new FormAttachment(100, 0);
    wActive.setLayoutData(fdActive);
    // Control encoding line
    // 
    // The drop down is editable as it may happen an encoding may not be present
    // on one machine, but you may want to use it on your execution server
    // 
    Label wlControlEncoding = new Label(wAdvancedSettings, SWT.RIGHT);
    wlControlEncoding.setText(BaseMessages.getString(PKG, "ActionFtpPut.ControlEncoding.Label"));
    props.setLook(wlControlEncoding);
    FormData fdlControlEncoding = new FormData();
    fdlControlEncoding.left = new FormAttachment(0, 0);
    fdlControlEncoding.top = new FormAttachment(wlActive, 2 * margin);
    fdlControlEncoding.right = new FormAttachment(middle, 0);
    wlControlEncoding.setLayoutData(fdlControlEncoding);
    wControlEncoding = new Combo(wAdvancedSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wControlEncoding.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.ControlEncoding.Tooltip"));
    wControlEncoding.setItems(encodings);
    props.setLook(wControlEncoding);
    FormData fdControlEncoding = new FormData();
    fdControlEncoding.left = new FormAttachment(middle, 0);
    fdControlEncoding.top = new FormAttachment(wlControlEncoding, 0, SWT.CENTER);
    fdControlEncoding.right = new FormAttachment(100, 0);
    wControlEncoding.setLayoutData(fdControlEncoding);
    FormData fdAdvancedSettings = new FormData();
    fdAdvancedSettings.left = new FormAttachment(0, margin);
    fdAdvancedSettings.top = new FormAttachment(wServerSettings, margin);
    fdAdvancedSettings.right = new FormAttachment(100, -margin);
    wAdvancedSettings.setLayoutData(fdAdvancedSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Advanced SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(0, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Files TAB ///
    // ////////////////////////
    CTabItem wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
    wFilesTab.setText(BaseMessages.getString(PKG, "ActionFtpPut.Tab.Files.Label"));
    Composite wFilesComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wFilesComp);
    FormLayout filesLayout = new FormLayout();
    filesLayout.marginWidth = 3;
    filesLayout.marginHeight = 3;
    wFilesComp.setLayout(filesLayout);
    // ////////////////////////
    // START OF Source SETTINGS GROUP///
    // /
    Group wSourceSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wSourceSettings);
    wSourceSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.SourceSettings.Group.Label"));
    FormLayout sourceSettinsgroupLayout = new FormLayout();
    sourceSettinsgroupLayout.marginWidth = 10;
    sourceSettinsgroupLayout.marginHeight = 10;
    wSourceSettings.setLayout(sourceSettinsgroupLayout);
    // Local (source) directory line
    Label wlLocalDirectory = new Label(wSourceSettings, SWT.RIGHT);
    wlLocalDirectory.setText(BaseMessages.getString(PKG, "ActionFtpPut.LocalDir.Label"));
    props.setLook(wlLocalDirectory);
    FormData fdlLocalDirectory = new FormData();
    fdlLocalDirectory.left = new FormAttachment(0, 0);
    fdlLocalDirectory.top = new FormAttachment(0, margin);
    fdlLocalDirectory.right = new FormAttachment(middle, -margin);
    wlLocalDirectory.setLayoutData(fdlLocalDirectory);
    // Browse folders button ...
    Button wbLocalDirectory = new Button(wSourceSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbLocalDirectory);
    wbLocalDirectory.setText(BaseMessages.getString(PKG, "ActionFtpPut.BrowseFolders.Label"));
    FormData fdbLocalDirectory = new FormData();
    fdbLocalDirectory.right = new FormAttachment(100, 0);
    fdbLocalDirectory.top = new FormAttachment(0, margin);
    wbLocalDirectory.setLayoutData(fdbLocalDirectory);
    wbLocalDirectory.addListener(SWT.Selection, e -> BaseDialog.presentDirectoryDialog(shell, wLocalDirectory, variables));
    wLocalDirectory = new TextVar(variables, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.LocalDir.Tooltip"));
    props.setLook(wLocalDirectory);
    wLocalDirectory.addModifyListener(lsMod);
    FormData fdLocalDirectory = new FormData();
    fdLocalDirectory.left = new FormAttachment(middle, 0);
    fdLocalDirectory.top = new FormAttachment(0, margin);
    fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, -margin);
    wLocalDirectory.setLayoutData(fdLocalDirectory);
    // Wildcard line
    Label wlWildcard = new Label(wSourceSettings, SWT.RIGHT);
    wlWildcard.setText(BaseMessages.getString(PKG, "ActionFtpPut.Wildcard.Label"));
    props.setLook(wlWildcard);
    FormData fdlWildcard = new FormData();
    fdlWildcard.left = new FormAttachment(0, 0);
    fdlWildcard.top = new FormAttachment(wLocalDirectory, margin);
    fdlWildcard.right = new FormAttachment(middle, -margin);
    wlWildcard.setLayoutData(fdlWildcard);
    wWildcard = new TextVar(variables, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.Wildcard.Tooltip"));
    props.setLook(wWildcard);
    wWildcard.addModifyListener(lsMod);
    FormData fdWildcard = new FormData();
    fdWildcard.left = new FormAttachment(middle, 0);
    fdWildcard.top = new FormAttachment(wLocalDirectory, margin);
    fdWildcard.right = new FormAttachment(100, 0);
    wWildcard.setLayoutData(fdWildcard);
    // Remove files after retrieval...
    Label wlRemove = new Label(wSourceSettings, SWT.RIGHT);
    wlRemove.setText(BaseMessages.getString(PKG, "ActionFtpPut.RemoveFiles.Label"));
    props.setLook(wlRemove);
    FormData fdlRemove = new FormData();
    fdlRemove.left = new FormAttachment(0, 0);
    fdlRemove.top = new FormAttachment(wWildcard, 2 * margin);
    fdlRemove.right = new FormAttachment(middle, -margin);
    wlRemove.setLayoutData(fdlRemove);
    wRemove = new Button(wSourceSettings, SWT.CHECK);
    props.setLook(wRemove);
    wRemove.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.RemoveFiles.Tooltip"));
    FormData fdRemove = new FormData();
    fdRemove.left = new FormAttachment(middle, 0);
    fdRemove.top = new FormAttachment(wlRemove, 0, SWT.CENTER);
    fdRemove.right = new FormAttachment(100, 0);
    wRemove.setLayoutData(fdRemove);
    // OnlyNew files after retrieval...
    Label wlOnlyNew = new Label(wSourceSettings, SWT.RIGHT);
    wlOnlyNew.setText(BaseMessages.getString(PKG, "ActionFtpPut.DontOverwrite.Label"));
    props.setLook(wlOnlyNew);
    FormData fdlOnlyNew = new FormData();
    fdlOnlyNew.left = new FormAttachment(0, 0);
    fdlOnlyNew.top = new FormAttachment(wlRemove, 2 * margin);
    fdlOnlyNew.right = new FormAttachment(middle, 0);
    wlOnlyNew.setLayoutData(fdlOnlyNew);
    wOnlyNew = new Button(wSourceSettings, SWT.CHECK);
    wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.DontOverwrite.Tooltip"));
    props.setLook(wOnlyNew);
    FormData fdOnlyNew = new FormData();
    fdOnlyNew.left = new FormAttachment(middle, 0);
    fdOnlyNew.top = new FormAttachment(wlOnlyNew, 0, SWT.CENTER);
    fdOnlyNew.right = new FormAttachment(100, 0);
    wOnlyNew.setLayoutData(fdOnlyNew);
    FormData fdSourceSettings = new FormData();
    fdSourceSettings.left = new FormAttachment(0, margin);
    fdSourceSettings.top = new FormAttachment(0, 2 * margin);
    fdSourceSettings.right = new FormAttachment(100, -margin);
    wSourceSettings.setLayoutData(fdSourceSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Source SETTINGSGROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Target SETTINGS GROUP///
    // /
    Group wTargetSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
    props.setLook(wTargetSettings);
    wTargetSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.TargetSettings.Group.Label"));
    FormLayout targetSettinsgroupLayout = new FormLayout();
    targetSettinsgroupLayout.marginWidth = 10;
    targetSettinsgroupLayout.marginHeight = 10;
    wTargetSettings.setLayout(targetSettinsgroupLayout);
    // Remote Directory line
    Label wlRemoteDirectory = new Label(wTargetSettings, SWT.RIGHT);
    wlRemoteDirectory.setText(BaseMessages.getString(PKG, "ActionFtpPut.RemoteDir.Label"));
    props.setLook(wlRemoteDirectory);
    FormData fdlRemoteDirectory = new FormData();
    fdlRemoteDirectory.left = new FormAttachment(0, 0);
    fdlRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
    fdlRemoteDirectory.right = new FormAttachment(middle, -margin);
    wlRemoteDirectory.setLayoutData(fdlRemoteDirectory);
    // Test remote folder button ...
    Button wbTestRemoteDirectoryExists = new Button(wTargetSettings, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTestRemoteDirectoryExists);
    wbTestRemoteDirectoryExists.setText(BaseMessages.getString(PKG, "ActionFtpPut.TestFolderExists.Label"));
    FormData fdbTestRemoteDirectoryExists = new FormData();
    fdbTestRemoteDirectoryExists.right = new FormAttachment(100, 0);
    fdbTestRemoteDirectoryExists.top = new FormAttachment(wSourceSettings, margin);
    wbTestRemoteDirectoryExists.setLayoutData(fdbTestRemoteDirectoryExists);
    wbTestRemoteDirectoryExists.addListener(SWT.Selection, e -> checkRemoteFolder(variables.resolve(wRemoteDirectory.getText())));
    wRemoteDirectory = new TextVar(variables, wTargetSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.RemoteDir.Tooltip"));
    props.setLook(wRemoteDirectory);
    wRemoteDirectory.addModifyListener(lsMod);
    FormData fdRemoteDirectory = new FormData();
    fdRemoteDirectory.left = new FormAttachment(middle, 0);
    fdRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
    fdRemoteDirectory.right = new FormAttachment(wbTestRemoteDirectoryExists, -margin);
    wRemoteDirectory.setLayoutData(fdRemoteDirectory);
    FormData fdTargetSettings = new FormData();
    fdTargetSettings.left = new FormAttachment(0, margin);
    fdTargetSettings.top = new FormAttachment(wSourceSettings, margin);
    fdTargetSettings.right = new FormAttachment(100, -margin);
    wTargetSettings.setLayoutData(fdTargetSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF Target SETTINGSGROUP
    // ///////////////////////////////////////////////////////////
    FormData fdFilesComp = new FormData();
    fdFilesComp.left = new FormAttachment(0, 0);
    fdFilesComp.top = new FormAttachment(0, 0);
    fdFilesComp.right = new FormAttachment(100, 0);
    fdFilesComp.bottom = new FormAttachment(100, 0);
    wFilesComp.setLayoutData(fdFilesComp);
    wFilesComp.layout();
    wFilesTab.setControl(wFilesComp);
    props.setLook(wFilesComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Files TAB
    // ///////////////////////////////////////////////////////////
    // ///////////////////////////////////////////////////////////
    // Start of Socks Proxy Tab
    // ///////////////////////////////////////////////////////////
    CTabItem wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
    wSocksProxyTab.setText(BaseMessages.getString(PKG, "ActionFtpPut.Tab.Socks.Label"));
    Composite wSocksProxyComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSocksProxyComp);
    FormLayout soxProxyLayout = new FormLayout();
    soxProxyLayout.marginWidth = 3;
    soxProxyLayout.marginHeight = 3;
    wSocksProxyComp.setLayout(soxProxyLayout);
    // ////////////////////////////////////////////////////////
    // Start of Proxy Group
    // ////////////////////////////////////////////////////////
    Group wSocksProxy = new Group(wSocksProxyComp, SWT.SHADOW_NONE);
    props.setLook(wSocksProxy);
    wSocksProxy.setText(BaseMessages.getString(PKG, "ActionFtpPut.SocksProxy.Group.Label"));
    FormLayout socksProxyGroupLayout = new FormLayout();
    socksProxyGroupLayout.marginWidth = 10;
    socksProxyGroupLayout.marginHeight = 10;
    wSocksProxy.setLayout(socksProxyGroupLayout);
    // host line
    wSocksProxyHost = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyHost.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyHost.Tooltip"), false, false);
    props.setLook(wSocksProxyHost);
    wSocksProxyHost.addModifyListener(lsMod);
    FormData fdSocksProxyHost = new FormData();
    fdSocksProxyHost.left = new FormAttachment(0, 0);
    fdSocksProxyHost.top = new FormAttachment(wName, margin);
    fdSocksProxyHost.right = new FormAttachment(100, margin);
    wSocksProxyHost.setLayoutData(fdSocksProxyHost);
    // port line
    wSocksProxyPort = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPort.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPort.Tooltip"), false, false);
    props.setLook(wSocksProxyPort);
    wSocksProxyPort.addModifyListener(lsMod);
    FormData fdSocksProxyPort = new FormData();
    fdSocksProxyPort.left = new FormAttachment(0, 0);
    fdSocksProxyPort.top = new FormAttachment(wSocksProxyHost, margin);
    fdSocksProxyPort.right = new FormAttachment(100, margin);
    wSocksProxyPort.setLayoutData(fdSocksProxyPort);
    // username line
    wSocksProxyUsername = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPassword.Tooltip"), false, false);
    props.setLook(wSocksProxyUsername);
    wSocksProxyUsername.addModifyListener(lsMod);
    FormData fdSocksProxyUsername = new FormData();
    fdSocksProxyUsername.left = new FormAttachment(0, 0);
    fdSocksProxyUsername.top = new FormAttachment(wSocksProxyPort, margin);
    fdSocksProxyUsername.right = new FormAttachment(100, margin);
    wSocksProxyUsername.setLayoutData(fdSocksProxyUsername);
    // password line
    wSocksProxyPassword = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPassword.Tooltip"), true, false);
    props.setLook(wSocksProxyPort);
    wSocksProxyPassword.addModifyListener(lsMod);
    FormData fdSocksProxyPassword = new FormData();
    fdSocksProxyPassword.left = new FormAttachment(0, 0);
    fdSocksProxyPassword.top = new FormAttachment(wSocksProxyUsername, margin);
    fdSocksProxyPassword.right = new FormAttachment(100, margin);
    wSocksProxyPassword.setLayoutData(fdSocksProxyPassword);
    // ///////////////////////////////////////////////////////////////
    // End of socks proxy group
    // ///////////////////////////////////////////////////////////////
    FormData fdSocksProxyComp = new FormData();
    fdSocksProxyComp.left = new FormAttachment(0, margin);
    fdSocksProxyComp.top = new FormAttachment(0, margin);
    fdSocksProxyComp.right = new FormAttachment(100, -margin);
    wSocksProxy.setLayoutData(fdSocksProxyComp);
    wSocksProxyComp.layout();
    wSocksProxyTab.setControl(wSocksProxyComp);
    props.setLook(wSocksProxyComp);
    // ////////////////////////////////////////////////////////
    // End of Socks Proxy Tab
    // ////////////////////////////////////////////////////////
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
    wTabFolder.setLayoutData(fdTabFolder);
    getData();
    wTabFolder.setSelection(0);
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return action;
}
Also used : Utils(org.apache.hop.core.util.Utils) IVariables(org.apache.hop.core.variables.IVariables) IActionDialog(org.apache.hop.workflow.action.IActionDialog) Props(org.apache.hop.core.Props) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) FTPClient(org.apache.commons.net.ftp.FTPClient) WindowProperty(org.apache.hop.ui.core.gui.WindowProperty) ActionDialog(org.apache.hop.ui.workflow.action.ActionDialog) BaseMessages(org.apache.hop.i18n.BaseMessages) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) FormLayout(org.eclipse.swt.layout.FormLayout) WorkflowDialog(org.apache.hop.ui.workflow.dialog.WorkflowDialog) BaseDialog(org.apache.hop.ui.core.dialog.BaseDialog) FormData(org.eclipse.swt.layout.FormData) org.eclipse.swt.widgets(org.eclipse.swt.widgets) LabelTextVar(org.apache.hop.ui.core.widget.LabelTextVar) FtpClientUtil(org.apache.hop.workflow.actions.util.FtpClientUtil) FormAttachment(org.eclipse.swt.layout.FormAttachment) Const(org.apache.hop.core.Const) LogChannel(org.apache.hop.core.logging.LogChannel) CTabItem(org.eclipse.swt.custom.CTabItem) TextVar(org.apache.hop.ui.core.widget.TextVar) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) IAction(org.apache.hop.workflow.action.IAction) BaseTransformDialog(org.apache.hop.ui.pipeline.transform.BaseTransformDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CTabFolder(org.eclipse.swt.custom.CTabFolder) ModifyListener(org.eclipse.swt.events.ModifyListener) CTabItem(org.eclipse.swt.custom.CTabItem) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) LabelTextVar(org.apache.hop.ui.core.widget.LabelTextVar) TextVar(org.apache.hop.ui.core.widget.TextVar) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) LabelTextVar(org.apache.hop.ui.core.widget.LabelTextVar) FormAttachment(org.eclipse.swt.layout.FormAttachment)

Example 3 with PasswordTextVar

use of org.apache.hop.ui.core.widget.PasswordTextVar in project hop by apache.

the class ActionGetPOPDialog method open.

@Override
public IAction open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
    props.setLook(shell);
    WorkflowDialog.setShellImage(shell, action);
    ModifyListener lsMod = e -> {
        closeMailConnection();
        action.setChanged();
    };
    SelectionListener lsSelection = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            action.setChanged();
            closeMailConnection();
        }
    };
    changed = action.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "ActionGetPOP.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Buttons go at the very bottom
    // 
    Button wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    Button wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
    // Filename line
    Label wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "ActionGetPOP.Name.Label"));
    props.setLook(wlName);
    FormData fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    FormData fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "ActionGetPOP.Tab.General.Label"));
    Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    Group wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "ActionGetPOP.ServerSettings.Group.Label"));
    FormLayout serverSettingsgroupLayout = new FormLayout();
    serverSettingsgroupLayout.marginWidth = 10;
    serverSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(serverSettingsgroupLayout);
    // ServerName line
    Label wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "ActionGetPOP.Server.Label"));
    props.setLook(wlServerName);
    FormData fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(0, 2 * margin);
    fdlServerName.right = new FormAttachment(middle, -margin);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    FormData fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, 0);
    fdServerName.top = new FormAttachment(0, 2 * margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // USE connection with SSL
    Label wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
    wlUseSSL.setText(BaseMessages.getString(PKG, "ActionGetPOP.UseSSLMails.Label"));
    props.setLook(wlUseSSL);
    FormData fdlUseSSL = new FormData();
    fdlUseSSL.left = new FormAttachment(0, 0);
    fdlUseSSL.top = new FormAttachment(wServerName, margin);
    fdlUseSSL.right = new FormAttachment(middle, -margin);
    wlUseSSL.setLayoutData(fdlUseSSL);
    wUseSSL = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseSSL);
    FormData fdUseSSL = new FormData();
    wUseSSL.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.UseSSLMails.Tooltip"));
    fdUseSSL.left = new FormAttachment(middle, 0);
    fdUseSSL.top = new FormAttachment(wlUseSSL, 0, SWT.CENTER);
    fdUseSSL.right = new FormAttachment(100, 0);
    wUseSSL.setLayoutData(fdUseSSL);
    wUseSSL.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            closeMailConnection();
            refreshPort(true);
        }
    });
    // port
    Label wlPort = new Label(wServerSettings, SWT.RIGHT);
    wlPort.setText(BaseMessages.getString(PKG, "ActionGetPOP.SSLPort.Label"));
    props.setLook(wlPort);
    FormData fdlPort = new FormData();
    fdlPort.left = new FormAttachment(0, 0);
    fdlPort.top = new FormAttachment(wlUseSSL, 2 * margin);
    fdlPort.right = new FormAttachment(middle, -margin);
    wlPort.setLayoutData(fdlPort);
    wPort = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPort);
    wPort.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.SSLPort.Tooltip"));
    wPort.addModifyListener(lsMod);
    FormData fdPort = new FormData();
    fdPort.left = new FormAttachment(middle, 0);
    fdPort.top = new FormAttachment(wlPort, 0, SWT.CENTER);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // UserName line
    Label wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "ActionGetPOP.Username.Label"));
    props.setLook(wlUserName);
    FormData fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wPort, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.Username.Tooltip"));
    wUserName.addModifyListener(lsMod);
    FormData fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    Label wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "ActionGetPOP.Password.Label"));
    props.setLook(wlPassword);
    FormData fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wUserName, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    FormData fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // USE proxy
    Label wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
    wlUseProxy.setText(BaseMessages.getString(PKG, "ActionGetPOP.UseProxyMails.Label"));
    props.setLook(wlUseProxy);
    FormData fdlUseProxy = new FormData();
    fdlUseProxy.left = new FormAttachment(0, 0);
    fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
    fdlUseProxy.right = new FormAttachment(middle, -margin);
    wlUseProxy.setLayoutData(fdlUseProxy);
    wUseProxy = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseProxy);
    FormData fdUseProxy = new FormData();
    wUseProxy.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.UseProxyMails.Tooltip"));
    fdUseProxy.left = new FormAttachment(middle, 0);
    fdUseProxy.top = new FormAttachment(wlUseProxy, 0, SWT.CENTER);
    fdUseProxy.right = new FormAttachment(100, 0);
    wUseProxy.setLayoutData(fdUseProxy);
    wUseProxy.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setUserProxy();
            action.setChanged();
        }
    });
    // ProxyUsername line
    wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
    wlProxyUsername.setText(BaseMessages.getString(PKG, "ActionGetPOP.ProxyUsername.Label"));
    props.setLook(wlProxyUsername);
    FormData fdlProxyUsername = new FormData();
    fdlProxyUsername.left = new FormAttachment(0, 0);
    fdlProxyUsername.top = new FormAttachment(wlUseProxy, 2 * margin);
    fdlProxyUsername.right = new FormAttachment(middle, -margin);
    wlProxyUsername.setLayoutData(fdlProxyUsername);
    wProxyUsername = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wProxyUsername);
    wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.ProxyUsername.Tooltip"));
    wProxyUsername.addModifyListener(lsMod);
    FormData fdProxyUsername = new FormData();
    fdProxyUsername.left = new FormAttachment(middle, 0);
    fdProxyUsername.top = new FormAttachment(wlProxyUsername, 0, SWT.CENTER);
    fdProxyUsername.right = new FormAttachment(100, 0);
    wProxyUsername.setLayoutData(fdProxyUsername);
    // Protocol
    Label wlProtocol = new Label(wServerSettings, SWT.RIGHT);
    wlProtocol.setText(BaseMessages.getString(PKG, "ActionGetPOP.Protocol.Label"));
    props.setLook(wlProtocol);
    FormData fdlProtocol = new FormData();
    fdlProtocol.left = new FormAttachment(0, 0);
    fdlProtocol.right = new FormAttachment(middle, -margin);
    fdlProtocol.top = new FormAttachment(wProxyUsername, margin);
    wlProtocol.setLayoutData(fdlProtocol);
    wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProtocol.setItems(MailConnectionMeta.protocolCodes);
    wProtocol.select(0);
    props.setLook(wProtocol);
    FormData fdProtocol = new FormData();
    fdProtocol.left = new FormAttachment(middle, 0);
    fdProtocol.top = new FormAttachment(wProxyUsername, margin);
    fdProtocol.right = new FormAttachment(100, 0);
    wProtocol.setLayoutData(fdProtocol);
    wProtocol.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refreshProtocol(true);
        }
    });
    // Test connection button
    Button wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "ActionGetPOP.TestConnection.Label"));
    props.setLook(wTest);
    FormData fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProtocol, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    wTest.addListener(SWT.Selection, e -> test());
    FormData fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wProtocol, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Target Folder GROUP///
    // /
    Group wTargetFolder = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wTargetFolder);
    wTargetFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.TargetFolder.Group.Label"));
    FormLayout targetFoldergroupLayout = new FormLayout();
    targetFoldergroupLayout.marginWidth = 10;
    targetFoldergroupLayout.marginHeight = 10;
    wTargetFolder.setLayout(targetFoldergroupLayout);
    // OutputDirectory line
    wlOutputDirectory = new Label(wTargetFolder, SWT.RIGHT);
    wlOutputDirectory.setText(BaseMessages.getString(PKG, "ActionGetPOP.OutputDirectory.Label"));
    props.setLook(wlOutputDirectory);
    FormData fdlOutputDirectory = new FormData();
    fdlOutputDirectory.left = new FormAttachment(0, 0);
    fdlOutputDirectory.top = new FormAttachment(wServerSettings, margin);
    fdlOutputDirectory.right = new FormAttachment(middle, -margin);
    wlOutputDirectory.setLayoutData(fdlOutputDirectory);
    // Browse Source folders button ...
    wbDirectory = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
    props.setLook(wbDirectory);
    wbDirectory.setText(BaseMessages.getString(PKG, "ActionGetPOP.BrowseFolders.Label"));
    FormData fdbDirectory = new FormData();
    fdbDirectory.right = new FormAttachment(100, -margin);
    fdbDirectory.top = new FormAttachment(wServerSettings, margin);
    wbDirectory.setLayoutData(fdbDirectory);
    wbDirectory.addListener(SWT.Selection, e -> BaseDialog.presentDirectoryDialog(shell, wOutputDirectory, variables));
    wOutputDirectory = new TextVar(variables, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wOutputDirectory);
    wOutputDirectory.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.OutputDirectory.Tooltip"));
    wOutputDirectory.addModifyListener(lsMod);
    FormData fdOutputDirectory = new FormData();
    fdOutputDirectory.left = new FormAttachment(middle, 0);
    fdOutputDirectory.top = new FormAttachment(wServerSettings, margin);
    fdOutputDirectory.right = new FormAttachment(wbDirectory, -margin);
    wOutputDirectory.setLayoutData(fdOutputDirectory);
    // Create local folder
    wlCreateLocalFolder = new Label(wTargetFolder, SWT.RIGHT);
    wlCreateLocalFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.createLocalFolder.Label"));
    props.setLook(wlCreateLocalFolder);
    FormData fdlCreateLocalFolder = new FormData();
    fdlCreateLocalFolder.left = new FormAttachment(0, 0);
    fdlCreateLocalFolder.top = new FormAttachment(wOutputDirectory, margin);
    fdlCreateLocalFolder.right = new FormAttachment(middle, -margin);
    wlCreateLocalFolder.setLayoutData(fdlCreateLocalFolder);
    wCreateLocalFolder = new Button(wTargetFolder, SWT.CHECK);
    props.setLook(wCreateLocalFolder);
    FormData fdCreateLocalFolder = new FormData();
    wCreateLocalFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.createLocalFolder.Tooltip"));
    fdCreateLocalFolder.left = new FormAttachment(middle, 0);
    fdCreateLocalFolder.top = new FormAttachment(wlCreateLocalFolder, 0, SWT.CENTER);
    fdCreateLocalFolder.right = new FormAttachment(100, 0);
    wCreateLocalFolder.setLayoutData(fdCreateLocalFolder);
    // Filename pattern line
    wlFilenamePattern = new Label(wTargetFolder, SWT.RIGHT);
    wlFilenamePattern.setText(BaseMessages.getString(PKG, "ActionGetPOP.FilenamePattern.Label"));
    props.setLook(wlFilenamePattern);
    FormData fdlFilenamePattern = new FormData();
    fdlFilenamePattern.left = new FormAttachment(0, 0);
    fdlFilenamePattern.top = new FormAttachment(wlCreateLocalFolder, 2 * margin);
    fdlFilenamePattern.right = new FormAttachment(middle, -margin);
    wlFilenamePattern.setLayoutData(fdlFilenamePattern);
    wFilenamePattern = new TextVar(variables, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFilenamePattern);
    wFilenamePattern.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.FilenamePattern.Tooltip"));
    wFilenamePattern.addModifyListener(lsMod);
    FormData fdFilenamePattern = new FormData();
    fdFilenamePattern.left = new FormAttachment(middle, 0);
    fdFilenamePattern.top = new FormAttachment(wlCreateLocalFolder, 2 * margin);
    fdFilenamePattern.right = new FormAttachment(100, 0);
    wFilenamePattern.setLayoutData(fdFilenamePattern);
    // Whenever something changes, set the tooltip to the expanded version:
    wFilenamePattern.addModifyListener(e -> wFilenamePattern.setToolTipText(variables.resolve(wFilenamePattern.getText())));
    // Get message?
    wlGetMessage = new Label(wTargetFolder, SWT.RIGHT);
    wlGetMessage.setText(BaseMessages.getString(PKG, "ActionGetPOP.GetMessageMails.Label"));
    props.setLook(wlGetMessage);
    FormData fdlGetMessage = new FormData();
    fdlGetMessage.left = new FormAttachment(0, 0);
    fdlGetMessage.top = new FormAttachment(wFilenamePattern, margin);
    fdlGetMessage.right = new FormAttachment(middle, -margin);
    wlGetMessage.setLayoutData(fdlGetMessage);
    wGetMessage = new Button(wTargetFolder, SWT.CHECK);
    props.setLook(wGetMessage);
    FormData fdGetMessage = new FormData();
    wGetMessage.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.GetMessageMails.Tooltip"));
    fdGetMessage.left = new FormAttachment(middle, 0);
    fdGetMessage.top = new FormAttachment(wlGetMessage, 0, SWT.CENTER);
    fdGetMessage.right = new FormAttachment(100, 0);
    wGetMessage.setLayoutData(fdGetMessage);
    wGetMessage.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (!wGetAttachment.getSelection() && !wGetMessage.getSelection()) {
                wGetAttachment.setSelection(true);
            }
        }
    });
    // Get attachment?
    wlGetAttachment = new Label(wTargetFolder, SWT.RIGHT);
    wlGetAttachment.setText(BaseMessages.getString(PKG, "ActionGetPOP.GetAttachmentMails.Label"));
    props.setLook(wlGetAttachment);
    FormData fdlGetAttachment = new FormData();
    fdlGetAttachment.left = new FormAttachment(0, 0);
    fdlGetAttachment.top = new FormAttachment(wlGetMessage, 2 * margin);
    fdlGetAttachment.right = new FormAttachment(middle, -margin);
    wlGetAttachment.setLayoutData(fdlGetAttachment);
    wGetAttachment = new Button(wTargetFolder, SWT.CHECK);
    props.setLook(wGetAttachment);
    FormData fdGetAttachment = new FormData();
    wGetAttachment.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.GetAttachmentMails.Tooltip"));
    fdGetAttachment.left = new FormAttachment(middle, 0);
    fdGetAttachment.top = new FormAttachment(wlGetAttachment, 0, SWT.CENTER);
    fdGetAttachment.right = new FormAttachment(100, 0);
    wGetAttachment.setLayoutData(fdGetAttachment);
    wGetAttachment.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            activeAttachmentFolder();
        }
    });
    // different folder for attachment?
    wlDifferentFolderForAttachment = new Label(wTargetFolder, SWT.RIGHT);
    wlDifferentFolderForAttachment.setText(BaseMessages.getString(PKG, "ActionGetPOP.DifferentFolderForAttachmentMails.Label"));
    props.setLook(wlDifferentFolderForAttachment);
    FormData fdlDifferentFolderForAttachment = new FormData();
    fdlDifferentFolderForAttachment.left = new FormAttachment(0, 0);
    fdlDifferentFolderForAttachment.top = new FormAttachment(wlGetAttachment, 2 * margin);
    fdlDifferentFolderForAttachment.right = new FormAttachment(middle, -margin);
    wlDifferentFolderForAttachment.setLayoutData(fdlDifferentFolderForAttachment);
    wDifferentFolderForAttachment = new Button(wTargetFolder, SWT.CHECK);
    props.setLook(wDifferentFolderForAttachment);
    FormData fdDifferentFolderForAttachment = new FormData();
    wDifferentFolderForAttachment.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.DifferentFolderForAttachmentMails.Tooltip"));
    fdDifferentFolderForAttachment.left = new FormAttachment(middle, 0);
    fdDifferentFolderForAttachment.top = new FormAttachment(wlDifferentFolderForAttachment, 0, SWT.CENTER);
    fdDifferentFolderForAttachment.right = new FormAttachment(100, 0);
    wDifferentFolderForAttachment.setLayoutData(fdDifferentFolderForAttachment);
    wDifferentFolderForAttachment.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            activeAttachmentFolder();
        }
    });
    // AttachmentFolder line
    wlAttachmentFolder = new Label(wTargetFolder, SWT.RIGHT);
    wlAttachmentFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.AttachmentFolder.Label"));
    props.setLook(wlAttachmentFolder);
    FormData fdlAttachmentFolder = new FormData();
    fdlAttachmentFolder.left = new FormAttachment(0, 0);
    fdlAttachmentFolder.top = new FormAttachment(wlDifferentFolderForAttachment, 2 * margin);
    fdlAttachmentFolder.right = new FormAttachment(middle, -margin);
    wlAttachmentFolder.setLayoutData(fdlAttachmentFolder);
    // Browse Source folders button ...
    wbAttachmentFolder = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
    props.setLook(wbAttachmentFolder);
    wbAttachmentFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.BrowseFolders.Label"));
    FormData fdbAttachmentFolder = new FormData();
    fdbAttachmentFolder.right = new FormAttachment(100, -margin);
    fdbAttachmentFolder.top = new FormAttachment(wlAttachmentFolder, 0, SWT.CENTER);
    wbAttachmentFolder.setLayoutData(fdbAttachmentFolder);
    wbAttachmentFolder.addListener(SWT.Selection, e -> BaseDialog.presentDirectoryDialog(shell, wAttachmentFolder, variables));
    wAttachmentFolder = new TextVar(variables, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wAttachmentFolder);
    wAttachmentFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.AttachmentFolder.Tooltip"));
    wAttachmentFolder.addModifyListener(lsMod);
    FormData fdAttachmentFolder = new FormData();
    fdAttachmentFolder.left = new FormAttachment(middle, 0);
    fdAttachmentFolder.top = new FormAttachment(wlAttachmentFolder, 0, SWT.CENTER);
    fdAttachmentFolder.right = new FormAttachment(wbAttachmentFolder, -margin);
    wAttachmentFolder.setLayoutData(fdAttachmentFolder);
    // Limit attached files
    wlAttachmentWildcard = new Label(wTargetFolder, SWT.RIGHT);
    wlAttachmentWildcard.setText(BaseMessages.getString(PKG, "ActionGetPOP.AttachmentWildcard.Label"));
    props.setLook(wlAttachmentWildcard);
    FormData fdlAttachmentWildcard = new FormData();
    fdlAttachmentWildcard.left = new FormAttachment(0, 0);
    fdlAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
    fdlAttachmentWildcard.right = new FormAttachment(middle, -margin);
    wlAttachmentWildcard.setLayoutData(fdlAttachmentWildcard);
    wAttachmentWildcard = new TextVar(variables, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wAttachmentWildcard);
    wAttachmentWildcard.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.AttachmentWildcard.Tooltip"));
    wAttachmentWildcard.addModifyListener(lsMod);
    FormData fdAttachmentWildcard = new FormData();
    fdAttachmentWildcard.left = new FormAttachment(middle, 0);
    fdAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
    fdAttachmentWildcard.right = new FormAttachment(100, 0);
    wAttachmentWildcard.setLayoutData(fdAttachmentWildcard);
    // Whenever something changes, set the tooltip to the expanded version:
    wAttachmentWildcard.addModifyListener(e -> wAttachmentWildcard.setToolTipText(variables.resolve(wAttachmentWildcard.getText())));
    FormData fdTargetFolder = new FormData();
    fdTargetFolder.left = new FormAttachment(0, margin);
    fdTargetFolder.top = new FormAttachment(wServerSettings, margin);
    fdTargetFolder.right = new FormAttachment(100, -margin);
    wTargetFolder.setLayoutData(fdTargetFolder);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wName, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF SETTINGS TAB ///
    // ////////////////////////
    CTabItem wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
    wSettingsTab.setText(BaseMessages.getString(PKG, "ActionGetPOP.Tab.Pop.Label"));
    Composite wSettingsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSettingsComp);
    FormLayout popLayout = new FormLayout();
    popLayout.marginWidth = 3;
    popLayout.marginHeight = 3;
    wSettingsComp.setLayout(popLayout);
    // Action type
    Label wlActionType = new Label(wSettingsComp, SWT.RIGHT);
    wlActionType.setText(BaseMessages.getString(PKG, "ActionGetPOP.ActionType.Label"));
    props.setLook(wlActionType);
    FormData fdlActionType = new FormData();
    fdlActionType.left = new FormAttachment(0, 0);
    fdlActionType.right = new FormAttachment(middle, -margin);
    fdlActionType.top = new FormAttachment(0, 3 * margin);
    wlActionType.setLayoutData(fdlActionType);
    wActionType = new CCombo(wSettingsComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wActionType.setItems(MailConnectionMeta.actionTypeDesc);
    // +1: starts at -1
    wActionType.select(0);
    props.setLook(wActionType);
    FormData fdActionType = new FormData();
    fdActionType.left = new FormAttachment(middle, 0);
    fdActionType.top = new FormAttachment(0, 3 * margin);
    fdActionType.right = new FormAttachment(100, 0);
    wActionType.setLayoutData(fdActionType);
    wActionType.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setActionType();
            action.setChanged();
        }
    });
    // Message: for POP3, only INBOX folder is available!
    wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
    wlPOP3Message.setText(BaseMessages.getString(PKG, "ActionGetPOP.POP3Message.Label"));
    props.setLook(wlPOP3Message);
    FormData fdlPOP3Message = new FormData();
    fdlPOP3Message.left = new FormAttachment(0, margin);
    fdlPOP3Message.top = new FormAttachment(wActionType, 3 * margin);
    wlPOP3Message.setLayoutData(fdlPOP3Message);
    wlPOP3Message.setForeground(GuiResource.getInstance().getColorOrange());
    // ////////////////////////
    // START OF POP3 Settings GROUP///
    // /
    Group wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wPOP3Settings);
    wPOP3Settings.setText(BaseMessages.getString(PKG, "ActionGetPOP.POP3Settings.Group.Label"));
    FormLayout pop3Settingsgrouplayout = new FormLayout();
    pop3Settingsgrouplayout.marginWidth = 10;
    pop3Settingsgrouplayout.marginHeight = 10;
    wPOP3Settings.setLayout(pop3Settingsgrouplayout);
    // List of mails of retrieve
    wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlListmails.setText(BaseMessages.getString(PKG, "ActionGetPOP.Listmails.Label"));
    props.setLook(wlListmails);
    FormData fdlListmails = new FormData();
    fdlListmails.left = new FormAttachment(0, 0);
    fdlListmails.right = new FormAttachment(middle, 0);
    fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    wlListmails.setLayoutData(fdlListmails);
    wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wListmails.add(BaseMessages.getString(PKG, "ActionGetPOP.RetrieveAllMails.Label"));
    wListmails.add(BaseMessages.getString(PKG, "ActionGetPOP.RetrieveFirstMails.Label"));
    // +1: starts at -1
    wListmails.select(0);
    props.setLook(wListmails);
    FormData fdListmails = new FormData();
    fdListmails.left = new FormAttachment(middle, 0);
    fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdListmails.right = new FormAttachment(100, 0);
    wListmails.setLayoutData(fdListmails);
    wListmails.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            action.setChanged();
            chooseListMails();
        }
    });
    // Retrieve the first ... mails
    wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlFirstmails.setText(BaseMessages.getString(PKG, "ActionGetPOP.Firstmails.Label"));
    props.setLook(wlFirstmails);
    FormData fdlFirstmails = new FormData();
    fdlFirstmails.left = new FormAttachment(0, 0);
    fdlFirstmails.right = new FormAttachment(middle, -margin);
    fdlFirstmails.top = new FormAttachment(wListmails, margin);
    wlFirstmails.setLayoutData(fdlFirstmails);
    wFirstmails = new TextVar(variables, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFirstmails);
    wFirstmails.addModifyListener(lsMod);
    FormData fdFirstmails = new FormData();
    fdFirstmails.left = new FormAttachment(middle, 0);
    fdFirstmails.top = new FormAttachment(wListmails, margin);
    fdFirstmails.right = new FormAttachment(100, 0);
    wFirstmails.setLayoutData(fdFirstmails);
    // Delete mails after retrieval...
    wlDelete = new Label(wPOP3Settings, SWT.RIGHT);
    wlDelete.setText(BaseMessages.getString(PKG, "ActionGetPOP.DeleteMails.Label"));
    props.setLook(wlDelete);
    FormData fdlDelete = new FormData();
    fdlDelete.left = new FormAttachment(0, 0);
    fdlDelete.top = new FormAttachment(wFirstmails, margin);
    fdlDelete.right = new FormAttachment(middle, -margin);
    wlDelete.setLayoutData(fdlDelete);
    wDelete = new Button(wPOP3Settings, SWT.CHECK);
    props.setLook(wDelete);
    FormData fdDelete = new FormData();
    wDelete.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.DeleteMails.Tooltip"));
    fdDelete.left = new FormAttachment(middle, 0);
    fdDelete.top = new FormAttachment(wlDelete, 0, SWT.CENTER);
    fdDelete.right = new FormAttachment(100, 0);
    wDelete.setLayoutData(fdDelete);
    FormData fdPOP3Settings = new FormData();
    fdPOP3Settings.left = new FormAttachment(0, margin);
    fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdPOP3Settings.right = new FormAttachment(100, -margin);
    wPOP3Settings.setLayoutData(fdPOP3Settings);
    // ///////////////////////////////////////////////////////////
    // / END OF POP3 SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF IMAP Settings GROUP///
    // /
    Group wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wIMAPSettings);
    wIMAPSettings.setText(BaseMessages.getString(PKG, "ActionGetPOP.IMAPSettings.Groupp.Label"));
    FormLayout imapSettingsgroupLayout = new FormLayout();
    imapSettingsgroupLayout.marginWidth = 10;
    imapSettingsgroupLayout.marginHeight = 10;
    wIMAPSettings.setLayout(imapSettingsgroupLayout);
    // SelectFolder button
    wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
    wSelectFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.SelectFolderConnection.Label"));
    props.setLook(wSelectFolder);
    FormData fdSelectFolder = new FormData();
    wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.SelectFolderConnection.Tooltip"));
    fdSelectFolder.top = new FormAttachment(wPOP3Settings, margin);
    fdSelectFolder.right = new FormAttachment(100, 0);
    wSelectFolder.setLayoutData(fdSelectFolder);
    wSelectFolder.addListener(SWT.Selection, e -> selectFolder(wIMAPFolder));
    // TestIMAPFolder button
    wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
    wTestIMAPFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.TestIMAPFolderConnection.Label"));
    props.setLook(wTestIMAPFolder);
    FormData fdTestIMAPFolder = new FormData();
    wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.TestIMAPFolderConnection.Tooltip"));
    fdTestIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
    fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
    wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
    wTestIMAPFolder.addListener(SWT.Selection, e -> checkFolder(variables.resolve(wIMAPFolder.getText())));
    // IMAPFolder line
    wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.IMAPFolder.Label"));
    props.setLook(wlIMAPFolder);
    FormData fdlIMAPFolder = new FormData();
    fdlIMAPFolder.left = new FormAttachment(0, 0);
    fdlIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
    fdlIMAPFolder.right = new FormAttachment(middle, -margin);
    wlIMAPFolder.setLayoutData(fdlIMAPFolder);
    wIMAPFolder = new TextVar(variables, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFolder);
    wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.IMAPFolder.Tooltip"));
    wIMAPFolder.addModifyListener(lsMod);
    FormData fdIMAPFolder = new FormData();
    fdIMAPFolder.left = new FormAttachment(middle, 0);
    fdIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
    fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
    wIMAPFolder.setLayoutData(fdIMAPFolder);
    // Include subfolders?
    wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
    wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "ActionGetPOP.IncludeSubFoldersMails.Label"));
    props.setLook(wlIncludeSubFolders);
    FormData fdlIncludeSubFolders = new FormData();
    fdlIncludeSubFolders.left = new FormAttachment(0, 0);
    fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
    fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
    wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
    wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wIncludeSubFolders);
    FormData fdIncludeSubFolders = new FormData();
    wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.IncludeSubFoldersMails.Tooltip"));
    fdIncludeSubFolders.left = new FormAttachment(middle, 0);
    fdIncludeSubFolders.top = new FormAttachment(wlIncludeSubFolders, 0, SWT.CENTER);
    fdIncludeSubFolders.right = new FormAttachment(100, 0);
    wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
    wIncludeSubFolders.addSelectionListener(lsSelection);
    // List of mails of retrieve
    wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPListmails.setText(BaseMessages.getString(PKG, "ActionGetPOP.IMAPListmails.Label"));
    props.setLook(wlIMAPListmails);
    FormData fdlIMAPListmails = new FormData();
    fdlIMAPListmails.left = new FormAttachment(0, 0);
    fdlIMAPListmails.right = new FormAttachment(middle, -margin);
    fdlIMAPListmails.top = new FormAttachment(wlIncludeSubFolders, 2 * margin);
    wlIMAPListmails.setLayoutData(fdlIMAPListmails);
    wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
    // +1: starts at -1
    wIMAPListmails.select(0);
    props.setLook(wIMAPListmails);
    FormData fdIMAPListmails = new FormData();
    fdIMAPListmails.left = new FormAttachment(middle, 0);
    fdIMAPListmails.top = new FormAttachment(wlIncludeSubFolders, 2 * margin);
    fdIMAPListmails.right = new FormAttachment(100, 0);
    wIMAPListmails.setLayoutData(fdIMAPListmails);
    wIMAPListmails.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
        // disalbe selection event
        }
    });
    // Retrieve the first ... mails
    wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "ActionGetPOP.IMAPFirstmails.Label"));
    props.setLook(wlIMAPFirstmails);
    FormData fdlIMAPFirstmails = new FormData();
    fdlIMAPFirstmails.left = new FormAttachment(0, 0);
    fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
    fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
    wIMAPFirstmails = new TextVar(variables, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFirstmails);
    wIMAPFirstmails.addModifyListener(lsMod);
    FormData fdIMAPFirstmails = new FormData();
    fdIMAPFirstmails.left = new FormAttachment(middle, 0);
    fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    fdIMAPFirstmails.right = new FormAttachment(100, 0);
    wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
    // After get IMAP
    wlAfterGetIMAP = new Label(wIMAPSettings, SWT.RIGHT);
    wlAfterGetIMAP.setText(BaseMessages.getString(PKG, "ActionGetPOP.AfterGetIMAP.Label"));
    props.setLook(wlAfterGetIMAP);
    FormData fdlAfterGetIMAP = new FormData();
    fdlAfterGetIMAP.left = new FormAttachment(0, 0);
    fdlAfterGetIMAP.right = new FormAttachment(middle, -margin);
    fdlAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
    wlAfterGetIMAP.setLayoutData(fdlAfterGetIMAP);
    wAfterGetIMAP = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wAfterGetIMAP.setItems(MailConnectionMeta.afterGetIMAPDesc);
    // +1: starts at -1
    wAfterGetIMAP.select(0);
    props.setLook(wAfterGetIMAP);
    FormData fdAfterGetIMAP = new FormData();
    fdAfterGetIMAP.left = new FormAttachment(middle, 0);
    fdAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
    fdAfterGetIMAP.right = new FormAttachment(100, 0);
    wAfterGetIMAP.setLayoutData(fdAfterGetIMAP);
    wAfterGetIMAP.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setAfterIMAPRetrived();
            action.setChanged();
        }
    });
    // MoveToFolder line
    wlMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wlMoveToFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.MoveToFolder.Label"));
    props.setLook(wlMoveToFolder);
    FormData fdlMoveToFolder = new FormData();
    fdlMoveToFolder.left = new FormAttachment(0, 0);
    fdlMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
    fdlMoveToFolder.right = new FormAttachment(middle, -margin);
    wlMoveToFolder.setLayoutData(fdlMoveToFolder);
    // SelectMoveToFolder button
    wSelectMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
    wSelectMoveToFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.SelectMoveToFolderConnection.Label"));
    props.setLook(wSelectMoveToFolder);
    FormData fdSelectMoveToFolder = new FormData();
    wSelectMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.SelectMoveToFolderConnection.Tooltip"));
    fdSelectMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
    fdSelectMoveToFolder.right = new FormAttachment(100, 0);
    wSelectMoveToFolder.setLayoutData(fdSelectMoveToFolder);
    wSelectMoveToFolder.addListener(SWT.Selection, e -> selectFolder(wMoveToFolder));
    // TestMoveToFolder button
    wTestMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
    wTestMoveToFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.TestMoveToFolderConnection.Label"));
    props.setLook(wTestMoveToFolder);
    FormData fdTestMoveToFolder = new FormData();
    wTestMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.TestMoveToFolderConnection.Tooltip"));
    fdTestMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
    fdTestMoveToFolder.right = new FormAttachment(wSelectMoveToFolder, -margin);
    wTestMoveToFolder.setLayoutData(fdTestMoveToFolder);
    wTestMoveToFolder.addListener(SWT.Selection, e -> checkFolder(variables.resolve(wMoveToFolder.getText())));
    wMoveToFolder = new TextVar(variables, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wMoveToFolder);
    wMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.MoveToFolder.Tooltip"));
    wMoveToFolder.addModifyListener(lsMod);
    FormData fdMoveToFolder = new FormData();
    fdMoveToFolder.left = new FormAttachment(middle, 0);
    fdMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
    fdMoveToFolder.right = new FormAttachment(wTestMoveToFolder, -margin);
    wMoveToFolder.setLayoutData(fdMoveToFolder);
    // Create move to folder
    wlCreateMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wlCreateMoveToFolder.setText(BaseMessages.getString(PKG, "ActionGetPOP.createMoveToFolderMails.Label"));
    props.setLook(wlCreateMoveToFolder);
    FormData fdlCreateMoveToFolder = new FormData();
    fdlCreateMoveToFolder.left = new FormAttachment(0, 0);
    fdlCreateMoveToFolder.top = new FormAttachment(wMoveToFolder, margin);
    fdlCreateMoveToFolder.right = new FormAttachment(middle, -margin);
    wlCreateMoveToFolder.setLayoutData(fdlCreateMoveToFolder);
    wCreateMoveToFolder = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wCreateMoveToFolder);
    FormData fdCreateMoveToFolder = new FormData();
    wCreateMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.createMoveToFolderMails.Tooltip"));
    fdCreateMoveToFolder.left = new FormAttachment(middle, 0);
    fdCreateMoveToFolder.top = new FormAttachment(wlCreateMoveToFolder, 0, SWT.CENTER);
    fdCreateMoveToFolder.right = new FormAttachment(100, 0);
    wCreateMoveToFolder.setLayoutData(fdCreateMoveToFolder);
    FormData fdIMAPSettings = new FormData();
    fdIMAPSettings.left = new FormAttachment(0, margin);
    fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
    fdIMAPSettings.right = new FormAttachment(100, -margin);
    wIMAPSettings.setLayoutData(fdIMAPSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF IMAP SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdSettingsComp = new FormData();
    fdSettingsComp.left = new FormAttachment(0, 0);
    fdSettingsComp.top = new FormAttachment(wName, 0);
    fdSettingsComp.right = new FormAttachment(100, 0);
    fdSettingsComp.bottom = new FormAttachment(100, 0);
    wSettingsComp.setLayoutData(fdSettingsComp);
    wSettingsComp.layout();
    wSettingsTab.setControl(wSettingsComp);
    props.setLook(wSettingsComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Pop TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF SEARCH TAB ///
    // ////////////////////////
    CTabItem wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
    wSearchTab.setText(BaseMessages.getString(PKG, "ActionGetPOP.Tab.Search.Label"));
    Composite wSearchComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSearchComp);
    FormLayout searchLayout = new FormLayout();
    searchLayout.marginWidth = 3;
    searchLayout.marginHeight = 3;
    wSearchComp.setLayout(searchLayout);
    // ////////////////////////
    // START OF HEADER ROUP///
    // /
    Group wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wHeader);
    wHeader.setText(BaseMessages.getString(PKG, "ActionGetPOP.Header.Group.Label"));
    FormLayout headergroupLayout = new FormLayout();
    headergroupLayout.marginWidth = 10;
    headergroupLayout.marginHeight = 10;
    wHeader.setLayout(headergroupLayout);
    // Sender line: label, text, negate checkbox
    // 
    Label wlSender = new Label(wHeader, SWT.RIGHT);
    wlSender.setText(BaseMessages.getString(PKG, "ActionGetPOP.wSender.Label"));
    props.setLook(wlSender);
    FormData fdlSender = new FormData();
    fdlSender.left = new FormAttachment(0, 0);
    fdlSender.top = new FormAttachment(0, margin);
    fdlSender.right = new FormAttachment(middle, -margin);
    wlSender.setLayoutData(fdlSender);
    wNegateSender = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSender);
    FormData fdNegateSender = new FormData();
    wNegateSender.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.NegateSender.Tooltip"));
    fdNegateSender.top = new FormAttachment(wlSender, 0, SWT.CENTER);
    fdNegateSender.right = new FormAttachment(100, -margin);
    wNegateSender.setLayoutData(fdNegateSender);
    wSender = new TextVar(variables, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSender);
    wSender.addModifyListener(lsMod);
    FormData fdSender = new FormData();
    fdSender.left = new FormAttachment(middle, 0);
    fdSender.top = new FormAttachment(wlSender, 0, SWT.CENTER);
    fdSender.right = new FormAttachment(wNegateSender, -margin);
    wSender.setLayoutData(fdSender);
    // Recipient: label, text, negate button
    // 
    Label wlRecipient = new Label(wHeader, SWT.RIGHT);
    wlRecipient.setText(BaseMessages.getString(PKG, "ActionGetPOP.Receipient.Label"));
    props.setLook(wlRecipient);
    FormData fdlRecipient = new FormData();
    fdlRecipient.left = new FormAttachment(0, 0);
    fdlRecipient.top = new FormAttachment(wSender, 2 * margin);
    fdlRecipient.right = new FormAttachment(middle, -margin);
    wlRecipient.setLayoutData(fdlRecipient);
    wNegateReceipient = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateReceipient);
    FormData fdNegateRecipient = new FormData();
    wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.NegateReceipient.Tooltip"));
    fdNegateRecipient.top = new FormAttachment(wlRecipient, 0, SWT.CENTER);
    fdNegateRecipient.right = new FormAttachment(100, -margin);
    wNegateReceipient.setLayoutData(fdNegateRecipient);
    wRecipient = new TextVar(variables, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wRecipient);
    wRecipient.addModifyListener(lsMod);
    FormData fdRecipient = new FormData();
    fdRecipient.left = new FormAttachment(middle, 0);
    fdRecipient.top = new FormAttachment(wlRecipient, 0, SWT.CENTER);
    fdRecipient.right = new FormAttachment(wNegateReceipient, -margin);
    wRecipient.setLayoutData(fdRecipient);
    // Subject line: label, text, negate checkbox
    // 
    Label wlSubject = new Label(wHeader, SWT.RIGHT);
    wlSubject.setText(BaseMessages.getString(PKG, "ActionGetPOP.Subject.Label"));
    props.setLook(wlSubject);
    FormData fdlSubject = new FormData();
    fdlSubject.left = new FormAttachment(0, 0);
    fdlSubject.top = new FormAttachment(wRecipient, 2 * margin);
    fdlSubject.right = new FormAttachment(middle, -margin);
    wlSubject.setLayoutData(fdlSubject);
    wNegateSubject = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSubject);
    FormData fdNegateSubject = new FormData();
    wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.NegateSubject.Tooltip"));
    fdNegateSubject.top = new FormAttachment(wlSubject, 0, SWT.CENTER);
    fdNegateSubject.right = new FormAttachment(100, -margin);
    wNegateSubject.setLayoutData(fdNegateSubject);
    wSubject = new TextVar(variables, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSubject);
    wSubject.addModifyListener(lsMod);
    FormData fdSubject = new FormData();
    fdSubject.left = new FormAttachment(middle, 0);
    fdSubject.top = new FormAttachment(wlSubject, 0, SWT.CENTER);
    fdSubject.right = new FormAttachment(wNegateSubject, -margin);
    wSubject.setLayoutData(fdSubject);
    FormData fdHeader = new FormData();
    fdHeader.left = new FormAttachment(0, margin);
    fdHeader.top = new FormAttachment(wRecipient, 2 * margin);
    fdHeader.right = new FormAttachment(100, -margin);
    wHeader.setLayoutData(fdHeader);
    // ///////////////////////////////////////////////////////////
    // / END OF HEADER GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF CONTENT GROUP///
    // /
    Group wContent = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wContent);
    wContent.setText(BaseMessages.getString(PKG, "ActionGetPOP.Content.Group.Label"));
    FormLayout contentgroupLayout = new FormLayout();
    contentgroupLayout.marginWidth = 10;
    contentgroupLayout.marginHeight = 10;
    wContent.setLayout(contentgroupLayout);
    // Body: label, text, negate checkbox
    // 
    Label wlBody = new Label(wContent, SWT.RIGHT);
    wlBody.setText(BaseMessages.getString(PKG, "ActionGetPOP.Body.Label"));
    props.setLook(wlBody);
    FormData fdlBody = new FormData();
    fdlBody.left = new FormAttachment(0, 0);
    fdlBody.top = new FormAttachment(0, margin);
    fdlBody.right = new FormAttachment(middle, -margin);
    wlBody.setLayoutData(fdlBody);
    wNegateBody = new Button(wContent, SWT.CHECK);
    props.setLook(wNegateBody);
    FormData fdNegateBody = new FormData();
    wNegateBody.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.NegateBody.Tooltip"));
    fdNegateBody.top = new FormAttachment(wlBody, 0, SWT.CENTER);
    fdNegateBody.right = new FormAttachment(100, -margin);
    wNegateBody.setLayoutData(fdNegateBody);
    wBody = new TextVar(variables, wContent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wBody);
    wBody.addModifyListener(lsMod);
    FormData fdBody = new FormData();
    fdBody.left = new FormAttachment(middle, 0);
    fdBody.top = new FormAttachment(wlBody, 0, SWT.CENTER);
    fdBody.right = new FormAttachment(wNegateBody, -margin);
    wBody.setLayoutData(fdBody);
    FormData fdContent = new FormData();
    fdContent.left = new FormAttachment(0, margin);
    fdContent.top = new FormAttachment(wHeader, margin);
    fdContent.right = new FormAttachment(100, -margin);
    wContent.setLayoutData(fdContent);
    // ///////////////////////////////////////////////////////////
    // / END OF CONTENT GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF RECEIVED DATE ROUP///
    // /
    Group wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wReceivedDate);
    wReceivedDate.setText(BaseMessages.getString(PKG, "ActionGetPOP.ReceivedDate.Group.Label"));
    FormLayout receivedDategroupLayout = new FormLayout();
    receivedDategroupLayout.marginWidth = 10;
    receivedDategroupLayout.marginHeight = 10;
    wReceivedDate.setLayout(receivedDategroupLayout);
    // Received Date Condition line: label, text, negate checkbox
    // 
    wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
    wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "ActionGetPOP.ConditionOnReceivedDate.Label"));
    props.setLook(wlConditionOnReceivedDate);
    FormData fdlConditionOnReceivedDate = new FormData();
    fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
    fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
    fdlConditionOnReceivedDate.top = new FormAttachment(0, margin);
    wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
    wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
    props.setLook(wNegateReceivedDate);
    FormData fdNegateReceivedDate = new FormData();
    wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.NegateReceivedDate.Tooltip"));
    fdNegateReceivedDate.top = new FormAttachment(wlConditionOnReceivedDate, 0, SWT.CENTER);
    fdNegateReceivedDate.right = new FormAttachment(100, -margin);
    wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
    wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
    // +1: starts at -1
    wConditionOnReceivedDate.select(0);
    props.setLook(wConditionOnReceivedDate);
    FormData fdConditionOnReceivedDate = new FormData();
    fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
    fdConditionOnReceivedDate.top = new FormAttachment(wlConditionOnReceivedDate, 0, SWT.CENTER);
    fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
    wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
    wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            conditionReceivedDate();
            action.setChanged();
        }
    });
    open = new Button(wReceivedDate, SWT.PUSH);
    open.setImage(GuiResource.getInstance().getImageCalendar());
    open.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.OpenCalendar"));
    FormData fdlButton = new FormData();
    fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlButton.right = new FormAttachment(100, 0);
    open.setLayoutData(fdlButton);
    open.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
            dialog.setText(BaseMessages.getString(PKG, "ActionGetPOP.SelectDate"));
            dialog.setImage(GuiResource.getInstance().getImageHopUi());
            dialog.setLayout(new GridLayout(3, false));
            final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
            final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
            new Label(dialog, SWT.NONE);
            new Label(dialog, SWT.NONE);
            Button ok = new Button(dialog, SWT.PUSH);
            ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            ok.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendar.getYear());
                    cal.set(Calendar.MONTH, calendar.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, time.getHours());
                    cal.set(Calendar.MINUTE, time.getMinutes());
                    cal.set(Calendar.SECOND, time.getSeconds());
                    wReadFrom.setText(new SimpleDateFormat(ActionGetPOP.DATE_PATTERN).format(cal.getTime()));
                    dialog.close();
                }
            });
            dialog.setDefaultButton(ok);
            dialog.pack();
            dialog.open();
        }
    });
    wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
    wlReadFrom.setText(BaseMessages.getString(PKG, "ActionGetPOP.ReadFrom.Label"));
    props.setLook(wlReadFrom);
    FormData fdlReadFrom = new FormData();
    fdlReadFrom.left = new FormAttachment(0, 0);
    fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlReadFrom.right = new FormAttachment(middle, -margin);
    wlReadFrom.setLayoutData(fdlReadFrom);
    wReadFrom = new TextVar(variables, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadFrom.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.ReadFrom.Tooltip"));
    props.setLook(wReadFrom);
    wReadFrom.addModifyListener(lsMod);
    FormData fdReadFrom = new FormData();
    fdReadFrom.left = new FormAttachment(middle, 0);
    fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdReadFrom.right = new FormAttachment(open, -margin);
    wReadFrom.setLayoutData(fdReadFrom);
    opento = new Button(wReceivedDate, SWT.PUSH);
    opento.setImage(GuiResource.getInstance().getImageCalendar());
    opento.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.OpenCalendar"));
    FormData fdlButtonto = new FormData();
    fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlButtonto.right = new FormAttachment(100, 0);
    opento.setLayoutData(fdlButtonto);
    opento.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
            dialogto.setText(BaseMessages.getString(PKG, "ActionGetPOP.SelectDate"));
            dialogto.setImage(GuiResource.getInstance().getImageHopUi());
            dialogto.setLayout(new GridLayout(3, false));
            final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
            final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
            new Label(dialogto, SWT.NONE);
            new Label(dialogto, SWT.NONE);
            Button okto = new Button(dialogto, SWT.PUSH);
            okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            okto.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendarto.getYear());
                    cal.set(Calendar.MONTH, calendarto.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
                    cal.set(Calendar.MINUTE, timeto.getMinutes());
                    cal.set(Calendar.SECOND, timeto.getSeconds());
                    wReadTo.setText(new SimpleDateFormat(ActionGetPOP.DATE_PATTERN).format(cal.getTime()));
                    dialogto.close();
                }
            });
            dialogto.setDefaultButton(okto);
            dialogto.pack();
            dialogto.open();
        }
    });
    wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
    wlReadTo.setText(BaseMessages.getString(PKG, "ActionGetPOP.ReadTo.Label"));
    props.setLook(wlReadTo);
    FormData fdlReadTo = new FormData();
    fdlReadTo.left = new FormAttachment(0, 0);
    fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlReadTo.right = new FormAttachment(middle, -margin);
    wlReadTo.setLayoutData(fdlReadTo);
    wReadTo = new TextVar(variables, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadTo.setToolTipText(BaseMessages.getString(PKG, "ActionGetPOP.ReadTo.Tooltip"));
    props.setLook(wReadTo);
    wReadTo.addModifyListener(lsMod);
    FormData fdReadTo = new FormData();
    fdReadTo.left = new FormAttachment(middle, 0);
    fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdReadTo.right = new FormAttachment(opento, -margin);
    wReadTo.setLayoutData(fdReadTo);
    FormData fdReceivedDate = new FormData();
    fdReceivedDate.left = new FormAttachment(0, margin);
    fdReceivedDate.top = new FormAttachment(wContent, margin);
    fdReceivedDate.right = new FormAttachment(100, -margin);
    wReceivedDate.setLayoutData(fdReceivedDate);
    // ///////////////////////////////////////////////////////////
    // / END OF RECEIVED DATE GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdSearchComp = new FormData();
    fdSearchComp.left = new FormAttachment(0, 0);
    fdSearchComp.top = new FormAttachment(wName, 0);
    fdSearchComp.right = new FormAttachment(100, 0);
    fdSearchComp.bottom = new FormAttachment(100, 0);
    wSearchComp.setLayoutData(fdSearchComp);
    wSearchComp.layout();
    wSearchTab.setControl(wSearchComp);
    props.setLook(wSearchComp);
    // ////////////////////////////////
    // / END OF SEARCH TAB
    // ////////////////////////////////
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
    wTabFolder.setLayoutData(fdTabFolder);
    getData();
    setUserProxy();
    chooseListMails();
    activeAttachmentFolder();
    refreshProtocol(false);
    conditionReceivedDate();
    wTabFolder.setSelection(0);
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return action;
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) Utils(org.apache.hop.core.util.Utils) IVariables(org.apache.hop.core.variables.IVariables) IActionDialog(org.apache.hop.workflow.action.IActionDialog) Props(org.apache.hop.core.Props) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) SimpleDateFormat(java.text.SimpleDateFormat) Folder(javax.mail.Folder) Calendar(java.util.Calendar) WindowProperty(org.apache.hop.ui.core.gui.WindowProperty) ActionDialog(org.apache.hop.ui.workflow.action.ActionDialog) CCombo(org.eclipse.swt.custom.CCombo) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) BaseMessages(org.apache.hop.i18n.BaseMessages) org.eclipse.swt.layout(org.eclipse.swt.layout) GuiResource(org.apache.hop.ui.core.gui.GuiResource) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) WorkflowDialog(org.apache.hop.ui.workflow.dialog.WorkflowDialog) BaseDialog(org.apache.hop.ui.core.dialog.BaseDialog) org.eclipse.swt.widgets(org.eclipse.swt.widgets) Const(org.apache.hop.core.Const) LogChannel(org.apache.hop.core.logging.LogChannel) CTabItem(org.eclipse.swt.custom.CTabItem) TextVar(org.apache.hop.ui.core.widget.TextVar) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IAction(org.apache.hop.workflow.action.IAction) BaseTransformDialog(org.apache.hop.ui.pipeline.transform.BaseTransformDialog) SelectionListener(org.eclipse.swt.events.SelectionListener) CTabFolder(org.eclipse.swt.custom.CTabFolder) ModifyListener(org.eclipse.swt.events.ModifyListener) CTabItem(org.eclipse.swt.custom.CTabItem) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Calendar(java.util.Calendar) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) TextVar(org.apache.hop.ui.core.widget.TextVar) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) SimpleDateFormat(java.text.SimpleDateFormat) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 4 with PasswordTextVar

use of org.apache.hop.ui.core.widget.PasswordTextVar in project hop by apache.

the class ActionHttpDialog method open.

@Override
public IAction open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
    props.setLook(shell);
    WorkflowDialog.setShellImage(shell, action);
    ModifyListener lsMod = e -> action.setChanged();
    changed = action.hasChanged();
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;
    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "ActionHTTP.Title"));
    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;
    // Buttons go at the very bottom
    // 
    Button wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    Button wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
    // Action name line
    Label wlName = new Label(shell, SWT.RIGHT);
    wlName.setText(BaseMessages.getString(PKG, "ActionHTTP.Name.Label"));
    props.setLook(wlName);
    FormData fdlName = new FormData();
    fdlName.left = new FormAttachment(0, 0);
    fdlName.right = new FormAttachment(middle, -margin);
    fdlName.top = new FormAttachment(0, margin);
    wlName.setLayoutData(fdlName);
    wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wName);
    wName.addModifyListener(lsMod);
    FormData fdName = new FormData();
    fdName.left = new FormAttachment(middle, 0);
    fdName.top = new FormAttachment(0, margin);
    fdName.right = new FormAttachment(100, 0);
    wName.setLayoutData(fdName);
    CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "ActionHTTP.Tab.General.Label"));
    Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // URL line
    wlURL = new Label(wGeneralComp, SWT.RIGHT);
    wlURL.setText(BaseMessages.getString(PKG, "ActionHTTP.URL.Label"));
    props.setLook(wlURL);
    FormData fdlURL = new FormData();
    fdlURL.left = new FormAttachment(0, 0);
    fdlURL.top = new FormAttachment(wName, 2 * margin);
    fdlURL.right = new FormAttachment(middle, -margin);
    wlURL.setLayoutData(fdlURL);
    wURL = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionHTTP.URL.Tooltip"));
    props.setLook(wURL);
    wURL.addModifyListener(lsMod);
    FormData fdURL = new FormData();
    fdURL.left = new FormAttachment(middle, 0);
    fdURL.top = new FormAttachment(wName, 2 * margin);
    fdURL.right = new FormAttachment(100, 0);
    wURL.setLayoutData(fdURL);
    // RunEveryRow line
    Label wlRunEveryRow = new Label(wGeneralComp, SWT.RIGHT);
    wlRunEveryRow.setText(BaseMessages.getString(PKG, "ActionHTTP.RunForEveryRow.Label"));
    props.setLook(wlRunEveryRow);
    FormData fdlRunEveryRow = new FormData();
    fdlRunEveryRow.left = new FormAttachment(0, 0);
    fdlRunEveryRow.top = new FormAttachment(wURL, margin);
    fdlRunEveryRow.right = new FormAttachment(middle, -margin);
    wlRunEveryRow.setLayoutData(fdlRunEveryRow);
    wRunEveryRow = new Button(wGeneralComp, SWT.CHECK);
    wRunEveryRow.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.RunForEveryRow.Tooltip"));
    props.setLook(wRunEveryRow);
    FormData fdRunEveryRow = new FormData();
    fdRunEveryRow.left = new FormAttachment(middle, 0);
    fdRunEveryRow.top = new FormAttachment(wlRunEveryRow, 0, SWT.CENTER);
    fdRunEveryRow.right = new FormAttachment(100, 0);
    wRunEveryRow.setLayoutData(fdRunEveryRow);
    wRunEveryRow.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setFlags();
        }
    });
    // FieldURL line
    wlFieldURL = new Label(wGeneralComp, SWT.RIGHT);
    wlFieldURL.setText(BaseMessages.getString(PKG, "ActionHTTP.InputField.Label"));
    props.setLook(wlFieldURL);
    FormData fdlFieldURL = new FormData();
    fdlFieldURL.left = new FormAttachment(0, 0);
    fdlFieldURL.top = new FormAttachment(wlRunEveryRow, 2 * margin);
    fdlFieldURL.right = new FormAttachment(middle, -margin);
    wlFieldURL.setLayoutData(fdlFieldURL);
    wFieldURL = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFieldURL);
    wFieldURL.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.InputField.Tooltip"));
    wFieldURL.addModifyListener(lsMod);
    FormData fdFieldURL = new FormData();
    fdFieldURL.left = new FormAttachment(middle, 0);
    fdFieldURL.top = new FormAttachment(wlRunEveryRow, 2 * margin);
    fdFieldURL.right = new FormAttachment(100, 0);
    wFieldURL.setLayoutData(fdFieldURL);
    // FieldUpload line
    wlFieldUpload = new Label(wGeneralComp, SWT.RIGHT);
    wlFieldUpload.setText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldUpload.Label"));
    props.setLook(wlFieldUpload);
    FormData fdlFieldUpload = new FormData();
    fdlFieldUpload.left = new FormAttachment(0, 0);
    fdlFieldUpload.top = new FormAttachment(wFieldURL, margin);
    fdlFieldUpload.right = new FormAttachment(middle, -margin);
    wlFieldUpload.setLayoutData(fdlFieldUpload);
    wFieldUpload = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFieldUpload);
    wFieldUpload.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldUpload.Tooltip"));
    wFieldUpload.addModifyListener(lsMod);
    FormData fdFieldUpload = new FormData();
    fdFieldUpload.left = new FormAttachment(middle, 0);
    fdFieldUpload.top = new FormAttachment(wFieldURL, margin);
    fdFieldUpload.right = new FormAttachment(100, 0);
    wFieldUpload.setLayoutData(fdFieldUpload);
    // FieldTarget line
    wlFieldTarget = new Label(wGeneralComp, SWT.RIGHT);
    wlFieldTarget.setText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldDest.Label"));
    props.setLook(wlFieldTarget);
    FormData fdlFieldTarget = new FormData();
    fdlFieldTarget.left = new FormAttachment(0, 0);
    fdlFieldTarget.top = new FormAttachment(wFieldUpload, margin);
    fdlFieldTarget.right = new FormAttachment(middle, -margin);
    wlFieldTarget.setLayoutData(fdlFieldTarget);
    wFieldTarget = new TextVar(variables, wGeneralComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFieldTarget);
    wFieldTarget.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.InputFieldDest.Tooltip"));
    wFieldTarget.addModifyListener(lsMod);
    FormData fdFieldTarget = new FormData();
    fdFieldTarget.left = new FormAttachment(middle, 0);
    fdFieldTarget.top = new FormAttachment(wFieldUpload, margin);
    fdFieldTarget.right = new FormAttachment(100, 0);
    wFieldTarget.setLayoutData(fdFieldTarget);
    // ////////////////////////
    // START OF AuthenticationGROUP///
    // /
    Group wAuthentication = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wAuthentication);
    wAuthentication.setText(BaseMessages.getString(PKG, "ActionHTTP.Authentication.Group.Label"));
    FormLayout authenticationgroupLayout = new FormLayout();
    authenticationgroupLayout.marginWidth = 10;
    authenticationgroupLayout.marginHeight = 10;
    wAuthentication.setLayout(authenticationgroupLayout);
    // UserName line
    Label wlUserName = new Label(wAuthentication, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadUser.Label"));
    props.setLook(wlUserName);
    FormData fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wFieldTarget, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.UploadUser.Tooltip"));
    wUserName.addModifyListener(lsMod);
    FormData fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wFieldTarget, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    Label wlPassword = new Label(wAuthentication, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadPassword.Label"));
    props.setLook(wlPassword);
    FormData fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wUserName, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.UploadPassword.Tooltip"));
    wPassword.addModifyListener(lsMod);
    FormData fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // ProxyServer line
    Label wlProxyServer = new Label(wAuthentication, SWT.RIGHT);
    wlProxyServer.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyHost.Label"));
    props.setLook(wlProxyServer);
    FormData fdlProxyServer = new FormData();
    fdlProxyServer.left = new FormAttachment(0, 0);
    fdlProxyServer.top = new FormAttachment(wPassword, 3 * margin);
    fdlProxyServer.right = new FormAttachment(middle, -margin);
    wlProxyServer.setLayoutData(fdlProxyServer);
    wProxyServer = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wProxyServer);
    wProxyServer.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.ProxyHost.Tooltip"));
    wProxyServer.addModifyListener(lsMod);
    FormData fdProxyServer = new FormData();
    fdProxyServer.left = new FormAttachment(middle, 0);
    fdProxyServer.top = new FormAttachment(wPassword, 3 * margin);
    fdProxyServer.right = new FormAttachment(100, 0);
    wProxyServer.setLayoutData(fdProxyServer);
    // ProxyPort line
    Label wlProxyPort = new Label(wAuthentication, SWT.RIGHT);
    wlProxyPort.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyPort.Label"));
    props.setLook(wlProxyPort);
    FormData fdlProxyPort = new FormData();
    fdlProxyPort.left = new FormAttachment(0, 0);
    fdlProxyPort.top = new FormAttachment(wProxyServer, margin);
    fdlProxyPort.right = new FormAttachment(middle, -margin);
    wlProxyPort.setLayoutData(fdlProxyPort);
    wProxyPort = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wProxyPort);
    wProxyPort.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.ProxyPort.Tooltip"));
    wProxyPort.addModifyListener(lsMod);
    FormData fdProxyPort = new FormData();
    fdProxyPort.left = new FormAttachment(middle, 0);
    fdProxyPort.top = new FormAttachment(wProxyServer, margin);
    fdProxyPort.right = new FormAttachment(100, 0);
    wProxyPort.setLayoutData(fdProxyPort);
    // IgnoreHosts line
    Label wlNonProxyHosts = new Label(wAuthentication, SWT.RIGHT);
    wlNonProxyHosts.setText(BaseMessages.getString(PKG, "ActionHTTP.ProxyIgnoreRegexp.Label"));
    props.setLook(wlNonProxyHosts);
    FormData fdlNonProxyHosts = new FormData();
    fdlNonProxyHosts.left = new FormAttachment(0, 0);
    fdlNonProxyHosts.top = new FormAttachment(wProxyPort, margin);
    fdlNonProxyHosts.right = new FormAttachment(middle, -margin);
    wlNonProxyHosts.setLayoutData(fdlNonProxyHosts);
    wNonProxyHosts = new TextVar(variables, wAuthentication, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wNonProxyHosts);
    wNonProxyHosts.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.ProxyIgnoreRegexp.Tooltip"));
    wNonProxyHosts.addModifyListener(lsMod);
    FormData fdNonProxyHosts = new FormData();
    fdNonProxyHosts.left = new FormAttachment(middle, 0);
    fdNonProxyHosts.top = new FormAttachment(wProxyPort, margin);
    fdNonProxyHosts.right = new FormAttachment(100, 0);
    wNonProxyHosts.setLayoutData(fdNonProxyHosts);
    FormData fdAuthentication = new FormData();
    fdAuthentication.left = new FormAttachment(0, margin);
    fdAuthentication.top = new FormAttachment(wFieldTarget, margin);
    fdAuthentication.right = new FormAttachment(100, -margin);
    wAuthentication.setLayoutData(fdAuthentication);
    // ///////////////////////////////////////////////////////////
    // / END OF AuthenticationGROUP GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF UpLoadFileGROUP///
    // /
    Group wUpLoadFile = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wUpLoadFile);
    wUpLoadFile.setText(BaseMessages.getString(PKG, "ActionHTTP.UpLoadFile.Group.Label"));
    FormLayout upLoadFilegroupLayout = new FormLayout();
    upLoadFilegroupLayout.marginWidth = 10;
    upLoadFilegroupLayout.marginHeight = 10;
    wUpLoadFile.setLayout(upLoadFilegroupLayout);
    // UploadFile line
    wlUploadFile = new Label(wUpLoadFile, SWT.RIGHT);
    wlUploadFile.setText(BaseMessages.getString(PKG, "ActionHTTP.UploadFile.Label"));
    props.setLook(wlUploadFile);
    FormData fdlUploadFile = new FormData();
    fdlUploadFile.left = new FormAttachment(0, 0);
    fdlUploadFile.top = new FormAttachment(wAuthentication, margin);
    fdlUploadFile.right = new FormAttachment(middle, -margin);
    wlUploadFile.setLayoutData(fdlUploadFile);
    wbUploadFile = new Button(wUpLoadFile, SWT.PUSH | SWT.CENTER);
    props.setLook(wbUploadFile);
    wbUploadFile.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    FormData fdbUploadFile = new FormData();
    fdbUploadFile.right = new FormAttachment(100, 0);
    fdbUploadFile.top = new FormAttachment(wAuthentication, margin);
    wbUploadFile.setLayoutData(fdbUploadFile);
    wUploadFile = new TextVar(variables, wUpLoadFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUploadFile);
    wUploadFile.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.UploadFile.Tooltip"));
    wUploadFile.addModifyListener(lsMod);
    FormData fdUploadFile = new FormData();
    fdUploadFile.left = new FormAttachment(middle, 0);
    fdUploadFile.top = new FormAttachment(wAuthentication, margin);
    fdUploadFile.right = new FormAttachment(wbUploadFile, -margin);
    wUploadFile.setLayoutData(fdUploadFile);
    // Whenever something changes, set the tooltip to the expanded version:
    wUploadFile.addModifyListener(e -> wUploadFile.setToolTipText(variables.resolve(wUploadFile.getText())));
    wbUploadFile.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wUploadFile, variables, new String[] { "*" }, FILETYPES, true));
    FormData fdUpLoadFile = new FormData();
    fdUpLoadFile.left = new FormAttachment(0, margin);
    fdUpLoadFile.top = new FormAttachment(wAuthentication, margin);
    fdUpLoadFile.right = new FormAttachment(100, -margin);
    wUpLoadFile.setLayoutData(fdUpLoadFile);
    // ///////////////////////////////////////////////////////////
    // / END OF UpLoadFileGROUP GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF TargetFileGroupGROUP///
    // /
    Group wTargetFileGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wTargetFileGroup);
    wTargetFileGroup.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileGroup.Group.Label"));
    FormLayout targetFileGroupgroupLayout = new FormLayout();
    targetFileGroupgroupLayout.marginWidth = 10;
    targetFileGroupgroupLayout.marginHeight = 10;
    wTargetFileGroup.setLayout(targetFileGroupgroupLayout);
    // TargetFile line
    wlTargetFile = new Label(wTargetFileGroup, SWT.RIGHT);
    wlTargetFile.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFile.Label"));
    props.setLook(wlTargetFile);
    FormData fdlTargetFile = new FormData();
    fdlTargetFile.left = new FormAttachment(0, 0);
    fdlTargetFile.top = new FormAttachment(wUploadFile, margin);
    fdlTargetFile.right = new FormAttachment(middle, -margin);
    wlTargetFile.setLayoutData(fdlTargetFile);
    wbTargetFile = new Button(wTargetFileGroup, SWT.PUSH | SWT.CENTER);
    props.setLook(wbTargetFile);
    wbTargetFile.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
    FormData fdbTargetFile = new FormData();
    fdbTargetFile.right = new FormAttachment(100, 0);
    fdbTargetFile.top = new FormAttachment(wUploadFile, margin);
    wbTargetFile.setLayoutData(fdbTargetFile);
    wTargetFile = new TextVar(variables, wTargetFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTargetFile);
    wTargetFile.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFile.Tooltip"));
    wTargetFile.addModifyListener(lsMod);
    FormData fdTargetFile = new FormData();
    fdTargetFile.left = new FormAttachment(middle, 0);
    fdTargetFile.top = new FormAttachment(wUploadFile, margin);
    fdTargetFile.right = new FormAttachment(wbTargetFile, -margin);
    wTargetFile.setLayoutData(fdTargetFile);
    wbTargetFile.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wTargetFile, variables, new String[] { "*" }, FILETYPES, true));
    // Append line
    wlAppend = new Label(wTargetFileGroup, SWT.RIGHT);
    wlAppend.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileAppend.Label"));
    props.setLook(wlAppend);
    FormData fdlAppend = new FormData();
    fdlAppend.left = new FormAttachment(0, 0);
    fdlAppend.top = new FormAttachment(wTargetFile, margin);
    fdlAppend.right = new FormAttachment(middle, -margin);
    wlAppend.setLayoutData(fdlAppend);
    wAppend = new Button(wTargetFileGroup, SWT.CHECK);
    props.setLook(wAppend);
    wAppend.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileAppend.Tooltip"));
    FormData fdAppend = new FormData();
    fdAppend.left = new FormAttachment(middle, 0);
    fdAppend.top = new FormAttachment(wlAppend, 0, SWT.CENTER);
    fdAppend.right = new FormAttachment(100, 0);
    wAppend.setLayoutData(fdAppend);
    // DateTimeAdded line
    wlDateTimeAdded = new Label(wTargetFileGroup, SWT.RIGHT);
    wlDateTimeAdded.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFilenameAddDate.Label"));
    props.setLook(wlDateTimeAdded);
    FormData fdlDateTimeAdded = new FormData();
    fdlDateTimeAdded.left = new FormAttachment(0, 0);
    fdlDateTimeAdded.top = new FormAttachment(wlAppend, 2 * margin);
    fdlDateTimeAdded.right = new FormAttachment(middle, -margin);
    wlDateTimeAdded.setLayoutData(fdlDateTimeAdded);
    wDateTimeAdded = new Button(wTargetFileGroup, SWT.CHECK);
    props.setLook(wDateTimeAdded);
    wDateTimeAdded.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFilenameAddDate.Tooltip"));
    FormData fdDateTimeAdded = new FormData();
    fdDateTimeAdded.left = new FormAttachment(middle, 0);
    fdDateTimeAdded.top = new FormAttachment(wlDateTimeAdded, 0, SWT.CENTER);
    fdDateTimeAdded.right = new FormAttachment(100, 0);
    wDateTimeAdded.setLayoutData(fdDateTimeAdded);
    wDateTimeAdded.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setFlags();
        }
    });
    // TargetExt line
    wlTargetExt = new Label(wTargetFileGroup, SWT.RIGHT);
    wlTargetExt.setText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileExt.Label"));
    props.setLook(wlTargetExt);
    FormData fdlTargetExt = new FormData();
    fdlTargetExt.left = new FormAttachment(0, 0);
    fdlTargetExt.top = new FormAttachment(wlDateTimeAdded, 2 * margin);
    fdlTargetExt.right = new FormAttachment(middle, -margin);
    wlTargetExt.setLayoutData(fdlTargetExt);
    wTargetExt = new TextVar(variables, wTargetFileGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wTargetExt);
    wTargetExt.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.TargetFileExt.Tooltip"));
    wTargetExt.addModifyListener(lsMod);
    FormData fdTargetExt = new FormData();
    fdTargetExt.left = new FormAttachment(middle, 0);
    fdTargetExt.top = new FormAttachment(wlTargetExt, 0, SWT.CENTER);
    fdTargetExt.right = new FormAttachment(100, 0);
    wTargetExt.setLayoutData(fdTargetExt);
    // Add filenames to result filenames...
    Label wlAddFilenameToResult = new Label(wTargetFileGroup, SWT.RIGHT);
    wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "ActionHTTP.AddFilenameToResult.Label"));
    props.setLook(wlAddFilenameToResult);
    FormData fdlAddFilenameToResult = new FormData();
    fdlAddFilenameToResult.left = new FormAttachment(0, 0);
    fdlAddFilenameToResult.top = new FormAttachment(wTargetExt, margin);
    fdlAddFilenameToResult.right = new FormAttachment(middle, -margin);
    wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
    wAddFilenameToResult = new Button(wTargetFileGroup, SWT.CHECK);
    wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "ActionHTTP.AddFilenameToResult.Tooltip"));
    props.setLook(wAddFilenameToResult);
    FormData fdAddFilenameToResult = new FormData();
    fdAddFilenameToResult.left = new FormAttachment(middle, 0);
    fdAddFilenameToResult.top = new FormAttachment(wlAddFilenameToResult, 0, SWT.CENTER);
    fdAddFilenameToResult.right = new FormAttachment(100, 0);
    wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
    FormData fdTargetFileGroup = new FormData();
    fdTargetFileGroup.left = new FormAttachment(0, margin);
    fdTargetFileGroup.top = new FormAttachment(wUpLoadFile, margin);
    fdTargetFileGroup.right = new FormAttachment(100, -margin);
    wTargetFileGroup.setLayoutData(fdTargetFileGroup);
    // ///////////////////////////////////////////////////////////
    // / END OF TargetFileGroupGROUP GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wName, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF Headers TAB ///
    // ////////////////////////
    CTabItem wHeadersTab = new CTabItem(wTabFolder, SWT.NONE);
    wHeadersTab.setText(BaseMessages.getString(PKG, "ActionHTTP.Tab.Headers.Label"));
    Composite wHeadersComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wHeadersComp);
    FormLayout headersLayout = new FormLayout();
    headersLayout.marginWidth = 3;
    headersLayout.marginHeight = 3;
    wHeadersComp.setLayout(headersLayout);
    int rows = action.getHeaderName() == null ? 1 : (action.getHeaderName().length == 0 ? 0 : action.getHeaderName().length);
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "ActionHTTP.ColumnInfo.Name"), ColumnInfo.COLUMN_TYPE_CCOMBO, HttpProtocol.getRequestHeaders(), false), new ColumnInfo(BaseMessages.getString(PKG, "ActionHTTP.ColumnInfo.Value"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
    colinf[0].setUsingVariables(true);
    colinf[1].setUsingVariables(true);
    wHeaders = new TableView(variables, wHeadersComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, rows, lsMod, props);
    FormData fdHeaders = new FormData();
    fdHeaders.left = new FormAttachment(0, margin);
    fdHeaders.top = new FormAttachment(wName, margin);
    fdHeaders.right = new FormAttachment(100, -margin);
    fdHeaders.bottom = new FormAttachment(100, -margin);
    wHeaders.setLayoutData(fdHeaders);
    FormData fdHeadersComp = new FormData();
    fdHeadersComp.left = new FormAttachment(0, 0);
    fdHeadersComp.top = new FormAttachment(0, 0);
    fdHeadersComp.right = new FormAttachment(100, 0);
    fdHeadersComp.bottom = new FormAttachment(100, 0);
    wHeadersComp.setLayoutData(fdHeadersComp);
    wHeadersComp.layout();
    wHeadersTab.setControl(wHeadersComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Headers TAB
    // ///////////////////////////////////////////////////////////
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
    wTabFolder.setLayoutData(fdTabFolder);
    getData();
    wTabFolder.setSelection(0);
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return action;
}
Also used : Utils(org.apache.hop.core.util.Utils) TableView(org.apache.hop.ui.core.widget.TableView) IVariables(org.apache.hop.core.variables.IVariables) IActionDialog(org.apache.hop.workflow.action.IActionDialog) Props(org.apache.hop.core.Props) WorkflowMeta(org.apache.hop.workflow.WorkflowMeta) WindowProperty(org.apache.hop.ui.core.gui.WindowProperty) ActionDialog(org.apache.hop.ui.workflow.action.ActionDialog) HttpProtocol(org.apache.hop.core.HttpProtocol) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) BaseMessages(org.apache.hop.i18n.BaseMessages) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) FormLayout(org.eclipse.swt.layout.FormLayout) WorkflowDialog(org.apache.hop.ui.workflow.dialog.WorkflowDialog) BaseDialog(org.apache.hop.ui.core.dialog.BaseDialog) FormData(org.eclipse.swt.layout.FormData) org.eclipse.swt.widgets(org.eclipse.swt.widgets) FormAttachment(org.eclipse.swt.layout.FormAttachment) Const(org.apache.hop.core.Const) CTabItem(org.eclipse.swt.custom.CTabItem) TextVar(org.apache.hop.ui.core.widget.TextVar) ModifyListener(org.eclipse.swt.events.ModifyListener) SWT(org.eclipse.swt.SWT) SelectionEvent(org.eclipse.swt.events.SelectionEvent) IAction(org.apache.hop.workflow.action.IAction) BaseTransformDialog(org.apache.hop.ui.pipeline.transform.BaseTransformDialog) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) CTabFolder(org.eclipse.swt.custom.CTabFolder) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) CTabItem(org.eclipse.swt.custom.CTabItem) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) TextVar(org.apache.hop.ui.core.widget.TextVar) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FormAttachment(org.eclipse.swt.layout.FormAttachment) TableView(org.apache.hop.ui.core.widget.TableView)

Example 5 with PasswordTextVar

use of org.apache.hop.ui.core.widget.PasswordTextVar in project hop by apache.

the class MailInputDialog method open.

@Override
public String open() {
    Shell parent = getParent();
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, input);
    ModifyListener lsMod = e -> {
        closeMailConnection();
        input.setChanged();
    };
    SelectionListener lsSelection = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            closeMailConnection();
        }
    };
    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, "MailInputdialog.Shell.Title"));
    int middle = props.getMiddlePct();
    int margin = props.getMargin();
    // Buttons go at the buttom
    // 
    wOk = new Button(shell, SWT.PUSH);
    wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wOk.addListener(SWT.Selection, e -> ok());
    wPreview = new Button(shell, SWT.PUSH);
    wPreview.setText(BaseMessages.getString(PKG, "MailInputDialog.Preview"));
    wPreview.addListener(SWT.Selection, e -> preview());
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
    wCancel.addListener(SWT.Selection, e -> cancel());
    BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wPreview, wCancel }, margin, null);
    // TransformName line
    wlTransformName = new Label(shell, SWT.RIGHT);
    wlTransformName.setText(BaseMessages.getString(PKG, "MailInputdialog.TransformName.Label"));
    props.setLook(wlTransformName);
    fdlTransformName = new FormData();
    fdlTransformName.left = new FormAttachment(0, 0);
    fdlTransformName.right = new FormAttachment(middle, -margin);
    fdlTransformName.top = new FormAttachment(0, margin);
    wlTransformName.setLayoutData(fdlTransformName);
    wTransformName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wTransformName.setText(transformName);
    props.setLook(wTransformName);
    wTransformName.addModifyListener(lsMod);
    fdTransformName = new FormData();
    fdTransformName.left = new FormAttachment(middle, 0);
    fdTransformName.top = new FormAttachment(0, margin);
    fdTransformName.right = new FormAttachment(100, 0);
    wTransformName.setLayoutData(fdTransformName);
    CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
    props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
    // ////////////////////////
    // START OF GENERAL TAB ///
    // ////////////////////////
    CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
    wGeneralTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.General.Label"));
    Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wGeneralComp);
    FormLayout generalLayout = new FormLayout();
    generalLayout.marginWidth = 3;
    generalLayout.marginHeight = 3;
    wGeneralComp.setLayout(generalLayout);
    // ////////////////////////
    // START OF SERVER SETTINGS GROUP///
    // /
    Group wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
    props.setLook(wServerSettings);
    wServerSettings.setText(BaseMessages.getString(PKG, "MailInput.ServerSettings.Group.Label"));
    FormLayout serverSettingsgroupLayout = new FormLayout();
    serverSettingsgroupLayout.marginWidth = 10;
    serverSettingsgroupLayout.marginHeight = 10;
    wServerSettings.setLayout(serverSettingsgroupLayout);
    // ServerName line
    Label wlServerName = new Label(wServerSettings, SWT.RIGHT);
    wlServerName.setText(BaseMessages.getString(PKG, "MailInput.Server.Label"));
    props.setLook(wlServerName);
    FormData fdlServerName = new FormData();
    fdlServerName.left = new FormAttachment(0, 0);
    fdlServerName.top = new FormAttachment(0, 2 * margin);
    fdlServerName.right = new FormAttachment(middle, -margin);
    wlServerName.setLayoutData(fdlServerName);
    wServerName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wServerName);
    wServerName.addModifyListener(lsMod);
    FormData fdServerName = new FormData();
    fdServerName.left = new FormAttachment(middle, 0);
    fdServerName.top = new FormAttachment(0, 2 * margin);
    fdServerName.right = new FormAttachment(100, 0);
    wServerName.setLayoutData(fdServerName);
    // USE connection with SSL
    wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
    wlUseSSL.setText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Label"));
    props.setLook(wlUseSSL);
    FormData fdlUseSSL = new FormData();
    fdlUseSSL.left = new FormAttachment(0, 0);
    fdlUseSSL.top = new FormAttachment(wServerName, margin);
    fdlUseSSL.right = new FormAttachment(middle, -margin);
    wlUseSSL.setLayoutData(fdlUseSSL);
    wUseSSL = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseSSL);
    FormData fdUseSSL = new FormData();
    wUseSSL.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseSSLMails.Tooltip"));
    fdUseSSL.left = new FormAttachment(middle, 0);
    fdUseSSL.top = new FormAttachment(wlUseSSL, 0, SWT.CENTER);
    fdUseSSL.right = new FormAttachment(100, 0);
    wUseSSL.setLayoutData(fdUseSSL);
    wUseSSL.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            closeMailConnection();
            refreshPort(true);
        }
    });
    // port
    wlPort = new Label(wServerSettings, SWT.RIGHT);
    wlPort.setText(BaseMessages.getString(PKG, "MailInput.SSLPort.Label"));
    props.setLook(wlPort);
    FormData fdlPort = new FormData();
    fdlPort.left = new FormAttachment(0, 0);
    fdlPort.top = new FormAttachment(wUseSSL, margin);
    fdlPort.right = new FormAttachment(middle, -margin);
    wlPort.setLayoutData(fdlPort);
    wPort = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPort);
    wPort.setToolTipText(BaseMessages.getString(PKG, "MailInput.SSLPort.Tooltip"));
    wPort.addModifyListener(lsMod);
    FormData fdPort = new FormData();
    fdPort.left = new FormAttachment(middle, 0);
    fdPort.top = new FormAttachment(wUseSSL, margin);
    fdPort.right = new FormAttachment(100, 0);
    wPort.setLayoutData(fdPort);
    // UserName line
    wlUserName = new Label(wServerSettings, SWT.RIGHT);
    wlUserName.setText(BaseMessages.getString(PKG, "MailInput.Username.Label"));
    props.setLook(wlUserName);
    FormData fdlUserName = new FormData();
    fdlUserName.left = new FormAttachment(0, 0);
    fdlUserName.top = new FormAttachment(wPort, margin);
    fdlUserName.right = new FormAttachment(middle, -margin);
    wlUserName.setLayoutData(fdlUserName);
    wUserName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wUserName);
    wUserName.setToolTipText(BaseMessages.getString(PKG, "MailInput.Username.Tooltip"));
    wUserName.addModifyListener(lsMod);
    FormData fdUserName = new FormData();
    fdUserName.left = new FormAttachment(middle, 0);
    fdUserName.top = new FormAttachment(wPort, margin);
    fdUserName.right = new FormAttachment(100, 0);
    wUserName.setLayoutData(fdUserName);
    // Password line
    wlPassword = new Label(wServerSettings, SWT.RIGHT);
    wlPassword.setText(BaseMessages.getString(PKG, "MailInput.Password.Label"));
    props.setLook(wlPassword);
    FormData fdlPassword = new FormData();
    fdlPassword.left = new FormAttachment(0, 0);
    fdlPassword.top = new FormAttachment(wUserName, margin);
    fdlPassword.right = new FormAttachment(middle, -margin);
    wlPassword.setLayoutData(fdlPassword);
    wPassword = new PasswordTextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wPassword);
    wPassword.addModifyListener(lsMod);
    FormData fdPassword = new FormData();
    fdPassword.left = new FormAttachment(middle, 0);
    fdPassword.top = new FormAttachment(wUserName, margin);
    fdPassword.right = new FormAttachment(100, 0);
    wPassword.setLayoutData(fdPassword);
    // USE proxy
    wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
    wlUseProxy.setText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Label"));
    props.setLook(wlUseProxy);
    FormData fdlUseProxy = new FormData();
    fdlUseProxy.left = new FormAttachment(0, 0);
    fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
    fdlUseProxy.right = new FormAttachment(middle, -margin);
    wlUseProxy.setLayoutData(fdlUseProxy);
    wUseProxy = new Button(wServerSettings, SWT.CHECK);
    props.setLook(wUseProxy);
    FormData fdUseProxy = new FormData();
    wUseProxy.setToolTipText(BaseMessages.getString(PKG, "MailInput.UseProxyMails.Tooltip"));
    fdUseProxy.left = new FormAttachment(middle, 0);
    fdUseProxy.top = new FormAttachment(wlUseProxy, 0, SWT.CENTER);
    fdUseProxy.right = new FormAttachment(100, 0);
    wUseProxy.setLayoutData(fdUseProxy);
    wUseProxy.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setUserProxy();
            input.setChanged();
        }
    });
    // ProxyUsername line
    wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
    wlProxyUsername.setText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Label"));
    wProxyUsername = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "MailInput.ProxyUsername.Tooltip"));
    wProxyUsername.addModifyListener(lsMod);
    addLabelInputPairBelow(wlProxyUsername, wProxyUsername, wUseProxy);
    // Use Batch label/checkbox
    Label wlUseBatch = new Label(wServerSettings, SWT.RIGHT);
    wlUseBatch.setText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Label"));
    wUseBatch = new Button(wServerSettings, SWT.CHECK);
    wUseBatch.setToolTipText(BaseMessages.getString(PKG, "MailInputDialog.UseBatch.Tooltip"));
    wUseBatch.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setBatchSettingsEnabled();
        }
    });
    addLabelInputPairBelow(wlUseBatch, wUseBatch, wProxyUsername);
    // ignore field errors
    Label wlIgnoreFieldErrors = new Label(wServerSettings, SWT.RIGHT);
    wlIgnoreFieldErrors.setText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Label"));
    wIgnoreFieldErrors = new Button(wServerSettings, SWT.CHECK);
    wIgnoreFieldErrors.setToolTipText(BaseMessages.getString(PKG, "MailInput.IgnoreFieldErrors.Tooltip"));
    addLabelInputPairBelow(wlIgnoreFieldErrors, wIgnoreFieldErrors, wUseBatch);
    // Protocol
    Label wlProtocol = new Label(wServerSettings, SWT.RIGHT);
    wlProtocol.setText(BaseMessages.getString(PKG, "MailInput.Protocol.Label"));
    wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wProtocol.setItems(MailConnectionMeta.protocolCodes);
    wProtocol.select(0);
    wProtocol.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refreshProtocol(true);
        }
    });
    addLabelInputPairBelow(wlProtocol, wProtocol, wIgnoreFieldErrors);
    // Test connection button
    Button wTest = new Button(wServerSettings, SWT.PUSH);
    wTest.setText(BaseMessages.getString(PKG, "MailInput.TestConnection.Label"));
    props.setLook(wTest);
    FormData fdTest = new FormData();
    wTest.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestConnection.Tooltip"));
    fdTest.top = new FormAttachment(wProtocol, margin);
    fdTest.right = new FormAttachment(100, 0);
    wTest.setLayoutData(fdTest);
    FormData fdServerSettings = new FormData();
    fdServerSettings.left = new FormAttachment(0, margin);
    fdServerSettings.top = new FormAttachment(wProtocol, margin);
    fdServerSettings.right = new FormAttachment(100, -margin);
    wServerSettings.setLayoutData(fdServerSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF SERVER SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    FormData fdGeneralComp = new FormData();
    fdGeneralComp.left = new FormAttachment(0, 0);
    fdGeneralComp.top = new FormAttachment(wTransformName, 0);
    fdGeneralComp.right = new FormAttachment(100, 0);
    fdGeneralComp.bottom = new FormAttachment(100, 0);
    wGeneralComp.setLayoutData(fdGeneralComp);
    wGeneralComp.layout();
    wGeneralTab.setControl(wGeneralComp);
    props.setLook(wGeneralComp);
    // ///////////////////////////////////////////////////////////
    // / END OF GENERAL TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF SETTINGS TAB ///
    // ////////////////////////
    CTabItem wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
    wSettingsTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Pop.Label"));
    Composite wSettingsComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSettingsComp);
    FormLayout popLayout = new FormLayout();
    popLayout.marginWidth = 3;
    popLayout.marginHeight = 3;
    wSettingsComp.setLayout(popLayout);
    // Message: for POP3, only INBOX folder is available!
    wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
    wlPOP3Message.setText(BaseMessages.getString(PKG, "MailInput.POP3Message.Label"));
    props.setLook(wlPOP3Message);
    FormData fdlPOP3Message = new FormData();
    fdlPOP3Message.left = new FormAttachment(0, margin);
    fdlPOP3Message.top = new FormAttachment(0, 3 * margin);
    wlPOP3Message.setLayoutData(fdlPOP3Message);
    wlPOP3Message.setForeground(GuiResource.getInstance().getColorOrange());
    // ////////////////////////
    // START OF POP3 Settings GROUP///
    // /
    Group wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wPOP3Settings);
    wPOP3Settings.setText(BaseMessages.getString(PKG, "MailInput.POP3Settings.Group.Label"));
    FormLayout pop3SettingsgroupLayout = new FormLayout();
    pop3SettingsgroupLayout.marginWidth = 10;
    pop3SettingsgroupLayout.marginHeight = 10;
    wPOP3Settings.setLayout(pop3SettingsgroupLayout);
    // List of mails of retrieve
    wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlListmails.setText(BaseMessages.getString(PKG, "MailInput.Listmails.Label"));
    props.setLook(wlListmails);
    FormData fdlListmails = new FormData();
    fdlListmails.left = new FormAttachment(0, 0);
    fdlListmails.right = new FormAttachment(middle, 0);
    fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    wlListmails.setLayoutData(fdlListmails);
    wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveAllMails.Label"));
    // pop3 does not support retrieve unread option
    wListmails.add(BaseMessages.getString(PKG, "MailInput.RetrieveFirstMails.Label"));
    // +1: starts at -1
    wListmails.select(0);
    props.setLook(wListmails);
    FormData fdListmails = new FormData();
    fdListmails.left = new FormAttachment(middle, 0);
    fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdListmails.right = new FormAttachment(100, 0);
    wListmails.setLayoutData(fdListmails);
    wListmails.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            input.setChanged();
            chooseListMails();
        }
    });
    // Retrieve the first ... mails
    wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
    wlFirstmails.setText(BaseMessages.getString(PKG, "MailInput.Firstmails.Label"));
    props.setLook(wlFirstmails);
    FormData fdlFirstmails = new FormData();
    fdlFirstmails.left = new FormAttachment(0, 0);
    fdlFirstmails.right = new FormAttachment(middle, -margin);
    fdlFirstmails.top = new FormAttachment(wListmails, margin);
    wlFirstmails.setLayoutData(fdlFirstmails);
    wFirstmails = new TextVar(variables, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wFirstmails);
    wFirstmails.addModifyListener(lsMod);
    FormData fdFirstmails = new FormData();
    fdFirstmails.left = new FormAttachment(middle, 0);
    fdFirstmails.top = new FormAttachment(wListmails, margin);
    fdFirstmails.right = new FormAttachment(100, 0);
    wFirstmails.setLayoutData(fdFirstmails);
    FormData fdPOP3Settings = new FormData();
    fdPOP3Settings.left = new FormAttachment(0, margin);
    fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
    fdPOP3Settings.right = new FormAttachment(100, -margin);
    wPOP3Settings.setLayoutData(fdPOP3Settings);
    // ///////////////////////////////////////////////////////////
    // / END OF POP3 SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF IMAP Settings GROUP///
    // /
    Group wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
    props.setLook(wIMAPSettings);
    wIMAPSettings.setText(BaseMessages.getString(PKG, "MailInput.IMAPSettings.Groupp.Label"));
    FormLayout imapSettingsgroupLayout = new FormLayout();
    imapSettingsgroupLayout.marginWidth = 10;
    imapSettingsgroupLayout.marginHeight = 10;
    wIMAPSettings.setLayout(imapSettingsgroupLayout);
    // Is folder name defined in a Field
    wlDynamicFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wlDynamicFolder.setText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Label"));
    props.setLook(wlDynamicFolder);
    FormData fdldynamicFolder = new FormData();
    fdldynamicFolder.left = new FormAttachment(0, 0);
    fdldynamicFolder.top = new FormAttachment(0, margin);
    fdldynamicFolder.right = new FormAttachment(middle, -margin);
    wlDynamicFolder.setLayoutData(fdldynamicFolder);
    wDynamicFolder = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wDynamicFolder);
    wDynamicFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.dynamicFolder.Tooltip"));
    FormData fddynamicFolder = new FormData();
    fddynamicFolder.left = new FormAttachment(middle, 0);
    fddynamicFolder.top = new FormAttachment(wlDynamicFolder, 0, SWT.CENTER);
    wDynamicFolder.setLayoutData(fddynamicFolder);
    SelectionAdapter lsxmlstream = new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            activedynamicFolder();
            input.setChanged();
        }
    };
    wDynamicFolder.addSelectionListener(lsxmlstream);
    // Folder field
    wlFolderField = new Label(wIMAPSettings, SWT.RIGHT);
    wlFolderField.setText(BaseMessages.getString(PKG, "MailInput.wlFolderField.Label"));
    props.setLook(wlFolderField);
    FormData fdlFolderField = new FormData();
    fdlFolderField.left = new FormAttachment(0, 0);
    fdlFolderField.top = new FormAttachment(wDynamicFolder, margin);
    fdlFolderField.right = new FormAttachment(middle, -margin);
    wlFolderField.setLayoutData(fdlFolderField);
    wFolderField = new CCombo(wIMAPSettings, SWT.BORDER | SWT.READ_ONLY);
    wFolderField.setEditable(true);
    props.setLook(wFolderField);
    wFolderField.addModifyListener(lsMod);
    FormData fdFolderField = new FormData();
    fdFolderField.left = new FormAttachment(middle, 0);
    fdFolderField.top = new FormAttachment(wDynamicFolder, margin);
    fdFolderField.right = new FormAttachment(100, -margin);
    wFolderField.setLayoutData(fdFolderField);
    wFolderField.addFocusListener(new FocusListener() {

        @Override
        public void focusLost(FocusEvent e) {
        }

        @Override
        public void focusGained(FocusEvent e) {
            setFolderField();
        }
    });
    // SelectFolder button
    wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
    wSelectFolder.setImage(GuiResource.getInstance().getImageBol());
    wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Label"));
    props.setLook(wSelectFolder);
    FormData fdSelectFolder = new FormData();
    wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.SelectFolderConnection.Tooltip"));
    fdSelectFolder.top = new FormAttachment(wFolderField, margin);
    fdSelectFolder.right = new FormAttachment(100, 0);
    wSelectFolder.setLayoutData(fdSelectFolder);
    // TestIMAPFolder button
    wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
    wTestIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Label"));
    props.setLook(wTestIMAPFolder);
    FormData fdTestIMAPFolder = new FormData();
    wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.TestIMAPFolderConnection.Tooltip"));
    fdTestIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
    wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
    // IMAPFolder line
    wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFolder.setText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Label"));
    props.setLook(wlIMAPFolder);
    FormData fdlIMAPFolder = new FormData();
    fdlIMAPFolder.left = new FormAttachment(0, 0);
    fdlIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdlIMAPFolder.right = new FormAttachment(middle, -margin);
    wlIMAPFolder.setLayoutData(fdlIMAPFolder);
    wIMAPFolder = new TextVar(variables, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFolder);
    wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "MailInput.IMAPFolder.Tooltip"));
    wIMAPFolder.addModifyListener(lsMod);
    FormData fdIMAPFolder = new FormData();
    fdIMAPFolder.left = new FormAttachment(middle, 0);
    fdIMAPFolder.top = new FormAttachment(wFolderField, margin);
    fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
    wIMAPFolder.setLayoutData(fdIMAPFolder);
    // Include subfolders?
    wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
    wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Label"));
    props.setLook(wlIncludeSubFolders);
    FormData fdlIncludeSubFolders = new FormData();
    fdlIncludeSubFolders.left = new FormAttachment(0, 0);
    fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
    fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
    wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
    wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
    props.setLook(wIncludeSubFolders);
    FormData fdIncludeSubFolders = new FormData();
    wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "MailInput.IncludeSubFoldersMails.Tooltip"));
    fdIncludeSubFolders.left = new FormAttachment(middle, 0);
    fdIncludeSubFolders.top = new FormAttachment(wlIncludeSubFolders, 0, SWT.CENTER);
    fdIncludeSubFolders.right = new FormAttachment(100, 0);
    wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
    wIncludeSubFolders.addSelectionListener(lsSelection);
    // List of mails of retrieve
    wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPListmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPListmails.Label"));
    props.setLook(wlIMAPListmails);
    FormData fdlIMAPListmails = new FormData();
    fdlIMAPListmails.left = new FormAttachment(0, 0);
    fdlIMAPListmails.right = new FormAttachment(middle, -margin);
    fdlIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
    wlIMAPListmails.setLayoutData(fdlIMAPListmails);
    wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
    // +1: starts at -1
    wIMAPListmails.select(0);
    props.setLook(wIMAPListmails);
    FormData fdIMAPListmails = new FormData();
    fdIMAPListmails.left = new FormAttachment(middle, 0);
    fdIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
    fdIMAPListmails.right = new FormAttachment(100, 0);
    wIMAPListmails.setLayoutData(fdIMAPListmails);
    wIMAPListmails.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
        }
    });
    // Retrieve the first ... mails
    wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
    wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "MailInput.IMAPFirstmails.Label"));
    props.setLook(wlIMAPFirstmails);
    FormData fdlIMAPFirstmails = new FormData();
    fdlIMAPFirstmails.left = new FormAttachment(0, 0);
    fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
    fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
    wIMAPFirstmails = new TextVar(variables, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wIMAPFirstmails);
    wIMAPFirstmails.addModifyListener(lsMod);
    FormData fdIMAPFirstmails = new FormData();
    fdIMAPFirstmails.left = new FormAttachment(middle, 0);
    fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
    fdIMAPFirstmails.right = new FormAttachment(100, 0);
    wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
    FormData fdIMAPSettings = new FormData();
    fdIMAPSettings.left = new FormAttachment(0, margin);
    fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
    fdIMAPSettings.right = new FormAttachment(100, -margin);
    wIMAPSettings.setLayoutData(fdIMAPSettings);
    // ///////////////////////////////////////////////////////////
    // / END OF IMAP SETTINGS GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////////////
    // START OF Batch Settings GROUP///
    // 
    Group wBatchSettingsGroup = createGroup(wSettingsComp, wIMAPSettings, BaseMessages.getString(PKG, "MailInputDialog.BatchSettingsGroup.Label"));
    // Batch size
    Label wlBatchSize = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlBatchSize.setText(BaseMessages.getString(PKG, "MailInputDialog.BatchSize.Label"));
    wBatchSize = new Text(wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlBatchSize, wBatchSize, wBatchSettingsGroup);
    // Starting message
    Label wlStartMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlStartMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.StartMessage.Label"));
    wStartMessage = new TextVar(variables, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlStartMessage, wStartMessage, wBatchSize);
    // Last message
    Label wlEndMessage = new Label(wBatchSettingsGroup, SWT.RIGHT);
    wlEndMessage.setText(BaseMessages.getString(PKG, "MailInputDialog.EndMessage.Label"));
    wEndMessage = new TextVar(variables, wBatchSettingsGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    addLabelInputPairBelow(wlEndMessage, wEndMessage, wStartMessage);
    // 
    // / END OF Batch Settings GROUP
    // ///////////////////////////////
    FormData fdSettingsComp = new FormData();
    fdSettingsComp.left = new FormAttachment(0, 0);
    fdSettingsComp.top = new FormAttachment(wTransformName, 0);
    fdSettingsComp.right = new FormAttachment(100, 0);
    fdSettingsComp.bottom = new FormAttachment(100, 0);
    wSettingsComp.setLayoutData(fdSettingsComp);
    wSettingsComp.layout();
    wSettingsTab.setControl(wSettingsComp);
    props.setLook(wSettingsComp);
    // ///////////////////////////////////////////////////////////
    // / END OF Pop TAB
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF SEARCH TAB ///
    // ////////////////////////
    CTabItem wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
    wSearchTab.setText(BaseMessages.getString(PKG, "MailInput.Tab.Search.Label"));
    Composite wSearchComp = new Composite(wTabFolder, SWT.NONE);
    props.setLook(wSearchComp);
    FormLayout searchLayout = new FormLayout();
    searchLayout.marginWidth = 3;
    searchLayout.marginHeight = 3;
    wSearchComp.setLayout(searchLayout);
    // ////////////////////////
    // START OF HEADER ROUP///
    // /
    Group wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wHeader);
    wHeader.setText(BaseMessages.getString(PKG, "MailInput.Header.Group.Label"));
    FormLayout headergroupLayout = new FormLayout();
    headergroupLayout.marginWidth = 10;
    headergroupLayout.marginHeight = 10;
    wHeader.setLayout(headergroupLayout);
    // From line
    Label wlSender = new Label(wHeader, SWT.RIGHT);
    wlSender.setText(BaseMessages.getString(PKG, "MailInput.wSender.Label"));
    props.setLook(wlSender);
    FormData fdlSender = new FormData();
    fdlSender.left = new FormAttachment(0, 0);
    fdlSender.top = new FormAttachment(0, margin);
    fdlSender.right = new FormAttachment(middle, -margin);
    wlSender.setLayoutData(fdlSender);
    wNegateSender = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSender);
    FormData fdNegateSender = new FormData();
    wNegateSender.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSender.Tooltip"));
    fdNegateSender.top = new FormAttachment(wlSender, 0, SWT.CENTER);
    fdNegateSender.right = new FormAttachment(100, -margin);
    wNegateSender.setLayoutData(fdNegateSender);
    wSender = new TextVar(variables, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSender);
    wSender.addModifyListener(lsMod);
    FormData fdSender = new FormData();
    fdSender.left = new FormAttachment(middle, 0);
    fdSender.top = new FormAttachment(wlSender, 0, SWT.CENTER);
    fdSender.right = new FormAttachment(wNegateSender, -margin);
    wSender.setLayoutData(fdSender);
    // Receipient line
    Label wlReceipient = new Label(wHeader, SWT.RIGHT);
    wlReceipient.setText(BaseMessages.getString(PKG, "MailInput.Receipient.Label"));
    props.setLook(wlReceipient);
    FormData fdlReceipient = new FormData();
    fdlReceipient.left = new FormAttachment(0, 0);
    fdlReceipient.top = new FormAttachment(wSender, margin);
    fdlReceipient.right = new FormAttachment(middle, -margin);
    wlReceipient.setLayoutData(fdlReceipient);
    wNegateReceipient = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateReceipient);
    FormData fdNegateReceipient = new FormData();
    wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceipient.Tooltip"));
    fdNegateReceipient.top = new FormAttachment(wlReceipient, 0, SWT.CENTER);
    fdNegateReceipient.right = new FormAttachment(100, -margin);
    wNegateReceipient.setLayoutData(fdNegateReceipient);
    wReceipient = new TextVar(variables, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wReceipient);
    wReceipient.addModifyListener(lsMod);
    FormData fdReceipient = new FormData();
    fdReceipient.left = new FormAttachment(middle, 0);
    fdReceipient.top = new FormAttachment(wlReceipient, 0, SWT.CENTER);
    fdReceipient.right = new FormAttachment(wNegateReceipient, -margin);
    wReceipient.setLayoutData(fdReceipient);
    // Subject line
    Label wlSubject = new Label(wHeader, SWT.RIGHT);
    wlSubject.setText(BaseMessages.getString(PKG, "MailInput.Subject.Label"));
    props.setLook(wlSubject);
    FormData fdlSubject = new FormData();
    fdlSubject.left = new FormAttachment(0, 0);
    fdlSubject.top = new FormAttachment(wReceipient, margin);
    fdlSubject.right = new FormAttachment(middle, -margin);
    wlSubject.setLayoutData(fdlSubject);
    wNegateSubject = new Button(wHeader, SWT.CHECK);
    props.setLook(wNegateSubject);
    FormData fdNegateSubject = new FormData();
    wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateSubject.Tooltip"));
    fdNegateSubject.top = new FormAttachment(wlSubject, 0, SWT.CENTER);
    fdNegateSubject.right = new FormAttachment(100, -margin);
    wNegateSubject.setLayoutData(fdNegateSubject);
    wSubject = new TextVar(variables, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wSubject);
    wSubject.addModifyListener(lsMod);
    FormData fdSubject = new FormData();
    fdSubject.left = new FormAttachment(middle, 0);
    fdSubject.top = new FormAttachment(wlSubject, 0, SWT.CENTER);
    fdSubject.right = new FormAttachment(wNegateSubject, -margin);
    wSubject.setLayoutData(fdSubject);
    FormData fdHeader = new FormData();
    fdHeader.left = new FormAttachment(0, margin);
    fdHeader.top = new FormAttachment(wReceipient, 2 * margin);
    fdHeader.right = new FormAttachment(100, -margin);
    wHeader.setLayoutData(fdHeader);
    // ///////////////////////////////////////////////////////////
    // / END OF HEADER GROUP
    // ///////////////////////////////////////////////////////////
    // ////////////////////////
    // START OF RECEIVED DATE ROUP///
    // /
    Group wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
    props.setLook(wReceivedDate);
    wReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ReceivedDate.Group.Label"));
    FormLayout receivedDategroupLayout = new FormLayout();
    receivedDategroupLayout.marginWidth = 10;
    receivedDategroupLayout.marginHeight = 10;
    wReceivedDate.setLayout(receivedDategroupLayout);
    wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
    props.setLook(wNegateReceivedDate);
    FormData fdNegateReceivedDate = new FormData();
    wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "MailInput.NegateReceivedDate.Tooltip"));
    fdNegateReceivedDate.top = new FormAttachment(wHeader, margin);
    fdNegateReceivedDate.right = new FormAttachment(100, -margin);
    wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
    // Received Date Condition
    wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
    wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "MailInput.ConditionOnReceivedDate.Label"));
    props.setLook(wlConditionOnReceivedDate);
    FormData fdlConditionOnReceivedDate = new FormData();
    fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
    fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
    fdlConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
    wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
    wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
    wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
    // +1: starts at -1
    wConditionOnReceivedDate.select(0);
    props.setLook(wConditionOnReceivedDate);
    FormData fdConditionOnReceivedDate = new FormData();
    fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
    fdConditionOnReceivedDate.top = new FormAttachment(wHeader, margin);
    fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
    wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
    wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            conditionReceivedDate();
            input.setChanged();
        }
    });
    open = new Button(wReceivedDate, SWT.PUSH);
    open.setImage(GuiResource.getInstance().getImageCalendar());
    open.setToolTipText(BaseMessages.getString(PKG, "MailInput.OpenCalendar"));
    FormData fdlButton = new FormData();
    fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlButton.right = new FormAttachment(100, 0);
    open.setLayoutData(fdlButton);
    open.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
            dialog.setText(BaseMessages.getString(PKG, "MailInput.SelectDate"));
            dialog.setImage(GuiResource.getInstance().getImageHopUi());
            dialog.setLayout(new GridLayout(3, false));
            final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
            final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
            new Label(dialog, SWT.NONE);
            new Label(dialog, SWT.NONE);
            Button ok = new Button(dialog, SWT.PUSH);
            ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            ok.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendar.getYear());
                    cal.set(Calendar.MONTH, calendar.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, time.getHours());
                    cal.set(Calendar.MINUTE, time.getMinutes());
                    cal.set(Calendar.SECOND, time.getSeconds());
                    wReadFrom.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
                    dialog.close();
                }
            });
            dialog.setDefaultButton(ok);
            dialog.pack();
            dialog.open();
        }
    });
    wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
    wlReadFrom.setText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Label"));
    props.setLook(wlReadFrom);
    FormData fdlReadFrom = new FormData();
    fdlReadFrom.left = new FormAttachment(0, 0);
    fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdlReadFrom.right = new FormAttachment(middle, -margin);
    wlReadFrom.setLayoutData(fdlReadFrom);
    wReadFrom = new TextVar(variables, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadFrom.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadFrom.Tooltip"));
    props.setLook(wReadFrom);
    wReadFrom.addModifyListener(lsMod);
    FormData fdReadFrom = new FormData();
    fdReadFrom.left = new FormAttachment(middle, 0);
    fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
    fdReadFrom.right = new FormAttachment(open, -margin);
    wReadFrom.setLayoutData(fdReadFrom);
    opento = new Button(wReceivedDate, SWT.PUSH);
    opento.setImage(GuiResource.getInstance().getImageCalendar());
    opento.setToolTipText(BaseMessages.getString(PKG, "MailInput.OpenCalendar"));
    FormData fdlButtonto = new FormData();
    fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlButtonto.right = new FormAttachment(100, 0);
    opento.setLayoutData(fdlButtonto);
    opento.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
            dialogto.setText(BaseMessages.getString(PKG, "MailInput.SelectDate"));
            dialogto.setImage(GuiResource.getInstance().getImageHopUi());
            dialogto.setLayout(new GridLayout(3, false));
            final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
            final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
            new Label(dialogto, SWT.NONE);
            new Label(dialogto, SWT.NONE);
            Button okto = new Button(dialogto, SWT.PUSH);
            okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
            okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
            okto.addSelectionListener(new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                    Calendar cal = Calendar.getInstance();
                    cal.set(Calendar.YEAR, calendarto.getYear());
                    cal.set(Calendar.MONTH, calendarto.getMonth());
                    cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
                    cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
                    cal.set(Calendar.MINUTE, timeto.getMinutes());
                    cal.set(Calendar.SECOND, timeto.getSeconds());
                    wReadTo.setText(new SimpleDateFormat(MailInputMeta.DATE_PATTERN).format(cal.getTime()));
                    dialogto.close();
                }
            });
            dialogto.setDefaultButton(okto);
            dialogto.pack();
            dialogto.open();
        }
    });
    wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
    wlReadTo.setText(BaseMessages.getString(PKG, "MailInput.ReadTo.Label"));
    props.setLook(wlReadTo);
    FormData fdlReadTo = new FormData();
    fdlReadTo.left = new FormAttachment(0, 0);
    fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdlReadTo.right = new FormAttachment(middle, -margin);
    wlReadTo.setLayoutData(fdlReadTo);
    wReadTo = new TextVar(variables, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wReadTo.setToolTipText(BaseMessages.getString(PKG, "MailInput.ReadTo.Tooltip"));
    props.setLook(wReadTo);
    wReadTo.addModifyListener(lsMod);
    FormData fdReadTo = new FormData();
    fdReadTo.left = new FormAttachment(middle, 0);
    fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
    fdReadTo.right = new FormAttachment(opento, -margin);
    wReadTo.setLayoutData(fdReadTo);
    FormData fdReceivedDate = new FormData();
    fdReceivedDate.left = new FormAttachment(0, margin);
    fdReceivedDate.top = new FormAttachment(wHeader, margin);
    fdReceivedDate.right = new FormAttachment(100, -margin);
    wReceivedDate.setLayoutData(fdReceivedDate);
    // ///////////////////////////////////////////////////////////
    // / END OF RECEIVED DATE GROUP
    // ///////////////////////////////////////////////////////////
    wlLimit = new Label(wSearchComp, SWT.RIGHT);
    wlLimit.setText(BaseMessages.getString(PKG, "MailInput.Limit.Label"));
    props.setLook(wlLimit);
    FormData fdlLimit = new FormData();
    fdlLimit.left = new FormAttachment(0, 0);
    fdlLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
    fdlLimit.right = new FormAttachment(middle, -margin);
    wlLimit.setLayoutData(fdlLimit);
    wLimit = new Text(wSearchComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    props.setLook(wLimit);
    wLimit.addModifyListener(lsMod);
    FormData fdLimit = new FormData();
    fdLimit.left = new FormAttachment(middle, 0);
    fdLimit.top = new FormAttachment(wReceivedDate, 2 * margin);
    fdLimit.right = new FormAttachment(100, 0);
    wLimit.setLayoutData(fdLimit);
    FormData fdSearchComp = new FormData();
    fdSearchComp.left = new FormAttachment(0, 0);
    fdSearchComp.top = new FormAttachment(wTransformName, 0);
    fdSearchComp.right = new FormAttachment(100, 0);
    fdSearchComp.bottom = new FormAttachment(100, 0);
    wSearchComp.setLayoutData(fdSearchComp);
    wSearchComp.layout();
    wSearchTab.setControl(wSearchComp);
    props.setLook(wSearchComp);
    // ////////////////////////////////
    // / END OF SEARCH TAB
    // ////////////////////////////////
    // Fields tab...
    // 
    CTabItem wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
    wFieldsTab.setText(BaseMessages.getString(PKG, "MailInputdialog.Fields.Tab"));
    FormLayout fieldsLayout = new FormLayout();
    fieldsLayout.marginWidth = Const.FORM_MARGIN;
    fieldsLayout.marginHeight = Const.FORM_MARGIN;
    Composite wFieldsComp = new Composite(wTabFolder, SWT.NONE);
    wFieldsComp.setLayout(fieldsLayout);
    props.setLook(wFieldsComp);
    wGet = new Button(wFieldsComp, SWT.PUSH);
    wGet.setText(BaseMessages.getString(PKG, "MailInputdialog.GetFields.Button"));
    fdGet = new FormData();
    fdGet.left = new FormAttachment(50, 0);
    fdGet.bottom = new FormAttachment(100, 0);
    wGet.setLayoutData(fdGet);
    final int FieldsRows = input.getInputFields().length;
    ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, MailInputField.ColumnDesc, true) };
    colinf[0].setUsingVariables(true);
    colinf[0].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Name.Column.Tooltip"));
    colinf[1].setToolTip(BaseMessages.getString(PKG, "MailInputdialog.FieldsTable.Column.Column.Tooltip"));
    wFields = new TableView(variables, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
    FormData fdFields = new FormData();
    fdFields.left = new FormAttachment(0, 0);
    fdFields.top = new FormAttachment(0, 0);
    fdFields.right = new FormAttachment(100, 0);
    fdFields.bottom = new FormAttachment(wGet, -margin);
    wFields.setLayoutData(fdFields);
    FormData fdFieldsComp = new FormData();
    fdFieldsComp.left = new FormAttachment(0, 0);
    fdFieldsComp.top = new FormAttachment(0, 0);
    fdFieldsComp.right = new FormAttachment(100, 0);
    fdFieldsComp.bottom = new FormAttachment(100, 0);
    wFieldsComp.setLayoutData(fdFieldsComp);
    wFieldsComp.layout();
    wFieldsTab.setControl(wFieldsComp);
    FormData fdTabFolder = new FormData();
    fdTabFolder.left = new FormAttachment(0, 0);
    fdTabFolder.top = new FormAttachment(wTransformName, margin);
    fdTabFolder.right = new FormAttachment(100, 0);
    fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
    wTabFolder.setLayoutData(fdTabFolder);
    // Add listeners
    Listener lsTest = e -> test();
    wTest.addListener(SWT.Selection, lsTest);
    wGet.addListener(SWT.Selection, e -> getFields());
    Listener lsTestIMAPFolder = e -> checkFolder(variables.resolve(wIMAPFolder.getText()));
    wTestIMAPFolder.addListener(SWT.Selection, lsTestIMAPFolder);
    Listener lsSelectFolder = e -> selectFolder(wIMAPFolder);
    wSelectFolder.addListener(SWT.Selection, lsSelectFolder);
    getData();
    setUserProxy();
    chooseListMails();
    refreshProtocol(false);
    conditionReceivedDate();
    wTabFolder.setSelection(0);
    BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
    return transformName;
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) Utils(org.apache.hop.core.util.Utils) TableView(org.apache.hop.ui.core.widget.TableView) IVariables(org.apache.hop.core.variables.IVariables) org.apache.hop.ui.core.dialog(org.apache.hop.ui.core.dialog) Props(org.apache.hop.core.Props) HopException(org.apache.hop.core.exception.HopException) SimpleDateFormat(java.text.SimpleDateFormat) SelectFolderDialog(org.apache.hop.workflow.actions.getpop.SelectFolderDialog) ITransformDialog(org.apache.hop.pipeline.transform.ITransformDialog) Folder(javax.mail.Folder) Calendar(java.util.Calendar) PipelinePreviewFactory(org.apache.hop.pipeline.PipelinePreviewFactory) WindowProperty(org.apache.hop.ui.core.gui.WindowProperty) PipelineMeta(org.apache.hop.pipeline.PipelineMeta) CCombo(org.eclipse.swt.custom.CCombo) IRowMeta(org.apache.hop.core.row.IRowMeta) org.eclipse.swt.events(org.eclipse.swt.events) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) BaseMessages(org.apache.hop.i18n.BaseMessages) org.eclipse.swt.layout(org.eclipse.swt.layout) GuiResource(org.apache.hop.ui.core.gui.GuiResource) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) CTabFolder(org.eclipse.swt.custom.CTabFolder) org.eclipse.swt.widgets(org.eclipse.swt.widgets) BaseTransformMeta(org.apache.hop.pipeline.transform.BaseTransformMeta) Const(org.apache.hop.core.Const) LogChannel(org.apache.hop.core.logging.LogChannel) MailConnectionMeta(org.apache.hop.workflow.actions.getpop.MailConnectionMeta) CTabItem(org.eclipse.swt.custom.CTabItem) TextVar(org.apache.hop.ui.core.widget.TextVar) MailConnection(org.apache.hop.workflow.actions.getpop.MailConnection) Pipeline(org.apache.hop.pipeline.Pipeline) SWT(org.eclipse.swt.SWT) PipelinePreviewProgressDialog(org.apache.hop.ui.pipeline.dialog.PipelinePreviewProgressDialog) BaseTransformDialog(org.apache.hop.ui.pipeline.transform.BaseTransformDialog) CTabFolder(org.eclipse.swt.custom.CTabFolder) ColumnInfo(org.apache.hop.ui.core.widget.ColumnInfo) CTabItem(org.eclipse.swt.custom.CTabItem) TableView(org.apache.hop.ui.core.widget.TableView) Calendar(java.util.Calendar) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) TextVar(org.apache.hop.ui.core.widget.TextVar) PasswordTextVar(org.apache.hop.ui.core.widget.PasswordTextVar) CCombo(org.eclipse.swt.custom.CCombo) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

PasswordTextVar (org.apache.hop.ui.core.widget.PasswordTextVar)10 TextVar (org.apache.hop.ui.core.widget.TextVar)10 CTabItem (org.eclipse.swt.custom.CTabItem)8 FormAttachment (org.eclipse.swt.layout.FormAttachment)8 FormData (org.eclipse.swt.layout.FormData)8 Const (org.apache.hop.core.Const)7 Utils (org.apache.hop.core.util.Utils)7 IVariables (org.apache.hop.core.variables.IVariables)7 BaseMessages (org.apache.hop.i18n.BaseMessages)7 BaseTransformDialog (org.apache.hop.ui.pipeline.transform.BaseTransformDialog)7 SWT (org.eclipse.swt.SWT)7 CTabFolder (org.eclipse.swt.custom.CTabFolder)7 FormLayout (org.eclipse.swt.layout.FormLayout)7 org.eclipse.swt.widgets (org.eclipse.swt.widgets)7 Props (org.apache.hop.core.Props)6 BaseDialog (org.apache.hop.ui.core.dialog.BaseDialog)6 WindowProperty (org.apache.hop.ui.core.gui.WindowProperty)6 CCombo (org.eclipse.swt.custom.CCombo)6 ActionDialog (org.apache.hop.ui.workflow.action.ActionDialog)5 WorkflowDialog (org.apache.hop.ui.workflow.dialog.WorkflowDialog)5