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();
}
}
Aggregations