Search in sources :

Example 6 with FTPConnection

use of org.talend.core.model.metadata.builder.connection.FTPConnection in project tdi-studio-se by Talend.

the class FTPForm method initialize.

/*
     * (non-Javadoc)
     *
     * @see org.talend.repository.ui.swt.utils.AbstractForm#initialize()
     */
@Override
protected void initialize() {
    FTPConnection conn = getConnection();
    ftpUsernameText.setText(conn.getUsername());
    // decrypt password
    ftpPasswordText.setText(conn.getValue(conn.getPassword(), false));
    ftpPortText.setText(conn.getPort());
    ftpHostText.setText(conn.getHost());
    encodeCombo.setText(conn.getEcoding());
    if (CUSTOM.equals(encodeCombo.getText())) {
        customText.setVisible(true);
    } else {
        customText.setVisible(false);
    }
    if (conn.getCustomEncode() == null) {
        customText.setText(ENCODING);
    } else {
        customText.setText(conn.getCustomEncode());
    }
    connModelCombo.setText(conn.getMode());
    if (conn.isSFTP()) {
        fnEncodingBtn.setSelection(conn.isUseFileNameEncoding());
        sftpChildComGridData.exclude = false;
        ftpsChildComGridData.exclude = true;
        fnEncodingBtnGD.exclude = false;
        fnEncodingBtn.setVisible(true);
        sftpChildCom.setVisible(true);
        ftpsChildCom.setVisible(false);
        encodeCombo.setHideWidgets(!fnEncodingBtn.getSelection());
        encodingComp.layout();
        sftpChildCom.layout();
        ftpsChildCom.layout();
        tetsCom.layout();
        buildGroup.layout();
        connModelCombo.setEnabled(false);
        sftpSuppBut.setSelection(conn.isSFTP());
        methodCombo.setText(conn.getMethod());
        if (PUBLIC_KEY.equals(conn.getMethod())) {
            privatekeyText.setVisible(true);
            passphraseText.setVisible(true);
            //$NON-NLS-1$
            privatekeyText.setText(conn.getPrivatekey() != null ? conn.getPrivatekey() : "");
            // decrypt password
            passphraseText.setText(conn.getValue(conn.getPassphrase(), false));
        } else {
            privatekeyText.setVisible(false);
            passphraseText.setVisible(false);
        }
    } else {
        sftpChildComGridData.exclude = true;
        fnEncodingBtnGD.exclude = true;
        encodeCombo.setHideWidgets(false);
        fnEncodingBtn.setVisible(false);
        sftpChildCom.setVisible(false);
        sftpChildCom.layout();
        encodingComp.layout();
        tetsCom.layout();
        buildGroup.layout();
    }
    if (conn.isFTPS()) {
        ftpsChildComGridData.exclude = false;
        sftpChildComGridData.exclude = true;
        sftpChildCom.setVisible(false);
        ftpsChildCom.setVisible(true);
        sftpChildCom.layout();
        ftpsChildCom.layout();
        tetsCom.layout();
        buildGroup.layout();
        connModelCombo.setEnabled(false);
        ftpsSuppBut.setSelection(conn.isFTPS());
        keyFileText.setText(conn.getKeystoreFile());
        // decrypt password
        keyPasswordText.setText(conn.getValue(conn.getKeystorePassword(), false));
    } else {
        ftpsChildComGridData.exclude = true;
        ftpsChildCom.setVisible(false);
        ftpsChildCom.layout();
        tetsCom.layout();
        buildGroup.layout();
    }
    if (conn.isUsesocks()) {
        proxyChildComGridData.exclude = false;
        proxyChildCom.setVisible(true);
        proxyChildCom.layout();
        proxyCom.layout();
        buildGroup.layout();
        this.layout();
        useSocksBut.setSelection(conn.isUsesocks());
        proxyHostText.setText(conn.getProxyhost());
        proxyPortText.setText(conn.getProxyport());
        proxyUsernameText.setText(conn.getProxyuser());
        // decrypt password
        proxyPasswordText.setText(conn.getValue(conn.getProxypassword(), false));
    } else {
        proxyChildComGridData.exclude = true;
        proxyChildCom.setVisible(false);
        proxyChildCom.layout();
        proxyCom.layout();
        buildGroup.layout();
        this.layout();
    }
}
Also used : FTPConnection(org.talend.core.model.metadata.builder.connection.FTPConnection)

Aggregations

FTPConnection (org.talend.core.model.metadata.builder.connection.FTPConnection)6 FTPConnectionItem (org.talend.core.model.properties.FTPConnectionItem)3 Connection (org.talend.core.model.metadata.builder.connection.Connection)2 ConnectionItem (org.talend.core.model.properties.ConnectionItem)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 ComponentProperties (org.talend.components.api.properties.ComponentProperties)1 ITDQPatternService (org.talend.core.ITDQPatternService)1 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)1 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)1 HL7Connection (org.talend.core.model.metadata.builder.connection.HL7Connection)1