in plugins/actions/ftp/src/main/java/org/apache/hop/workflow/actions/sftpput/ActionSftpPutDialog.java [144:928]
public IAction open() {
shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
PropsUi.setLook(shell);
WorkflowDialog.setShellImage(shell, action);
ModifyListener lsMod =
e -> {
sftpclient = null;
action.setChanged();
};
changed = action.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = PropsUi.getFormMargin();
formLayout.marginHeight = PropsUi.getFormMargin();
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "ActionSftpPut.Title"));
int middle = props.getMiddlePct();
int margin = PropsUi.getMargin();
// Filename line
Label wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "ActionSftpPut.Name.Label"));
PropsUi.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);
PropsUi.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);
PropsUi.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setFont(GuiResource.getInstance().getFontDefault());
wGeneralTab.setText(BaseMessages.getString(PKG, "ActionSftpPut.Tab.General.Label"));
Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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"));
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.setLook(wKeyFilePass);
wKeyFilePass.addModifyListener(lsMod);
FormData fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, 0);
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"));
PropsUi.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);
wProxyType.select(0); // +1: starts at -1
PropsUi.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);
PropsUi.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
FormData fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, 0);
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);
PropsUi.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, "ActionSftpPut.ProxyUsername.Label"),
BaseMessages.getString(PKG, "ActionSftpPut.ProxyUsername.Tooltip"),
false,
false);
PropsUi.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, "ActionSftpPut.ProxyPassword.Label"),
BaseMessages.getString(PKG, "ActionSftpPut.ProxyPassword.Tooltip"),
true,
false);
PropsUi.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, "ActionSftpPut.TestConnection.Label"));
PropsUi.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"));
PropsUi.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");
wCompression.select(0); // +1: starts at -1
PropsUi.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);
PropsUi.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Files TAB ///
// ////////////////////////
CTabItem wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setFont(GuiResource.getInstance().getFontDefault());
wFilesTab.setText(BaseMessages.getString(PKG, "ActionSftpPut.Tab.Files.Label"));
Composite wFilesComp = new Composite(wTabFolder, SWT.NONE);
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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()) {
wGetPreviousFiles.setSelection(false); // only one is allowed
}
activeCopyFromPrevious();
action.setChanged();
}
});
// Get arguments from previous files result...
Label wlGetPreviousFiles = new Label(wgSourceFiles, SWT.RIGHT);
wlGetPreviousFiles.setText(BaseMessages.getString(PKG, "ActionSftpPut.getPreviousFiles.Label"));
PropsUi.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);
PropsUi.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()) {
wGetPrevious.setSelection(false); // only one is allowed
}
activeCopyFromPrevious();
action.setChanged();
}
});
// Local Directory line
wlLocalDirectory = new Label(wgSourceFiles, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "ActionSftpPut.LocalDir.Label"));
PropsUi.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);
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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"));
wAfterFtpPut.select(0); // +1: starts at -1
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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"));
PropsUi.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"));
PropsUi.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"));
PropsUi.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"));
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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);
PropsUi.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"));
PropsUi.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);
PropsUi.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);
PropsUi.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;
}