use of org.pentaho.di.ui.core.widget.LabelText in project pentaho-kettle by pentaho.
the class JobEntryFTPDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
pwdFolder = null;
ftpclient = null;
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobFTP.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobFTP.Name.Label"), BaseMessages.getString(PKG, "JobFTP.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobFTP.Tab.General.Label"));
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///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobFTP.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.Server.Label"), BaseMessages.getString(PKG, "JobFTP.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.Port.Label"), BaseMessages.getString(PKG, "JobFTP.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// UserName line
wUserName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.User.Label"), BaseMessages.getString(PKG, "JobFTP.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.Password.Label"), BaseMessages.getString(PKG, "JobFTP.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Proxy host line
wProxyHost = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.ProxyHost.Label"), BaseMessages.getString(PKG, "JobFTP.ProxyHost.Tooltip"));
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.ProxyPort.Label"), BaseMessages.getString(PKG, "JobFTP.ProxyPort.Tooltip"));
props.setLook(wProxyPort);
wProxyPort.addModifyListener(lsMod);
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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.ProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTP.ProxyUsername.Tooltip"));
props.setLook(wProxyUsername);
wProxyUsername.addModifyListener(lsMod);
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(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobFTP.ProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTP.ProxyPassword.Tooltip"), true);
props.setLook(wProxyPassword);
wProxyPassword.addModifyListener(lsMod);
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
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobFTP.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobFTP.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wProxyPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
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///
// /
wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedSettings);
wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobFTP.AdvancedSettings.Group.Label"));
FormLayout AdvancedSettingsgroupLayout = new FormLayout();
AdvancedSettingsgroupLayout.marginWidth = 10;
AdvancedSettingsgroupLayout.marginHeight = 10;
wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
// Binary mode selection...
wlBinaryMode = new Label(wAdvancedSettings, SWT.RIGHT);
wlBinaryMode.setText(BaseMessages.getString(PKG, "JobFTP.BinaryMode.Label"));
props.setLook(wlBinaryMode);
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, "JobFTP.BinaryMode.Tooltip"));
fdBinaryMode = new FormData();
fdBinaryMode.left = new FormAttachment(middle, margin);
fdBinaryMode.top = new FormAttachment(wServerSettings, margin);
fdBinaryMode.right = new FormAttachment(100, 0);
wBinaryMode.setLayoutData(fdBinaryMode);
// Timeout line
wTimeout = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobFTP.Timeout.Label"), BaseMessages.getString(PKG, "JobFTP.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wlBinaryMode, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// active connection?
wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
wlActive.setText(BaseMessages.getString(PKG, "JobFTP.ActiveConns.Label"));
props.setLook(wlActive);
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, "JobFTP.ActiveConns.Tooltip"));
props.setLook(wActive);
fdActive = new FormData();
fdActive.left = new FormAttachment(middle, margin);
fdActive.top = new FormAttachment(wTimeout, margin);
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
//
wlControlEncoding = new Label(wAdvancedSettings, SWT.RIGHT);
wlControlEncoding.setText(BaseMessages.getString(PKG, "JobFTP.ControlEncoding.Label"));
props.setLook(wlControlEncoding);
fdlControlEncoding = new FormData();
fdlControlEncoding.left = new FormAttachment(0, 0);
fdlControlEncoding.top = new FormAttachment(wActive, 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, "JobFTP.ControlEncoding.Tooltip"));
wControlEncoding.setItems(encodings);
props.setLook(wControlEncoding);
fdControlEncoding = new FormData();
fdControlEncoding.left = new FormAttachment(middle, margin);
fdControlEncoding.top = new FormAttachment(wActive, margin);
fdControlEncoding.right = new FormAttachment(100, 0);
wControlEncoding.setLayoutData(fdControlEncoding);
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
// ///////////////////////////////////////////////////////////
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 ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "JobFTP.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout FilesLayout = new FormLayout();
FilesLayout.marginWidth = 3;
FilesLayout.marginHeight = 3;
wFilesComp.setLayout(FilesLayout);
// ////////////////////////
// START OF Remote SETTINGS GROUP///
// /
wRemoteSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wRemoteSettings);
wRemoteSettings.setText(BaseMessages.getString(PKG, "JobFTP.RemoteSettings.Group.Label"));
FormLayout RemoteSettinsgroupLayout = new FormLayout();
RemoteSettinsgroupLayout.marginWidth = 10;
RemoteSettinsgroupLayout.marginHeight = 10;
wRemoteSettings.setLayout(RemoteSettinsgroupLayout);
// Move to directory
wlFtpDirectory = new Label(wRemoteSettings, SWT.RIGHT);
wlFtpDirectory.setText(BaseMessages.getString(PKG, "JobFTP.RemoteDir.Label"));
props.setLook(wlFtpDirectory);
fdlFtpDirectory = new FormData();
fdlFtpDirectory.left = new FormAttachment(0, 0);
fdlFtpDirectory.top = new FormAttachment(0, margin);
fdlFtpDirectory.right = new FormAttachment(middle, 0);
wlFtpDirectory.setLayoutData(fdlFtpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wRemoteSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobFTP.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(0, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
wFtpDirectory = new TextVar(jobMeta, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTP.RemoteDir.Tooltip"));
props.setLook(wFtpDirectory);
wFtpDirectory.addModifyListener(lsMod);
fdFtpDirectory = new FormData();
fdFtpDirectory.left = new FormAttachment(middle, margin);
fdFtpDirectory.top = new FormAttachment(0, margin);
fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFtpDirectory.setLayoutData(fdFtpDirectory);
// Wildcard line
wWildcard = new LabelTextVar(jobMeta, wRemoteSettings, BaseMessages.getString(PKG, "JobFTP.Wildcard.Label"), BaseMessages.getString(PKG, "JobFTP.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wFtpDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Remove files after retrieval...
wlRemove = new Label(wRemoteSettings, SWT.RIGHT);
wlRemove.setText(BaseMessages.getString(PKG, "JobFTP.RemoveFiles.Label"));
props.setLook(wlRemove);
fdlRemove = new FormData();
fdlRemove.left = new FormAttachment(0, 0);
fdlRemove.top = new FormAttachment(wWildcard, margin);
fdlRemove.right = new FormAttachment(middle, 0);
wlRemove.setLayoutData(fdlRemove);
wRemove = new Button(wRemoteSettings, SWT.CHECK);
wRemove.setToolTipText(BaseMessages.getString(PKG, "JobFTP.RemoveFiles.Tooltip"));
props.setLook(wRemove);
fdRemove = new FormData();
fdRemove.left = new FormAttachment(middle, margin);
fdRemove.top = new FormAttachment(wWildcard, margin);
fdRemove.right = new FormAttachment(100, 0);
wRemove.setLayoutData(fdRemove);
wRemove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (wRemove.getSelection()) {
wMove.setSelection(false);
activateMoveTo();
}
}
});
// Move files after the transfert?...
wlMove = new Label(wRemoteSettings, SWT.RIGHT);
wlMove.setText(BaseMessages.getString(PKG, "JobFTP.MoveFiles.Label"));
props.setLook(wlMove);
fdlMove = new FormData();
fdlMove.left = new FormAttachment(0, 0);
fdlMove.top = new FormAttachment(wRemove, margin);
fdlMove.right = new FormAttachment(middle, -margin);
wlMove.setLayoutData(fdlMove);
wMove = new Button(wRemoteSettings, SWT.CHECK);
props.setLook(wMove);
wMove.setToolTipText(BaseMessages.getString(PKG, "JobFTP.MoveFiles.Tooltip"));
fdMove = new FormData();
fdMove.left = new FormAttachment(middle, margin);
fdMove.top = new FormAttachment(wRemove, margin);
fdMove.right = new FormAttachment(100, 0);
wMove.setLayoutData(fdMove);
wMove.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activateMoveTo();
if (wMove.getSelection()) {
wRemove.setSelection(false);
}
}
});
// Move to directory
wlMoveToDirectory = new Label(wRemoteSettings, SWT.RIGHT);
wlMoveToDirectory.setText(BaseMessages.getString(PKG, "JobFTP.MoveFolder.Label"));
props.setLook(wlMoveToDirectory);
fdlMoveToDirectory = new FormData();
fdlMoveToDirectory.left = new FormAttachment(0, 0);
fdlMoveToDirectory.top = new FormAttachment(wMove, margin);
fdlMoveToDirectory.right = new FormAttachment(middle, 0);
wlMoveToDirectory.setLayoutData(fdlMoveToDirectory);
// Test remote folder button ...
wbTestFolderExists = new Button(wRemoteSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestFolderExists);
wbTestFolderExists.setText(BaseMessages.getString(PKG, "JobFTP.TestFolderExists.Label"));
fdbTestFolderExists = new FormData();
fdbTestFolderExists.right = new FormAttachment(100, 0);
fdbTestFolderExists.top = new FormAttachment(wMove, margin);
wbTestFolderExists.setLayoutData(fdbTestFolderExists);
wMoveToDirectory = new TextVar(jobMeta, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTP.MoveToDirectory.Tooltip"));
wMoveToDirectory.setToolTipText(BaseMessages.getString(PKG, "JobFTP.MoveFolder.Tooltip"));
props.setLook(wMoveToDirectory);
wMoveToDirectory.addModifyListener(lsMod);
fdMoveToDirectory = new FormData();
fdMoveToDirectory.left = new FormAttachment(middle, margin);
fdMoveToDirectory.top = new FormAttachment(wMove, margin);
fdMoveToDirectory.right = new FormAttachment(wbTestFolderExists, -margin);
wMoveToDirectory.setLayoutData(fdMoveToDirectory);
// create destination folder?...
wlCreateMoveFolder = new Label(wRemoteSettings, SWT.RIGHT);
wlCreateMoveFolder.setText(BaseMessages.getString(PKG, "JobFTP.CreateMoveFolder.Label"));
props.setLook(wlCreateMoveFolder);
fdlCreateMoveFolder = new FormData();
fdlCreateMoveFolder.left = new FormAttachment(0, 0);
fdlCreateMoveFolder.top = new FormAttachment(wMoveToDirectory, margin);
fdlCreateMoveFolder.right = new FormAttachment(middle, 0);
wlCreateMoveFolder.setLayoutData(fdlCreateMoveFolder);
wCreateMoveFolder = new Button(wRemoteSettings, SWT.CHECK);
wCreateMoveFolder.setToolTipText(BaseMessages.getString(PKG, "JobFTP.CreateMoveFolder.Tooltip"));
props.setLook(wCreateMoveFolder);
fdCreateMoveFolder = new FormData();
fdCreateMoveFolder.left = new FormAttachment(middle, margin);
fdCreateMoveFolder.top = new FormAttachment(wMoveToDirectory, margin);
fdCreateMoveFolder.right = new FormAttachment(100, 0);
wCreateMoveFolder.setLayoutData(fdCreateMoveFolder);
fdRemoteSettings = new FormData();
fdRemoteSettings.left = new FormAttachment(0, margin);
fdRemoteSettings.top = new FormAttachment(0, 2 * margin);
fdRemoteSettings.right = new FormAttachment(100, -margin);
wRemoteSettings.setLayoutData(fdRemoteSettings);
// ///////////////////////////////////////////////////////////
// / END OF Remote SETTINGSGROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF LOCAL SETTINGS GROUP///
// /
wLocalSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wLocalSettings);
wLocalSettings.setText(BaseMessages.getString(PKG, "JobFTP.LocalSettings.Group.Label"));
FormLayout LocalSettinsgroupLayout = new FormLayout();
LocalSettinsgroupLayout.marginWidth = 10;
LocalSettinsgroupLayout.marginHeight = 10;
wLocalSettings.setLayout(LocalSettinsgroupLayout);
// TargetDirectory
wlTargetDirectory = new Label(wLocalSettings, SWT.RIGHT);
wlTargetDirectory.setText(BaseMessages.getString(PKG, "JobFTP.TargetDir.Label"));
props.setLook(wlTargetDirectory);
fdlTargetDirectory = new FormData();
fdlTargetDirectory.left = new FormAttachment(0, 0);
fdlTargetDirectory.top = new FormAttachment(wRemoteSettings, margin);
fdlTargetDirectory.right = new FormAttachment(middle, -margin);
wlTargetDirectory.setLayoutData(fdlTargetDirectory);
// Browse folders button ...
wbTargetDirectory = new Button(wLocalSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTargetDirectory);
wbTargetDirectory.setText(BaseMessages.getString(PKG, "JobFTP.BrowseFolders.Label"));
fdbTargetDirectory = new FormData();
fdbTargetDirectory.right = new FormAttachment(100, 0);
fdbTargetDirectory.top = new FormAttachment(wRemoteSettings, margin);
wbTargetDirectory.setLayoutData(fdbTargetDirectory);
wbTargetDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wTargetDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wTargetDirectory.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wTargetDirectory.setText(dir);
}
}
});
wTargetDirectory = new TextVar(jobMeta, wLocalSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTP.TargetDir.Tooltip"));
props.setLook(wTargetDirectory);
wTargetDirectory.addModifyListener(lsMod);
fdTargetDirectory = new FormData();
fdTargetDirectory.left = new FormAttachment(middle, margin);
fdTargetDirectory.top = new FormAttachment(wRemoteSettings, margin);
fdTargetDirectory.right = new FormAttachment(wbTargetDirectory, -margin);
wTargetDirectory.setLayoutData(fdTargetDirectory);
// Create multi-part file?
wlAddDate = new Label(wLocalSettings, SWT.RIGHT);
wlAddDate.setText(BaseMessages.getString(PKG, "JobFTP.AddDate.Label"));
props.setLook(wlAddDate);
fdlAddDate = new FormData();
fdlAddDate.left = new FormAttachment(0, 0);
fdlAddDate.top = new FormAttachment(wTargetDirectory, margin);
fdlAddDate.right = new FormAttachment(middle, -margin);
wlAddDate.setLayoutData(fdlAddDate);
wAddDate = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wAddDate);
wAddDate.setToolTipText(BaseMessages.getString(PKG, "JobFTP.AddDate.Tooltip"));
fdAddDate = new FormData();
fdAddDate.left = new FormAttachment(middle, margin);
fdAddDate.top = new FormAttachment(wTargetDirectory, margin);
fdAddDate.right = new FormAttachment(100, 0);
wAddDate.setLayoutData(fdAddDate);
wAddDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Create multi-part file?
wlAddTime = new Label(wLocalSettings, SWT.RIGHT);
wlAddTime.setText(BaseMessages.getString(PKG, "JobFTP.AddTime.Label"));
props.setLook(wlAddTime);
fdlAddTime = new FormData();
fdlAddTime.left = new FormAttachment(0, 0);
fdlAddTime.top = new FormAttachment(wAddDate, margin);
fdlAddTime.right = new FormAttachment(middle, -margin);
wlAddTime.setLayoutData(fdlAddTime);
wAddTime = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wAddTime);
wAddTime.setToolTipText(BaseMessages.getString(PKG, "JobFTP.AddTime.Tooltip"));
fdAddTime = new FormData();
fdAddTime.left = new FormAttachment(middle, margin);
fdAddTime.top = new FormAttachment(wAddDate, margin);
fdAddTime.right = new FormAttachment(100, 0);
wAddTime.setLayoutData(fdAddTime);
wAddTime.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Specify date time format?
wlSpecifyFormat = new Label(wLocalSettings, SWT.RIGHT);
wlSpecifyFormat.setText(BaseMessages.getString(PKG, "JobFTP.SpecifyFormat.Label"));
props.setLook(wlSpecifyFormat);
fdlSpecifyFormat = new FormData();
fdlSpecifyFormat.left = new FormAttachment(0, 0);
fdlSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdlSpecifyFormat.right = new FormAttachment(middle, -margin);
wlSpecifyFormat.setLayoutData(fdlSpecifyFormat);
wSpecifyFormat = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wSpecifyFormat);
wSpecifyFormat.setToolTipText(BaseMessages.getString(PKG, "JobFTP.SpecifyFormat.Tooltip"));
fdSpecifyFormat = new FormData();
fdSpecifyFormat.left = new FormAttachment(middle, margin);
fdSpecifyFormat.top = new FormAttachment(wAddTime, margin);
fdSpecifyFormat.right = new FormAttachment(100, 0);
wSpecifyFormat.setLayoutData(fdSpecifyFormat);
wSpecifyFormat.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
setDateTimeFormat();
setAddDateBeforeExtension();
}
});
// Prepare a list of possible DateTimeFormats...
String[] dats = Const.getDateFormats();
// DateTimeFormat
wlDateTimeFormat = new Label(wLocalSettings, SWT.RIGHT);
wlDateTimeFormat.setText(BaseMessages.getString(PKG, "JobFTP.DateTimeFormat.Label"));
props.setLook(wlDateTimeFormat);
fdlDateTimeFormat = new FormData();
fdlDateTimeFormat.left = new FormAttachment(0, 0);
fdlDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdlDateTimeFormat.right = new FormAttachment(middle, -margin);
wlDateTimeFormat.setLayoutData(fdlDateTimeFormat);
wDateTimeFormat = new CCombo(wLocalSettings, SWT.BORDER | SWT.READ_ONLY);
wDateTimeFormat.setEditable(true);
props.setLook(wDateTimeFormat);
wDateTimeFormat.addModifyListener(lsMod);
fdDateTimeFormat = new FormData();
fdDateTimeFormat.left = new FormAttachment(middle, margin);
fdDateTimeFormat.top = new FormAttachment(wSpecifyFormat, margin);
fdDateTimeFormat.right = new FormAttachment(100, 0);
wDateTimeFormat.setLayoutData(fdDateTimeFormat);
for (String dat : dats) {
wDateTimeFormat.add(dat);
}
// Add Date before extension?
wlAddDateBeforeExtension = new Label(wLocalSettings, SWT.RIGHT);
wlAddDateBeforeExtension.setText(BaseMessages.getString(PKG, "JobFTP.AddDateBeforeExtension.Label"));
props.setLook(wlAddDateBeforeExtension);
fdlAddDateBeforeExtension = new FormData();
fdlAddDateBeforeExtension.left = new FormAttachment(0, 0);
fdlAddDateBeforeExtension.top = new FormAttachment(wDateTimeFormat, margin);
fdlAddDateBeforeExtension.right = new FormAttachment(middle, -margin);
wlAddDateBeforeExtension.setLayoutData(fdlAddDateBeforeExtension);
wAddDateBeforeExtension = new Button(wLocalSettings, SWT.CHECK);
props.setLook(wAddDateBeforeExtension);
wAddDateBeforeExtension.setToolTipText(BaseMessages.getString(PKG, "JobFTP.AddDateBeforeExtension.Tooltip"));
fdAddDateBeforeExtension = new FormData();
fdAddDateBeforeExtension.left = new FormAttachment(middle, margin);
fdAddDateBeforeExtension.top = new FormAttachment(wDateTimeFormat, margin);
fdAddDateBeforeExtension.right = new FormAttachment(100, 0);
wAddDateBeforeExtension.setLayoutData(fdAddDateBeforeExtension);
wAddDateBeforeExtension.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// OnlyNew files after retrieval...
wlOnlyNew = new Label(wLocalSettings, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "JobFTP.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wLocalSettings, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "JobFTP.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, margin);
fdOnlyNew.top = new FormAttachment(wAddDateBeforeExtension, margin);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
wOnlyNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeIfExists();
jobEntry.setChanged();
}
});
// If File Exists
wlIfFileExists = new Label(wLocalSettings, SWT.RIGHT);
wlIfFileExists.setText(BaseMessages.getString(PKG, "JobFTP.IfFileExists.Label"));
props.setLook(wlIfFileExists);
fdlIfFileExists = new FormData();
fdlIfFileExists.left = new FormAttachment(0, 0);
fdlIfFileExists.right = new FormAttachment(middle, 0);
fdlIfFileExists.top = new FormAttachment(wOnlyNew, margin);
wlIfFileExists.setLayoutData(fdlIfFileExists);
wIfFileExists = new CCombo(wLocalSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTP.Skip.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTP.Give_Unique_Name.Label"));
wIfFileExists.add(BaseMessages.getString(PKG, "JobFTP.Fail.Label"));
// +1: starts at -1
wIfFileExists.select(0);
props.setLook(wIfFileExists);
fdIfFileExists = new FormData();
fdIfFileExists.left = new FormAttachment(middle, margin);
fdIfFileExists.top = new FormAttachment(wOnlyNew, margin);
fdIfFileExists.right = new FormAttachment(100, 0);
wIfFileExists.setLayoutData(fdIfFileExists);
wIfFileExists.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Add filenames to result filenames...
wlAddFilenameToResult = new Label(wLocalSettings, SWT.RIGHT);
wlAddFilenameToResult.setText(BaseMessages.getString(PKG, "JobFTP.AddFilenameToResult.Label"));
props.setLook(wlAddFilenameToResult);
fdlAddFilenameToResult = new FormData();
fdlAddFilenameToResult.left = new FormAttachment(0, 0);
fdlAddFilenameToResult.top = new FormAttachment(wIfFileExists, 2 * margin);
fdlAddFilenameToResult.right = new FormAttachment(middle, 0);
wlAddFilenameToResult.setLayoutData(fdlAddFilenameToResult);
wAddFilenameToResult = new Button(wLocalSettings, SWT.CHECK);
wAddFilenameToResult.setToolTipText(BaseMessages.getString(PKG, "JobFTP.AddFilenameToResult.Tooltip"));
props.setLook(wAddFilenameToResult);
fdAddFilenameToResult = new FormData();
fdAddFilenameToResult.left = new FormAttachment(middle, margin);
fdAddFilenameToResult.top = new FormAttachment(wIfFileExists, 2 * margin);
fdAddFilenameToResult.right = new FormAttachment(100, 0);
wAddFilenameToResult.setLayoutData(fdAddFilenameToResult);
fdLocalSettings = new FormData();
fdLocalSettings.left = new FormAttachment(0, margin);
fdLocalSettings.top = new FormAttachment(wRemoteSettings, margin);
fdLocalSettings.right = new FormAttachment(100, -margin);
wLocalSettings.setLayoutData(fdLocalSettings);
// ///////////////////////////////////////////////////////////
// / END OF LOCAL SETTINGSGROUP
// ///////////////////////////////////////////////////////////
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 Advanced TAB ///
// ////////////////////////
wAdvancedTab = new CTabItem(wTabFolder, SWT.NONE);
wAdvancedTab.setText(BaseMessages.getString(PKG, "JobFTP.Tab.Advanced.Label"));
wAdvancedComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wAdvancedComp);
FormLayout AdvancedLayout = new FormLayout();
AdvancedLayout.marginWidth = 3;
AdvancedLayout.marginHeight = 3;
wAdvancedComp.setLayout(AdvancedLayout);
// SuccessOngrouping?
// ////////////////////////
// START OF SUCCESS ON GROUP///
// /
wSuccessOn = new Group(wAdvancedComp, SWT.SHADOW_NONE);
props.setLook(wSuccessOn);
wSuccessOn.setText(BaseMessages.getString(PKG, "JobFTP.SuccessOn.Group.Label"));
FormLayout successongroupLayout = new FormLayout();
successongroupLayout.marginWidth = 10;
successongroupLayout.marginHeight = 10;
wSuccessOn.setLayout(successongroupLayout);
// Success Condition
wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
wlSuccessCondition.setText(BaseMessages.getString(PKG, "JobFTP.SuccessCondition.Label") + " ");
props.setLook(wlSuccessCondition);
fdlSuccessCondition = new FormData();
fdlSuccessCondition.left = new FormAttachment(0, 0);
fdlSuccessCondition.right = new FormAttachment(middle, 0);
fdlSuccessCondition.top = new FormAttachment(0, margin);
wlSuccessCondition.setLayoutData(fdlSuccessCondition);
wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTP.SuccessWhenAllWorksFine.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTP.SuccessWhenAtLeat.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "JobFTP.SuccessWhenNrErrorsLessThan.Label"));
// +1: starts at -1
wSuccessCondition.select(0);
props.setLook(wSuccessCondition);
fdSuccessCondition = new FormData();
fdSuccessCondition.left = new FormAttachment(middle, 0);
fdSuccessCondition.top = new FormAttachment(0, margin);
fdSuccessCondition.right = new FormAttachment(100, 0);
wSuccessCondition.setLayoutData(fdSuccessCondition);
wSuccessCondition.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeSuccessCondition();
}
});
// Success when number of errors less than
wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT);
wlNrErrorsLessThan.setText(BaseMessages.getString(PKG, "JobFTP.NrBadFormedLessThan.Label") + " ");
props.setLook(wlNrErrorsLessThan);
fdlNrErrorsLessThan = new FormData();
fdlNrErrorsLessThan.left = new FormAttachment(0, 0);
fdlNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdlNrErrorsLessThan.right = new FormAttachment(middle, -margin);
wlNrErrorsLessThan.setLayoutData(fdlNrErrorsLessThan);
wNrErrorsLessThan = new TextVar(jobMeta, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobFTP.NrBadFormedLessThan.Tooltip"));
props.setLook(wNrErrorsLessThan);
wNrErrorsLessThan.addModifyListener(lsMod);
fdNrErrorsLessThan = new FormData();
fdNrErrorsLessThan.left = new FormAttachment(middle, 0);
fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdNrErrorsLessThan.right = new FormAttachment(100, -margin);
wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan);
fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(0, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON GROUP
// ///////////////////////////////////////////////////////////
fdAdvancedComp = new FormData();
fdAdvancedComp.left = new FormAttachment(0, 0);
fdAdvancedComp.top = new FormAttachment(0, 0);
fdAdvancedComp.right = new FormAttachment(100, 0);
fdAdvancedComp.bottom = new FormAttachment(100, 0);
wAdvancedComp.setLayoutData(fdAdvancedComp);
wAdvancedComp.layout();
wAdvancedTab.setControl(wAdvancedComp);
props.setLook(wAdvancedComp);
// ///////////////////////////////////////////////////////////
// / END OF Advanced TAB
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Start of Socks Proxy Tab
// ///////////////////////////////////////////////////////////
wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
wSocksProxyTab.setText(BaseMessages.getString(PKG, "JobFTP.Tab.Socks.Label"));
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
// ////////////////////////////////////////////////////////
wSocksProxy = new Group(wSocksProxyComp, SWT.SHADOW_NONE);
props.setLook(wSocksProxy);
wSocksProxy.setText(BaseMessages.getString(PKG, "JobFTP.SocksProxy.Group.Label"));
FormLayout SocksProxyGroupLayout = new FormLayout();
SocksProxyGroupLayout.marginWidth = 10;
SocksProxyGroupLayout.marginHeight = 10;
wSocksProxy.setLayout(SocksProxyGroupLayout);
// host line
wSocksProxyHost = new LabelTextVar(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTP.SocksProxyHost.Label"), BaseMessages.getString(PKG, "JobFTP.SocksProxyHost.Tooltip"));
props.setLook(wSocksProxyHost);
wSocksProxyHost.addModifyListener(lsMod);
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(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTP.SocksProxyPort.Label"), BaseMessages.getString(PKG, "JobFTP.SocksProxyPort.Tooltip"));
props.setLook(wSocksProxyPort);
wSocksProxyPort.addModifyListener(lsMod);
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(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTP.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "JobFTP.SocksProxyPassword.Tooltip"));
props.setLook(wSocksProxyUsername);
wSocksProxyUsername.addModifyListener(lsMod);
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(jobMeta, wSocksProxy, BaseMessages.getString(PKG, "JobFTP.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "JobFTP.SocksProxyPassword.Tooltip"), true);
props.setLook(wSocksProxyPort);
wSocksProxyPassword.addModifyListener(lsMod);
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
// ///////////////////////////////////////////////////////////////
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
// ////////////////////////////////////////////////////////
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(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCheckFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(false, true, wMoveToDirectory.getText());
}
};
lsCheckChangeFolder = new Listener() {
public void handleEvent(Event e) {
checkRemoteFolder(true, false, wFtpDirectory.getText());
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wbTestFolderExists.addListener(SWT.Selection, lsCheckFolder);
wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckChangeFolder);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wTargetDirectory.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activateMoveTo();
setDateTimeFormat();
setAddDateBeforeExtension();
activeSuccessCondition();
activeIfExists();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobFTPDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelText in project pentaho-kettle by pentaho.
the class JobEntrySSH2PUTDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
conn = null;
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobSSH2PUT.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSSH2PUT.Name.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobSSH2PUT.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF Host GROUP
// ////////////////////////
wHost = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wHost);
wHost.setText(BaseMessages.getString(PKG, "JobMail.Group.Host.Label"));
FormLayout HostLayout = new FormLayout();
HostLayout.marginWidth = 10;
HostLayout.marginHeight = 10;
wHost.setLayout(HostLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2PUT.Server.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wHost, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "JobSSH2PUT.Port.Label"));
props.setLook(wlServerPort);
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(jobMeta, wHost, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.Port.Tooltip"));
wServerPort.addModifyListener(lsMod);
fdServerPort = new FormData();
fdServerPort.left = new FormAttachment(middle, margin);
fdServerPort.top = new FormAttachment(wServerName, margin);
fdServerPort.right = new FormAttachment(100, 0);
wServerPort.setLayoutData(fdServerPort);
// cacheHostKey
wlcacheHostKey = new Label(wHost, SWT.RIGHT);
wlcacheHostKey.setText(BaseMessages.getString(PKG, "JobSSH2PUT.cacheHostKeyFiles.Label"));
props.setLook(wlcacheHostKey);
fdlcacheHostKey = new FormData();
fdlcacheHostKey.left = new FormAttachment(0, 0);
fdlcacheHostKey.top = new FormAttachment(wServerPort, margin);
fdlcacheHostKey.right = new FormAttachment(middle, 0);
wlcacheHostKey.setLayoutData(fdlcacheHostKey);
wcacheHostKey = new Button(wHost, SWT.CHECK);
wcacheHostKey.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.cacheHostKeyFiles.Tooltip"));
props.setLook(wcacheHostKey);
fdcacheHostKey = new FormData();
fdcacheHostKey.left = new FormAttachment(middle, margin);
fdcacheHostKey.top = new FormAttachment(wServerPort, margin);
fdcacheHostKey.right = new FormAttachment(100, 0);
wcacheHostKey.setLayoutData(fdcacheHostKey);
wcacheHostKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// UserName line
wUserName = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2PUT.User.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wcacheHostKey, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2PUT.Password.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Timeout line
wTimeout = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2PUT.Timeout.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wPassword, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// Test connection button
wTest = new Button(wHost, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobSSH2PUT.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wTimeout, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdHost = new FormData();
fdHost.left = new FormAttachment(0, margin);
fdHost.top = new FormAttachment(wName, margin);
fdHost.right = new FormAttachment(100, -margin);
wHost.setLayoutData(fdHost);
// ///////////////////////////////////////////////////////////
// / END OF Host GROUP
// /////////////////////////////////////////////////////////
// ////////////////////////
// START OF HTTPProxy GROUP
// ////////////////////////
wHTTPProxyGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wHTTPProxyGroup);
wHTTPProxyGroup.setText(BaseMessages.getString(PKG, "JobSSH2PUT.Group.HTTPProxyGroup.Label"));
FormLayout HTTPProxyGroupLayout = new FormLayout();
HTTPProxyGroupLayout.marginWidth = 10;
HTTPProxyGroupLayout.marginHeight = 10;
wHTTPProxyGroup.setLayout(HTTPProxyGroupLayout);
// useHTTPProxy
wluseHTTPProxy = new Label(wHTTPProxyGroup, SWT.RIGHT);
wluseHTTPProxy.setText(BaseMessages.getString(PKG, "JobSSH2PUT.useHTTPProxyFiles.Label"));
props.setLook(wluseHTTPProxy);
fdluseHTTPProxy = new FormData();
fdluseHTTPProxy.left = new FormAttachment(0, 0);
fdluseHTTPProxy.top = new FormAttachment(wHost, margin);
fdluseHTTPProxy.right = new FormAttachment(middle, 0);
wluseHTTPProxy.setLayoutData(fdluseHTTPProxy);
wuseHTTPProxy = new Button(wHTTPProxyGroup, SWT.CHECK);
wuseHTTPProxy.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.useHTTPProxyFiles.Tooltip"));
props.setLook(wuseHTTPProxy);
fduseHTTPProxy = new FormData();
fduseHTTPProxy.left = new FormAttachment(middle, margin);
fduseHTTPProxy.top = new FormAttachment(wHost, margin);
fduseHTTPProxy.right = new FormAttachment(100, 0);
wuseHTTPProxy.setLayoutData(fduseHTTPProxy);
wuseHTTPProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUseHttpProxy();
jobEntry.setChanged();
}
});
// ProxyHost line
wHTTPProxyHost = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2PUT.ProxyHost.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.Server.Tooltip"));
props.setLook(wHTTPProxyHost);
wHTTPProxyHost.addModifyListener(lsMod);
fdHTTPProxyHost = new FormData();
fdHTTPProxyHost.left = new FormAttachment(0, 0);
fdHTTPProxyHost.top = new FormAttachment(wuseHTTPProxy, margin);
fdHTTPProxyHost.right = new FormAttachment(100, 0);
wHTTPProxyHost.setLayoutData(fdHTTPProxyHost);
// ProxyPort line
wlHTTPProxyPort = new Label(wHTTPProxyGroup, SWT.RIGHT);
wlHTTPProxyPort.setText(BaseMessages.getString(PKG, "JobSSH2PUT.ProxyPort.Label"));
props.setLook(wlHTTPProxyPort);
fdlProxyPort = new FormData();
fdlProxyPort.left = new FormAttachment(0, 0);
fdlProxyPort.top = new FormAttachment(wHTTPProxyHost, margin);
fdlProxyPort.right = new FormAttachment(middle, -margin);
wlHTTPProxyPort.setLayoutData(fdlProxyPort);
wHTTPProxyPort = new TextVar(jobMeta, wHTTPProxyGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wHTTPProxyPort);
wHTTPProxyPort.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.ProxyPort.Tooltip"));
wHTTPProxyPort.addModifyListener(lsMod);
fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(middle, margin);
fdProxyPort.top = new FormAttachment(wHTTPProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wHTTPProxyPort.setLayoutData(fdProxyPort);
// useBasicAutentication
wluseBasicAuthentication = new Label(wHTTPProxyGroup, SWT.RIGHT);
wluseBasicAuthentication.setText(BaseMessages.getString(PKG, "JobSSH2PUT.useBasicAuthentication.Label"));
props.setLook(wluseBasicAuthentication);
fdluseBasicAuthentication = new FormData();
fdluseBasicAuthentication.left = new FormAttachment(0, 0);
fdluseBasicAuthentication.top = new FormAttachment(wHTTPProxyPort, margin);
fdluseBasicAuthentication.right = new FormAttachment(middle, 0);
wluseBasicAuthentication.setLayoutData(fdluseBasicAuthentication);
wuseBasicAuthentication = new Button(wHTTPProxyGroup, SWT.CHECK);
wuseBasicAuthentication.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.useBasicAuthentication.Tooltip"));
props.setLook(wuseBasicAuthentication);
fduseBasicAuthentication = new FormData();
fduseBasicAuthentication.left = new FormAttachment(middle, margin);
fduseBasicAuthentication.top = new FormAttachment(wHTTPProxyPort, margin);
fduseBasicAuthentication.right = new FormAttachment(100, 0);
wuseBasicAuthentication.setLayoutData(fduseBasicAuthentication);
wuseBasicAuthentication.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeuseBasicAutentication();
jobEntry.setChanged();
}
});
// ProxyUsername line
wHTTPProxyUsername = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2PUT.HttpProxyUsername.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.HttpProxyUsername.Tooltip"));
props.setLook(wHTTPProxyUsername);
wHTTPProxyUsername.addModifyListener(lsMod);
fdHTTPProxyUsername = new FormData();
fdHTTPProxyUsername.left = new FormAttachment(0, 0);
fdHTTPProxyUsername.top = new FormAttachment(wuseBasicAuthentication, margin);
fdHTTPProxyUsername.right = new FormAttachment(100, 0);
wHTTPProxyUsername.setLayoutData(fdHTTPProxyUsername);
// HttpProxyPassword line
wHTTPProxyPassword = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2PUT.HttpProxyPassword.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.HttpProxyPassword.Tooltip"), true);
props.setLook(wHTTPProxyPassword);
wHTTPProxyPassword.addModifyListener(lsMod);
fdHTTPProxyPassword = new FormData();
fdHTTPProxyPassword.left = new FormAttachment(0, 0);
fdHTTPProxyPassword.top = new FormAttachment(wHTTPProxyUsername, margin);
fdHTTPProxyPassword.right = new FormAttachment(100, 0);
wHTTPProxyPassword.setLayoutData(fdHTTPProxyPassword);
fdHTTPProxyGroup = new FormData();
fdHTTPProxyGroup.left = new FormAttachment(0, margin);
fdHTTPProxyGroup.top = new FormAttachment(wHost, margin);
fdHTTPProxyGroup.right = new FormAttachment(100, -margin);
wHTTPProxyGroup.setLayoutData(fdHTTPProxyGroup);
// ///////////////////////////////////////////////////////////
// / END OF HTTPProxy GROUP
// /////////////////////////////////////////////////////////
// ////////////////////////
// START OF PublicKey GROUP
// ////////////////////////
wPublicKey = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wPublicKey);
wPublicKey.setText(BaseMessages.getString(PKG, "JobSSH2PUT.Group.PublicKey.Label"));
FormLayout PublicKeyLayout = new FormLayout();
PublicKeyLayout.marginWidth = 10;
PublicKeyLayout.marginHeight = 10;
wPublicKey.setLayout(PublicKeyLayout);
// usePublicKey
wlusePublicKey = new Label(wPublicKey, SWT.RIGHT);
wlusePublicKey.setText(BaseMessages.getString(PKG, "JobSSH2PUT.usePublicKeyFiles.Label"));
props.setLook(wlusePublicKey);
fdlusePublicKey = new FormData();
fdlusePublicKey.left = new FormAttachment(0, 0);
fdlusePublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdlusePublicKey.right = new FormAttachment(middle, 0);
wlusePublicKey.setLayoutData(fdlusePublicKey);
wusePublicKey = new Button(wPublicKey, SWT.CHECK);
wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.usePublicKeyFiles.Tooltip"));
props.setLook(wusePublicKey);
fdusePublicKey = new FormData();
fdusePublicKey.left = new FormAttachment(middle, margin);
fdusePublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdusePublicKey.right = new FormAttachment(100, 0);
wusePublicKey.setLayoutData(fdusePublicKey);
wusePublicKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUsePublicKey();
jobEntry.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wPublicKey, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "JobSSH2PUT.KeyFilename.Label"));
props.setLook(wlKeyFilename);
fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wPublicKey, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
// fdbKeyFilename.height = 22;
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(jobMeta, wPublicKey, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.KeyFilename.Tooltip"));
props.setLook(wKeyFilename);
wKeyFilename.addModifyListener(lsMod);
fdKeyFilename = new FormData();
fdKeyFilename.left = new FormAttachment(middle, margin);
fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
wKeyFilename.setLayoutData(fdKeyFilename);
// Whenever something changes, set the tooltip to the expanded version:
wKeyFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wKeyFilename.setToolTipText(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
});
wbKeyFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.pem", "*" });
if (wKeyFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// keyfilePass line
wkeyfilePass = new LabelTextVar(jobMeta, wPublicKey, BaseMessages.getString(PKG, "JobSSH2PUT.keyfilePass.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.keyfilePass.Tooltip"), true);
props.setLook(wkeyfilePass);
wkeyfilePass.addModifyListener(lsMod);
fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, 0);
fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
fdkeyfilePass.right = new FormAttachment(100, 0);
wkeyfilePass.setLayoutData(fdkeyfilePass);
fdPublicKey = new FormData();
fdPublicKey.left = new FormAttachment(0, margin);
fdPublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdPublicKey.right = new FormAttachment(100, -margin);
wPublicKey.setLayoutData(fdPublicKey);
// ///////////////////////////////////////////////////////////
// / END OF PublicKey GROUP
// /////////////////////////////////////////////////////////
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(500, -margin);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF FILES TAB ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "JobSSH2PUT.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout FilesTabLayout = new FormLayout();
FilesTabLayout.marginWidth = 3;
FilesTabLayout.marginHeight = 3;
wFilesComp.setLayout(FilesTabLayout);
// ////////////////////////
// START OF Files GROUP
// ////////////////////////
wFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wFiles);
wFiles.setText(BaseMessages.getString(PKG, "JobSSH2PUT.Group.Files.Label"));
FormLayout FilesLayout = new FormLayout();
FilesLayout.marginWidth = 10;
FilesLayout.marginHeight = 10;
wFiles.setLayout(FilesLayout);
wlLocalDirectory = new Label(wFiles, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "JobSSH2PUT.LocalDir.Label"));
props.setLook(wlLocalDirectory);
fdlLocalDirectory = new FormData();
fdlLocalDirectory.left = new FormAttachment(0, 0);
fdlLocalDirectory.top = new FormAttachment(wFilesComp, 2 * margin);
fdlLocalDirectory.right = new FormAttachment(middle, -margin);
wlLocalDirectory.setLayoutData(fdlLocalDirectory);
// Browse Local folders button ...
wbLocalDirectory = new Button(wFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbLocalDirectory);
wbLocalDirectory.setText(BaseMessages.getString(PKG, "JobSSH2PUT.BrowseFolders.Label"));
fdbLocalDirectory = new FormData();
fdbLocalDirectory.right = new FormAttachment(100, -margin);
fdbLocalDirectory.top = new FormAttachment(0, margin);
wbLocalDirectory.setLayoutData(fdbLocalDirectory);
// LocalDirectory line
wLocalDirectory = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLocalDirectory);
wLocalDirectory.addModifyListener(lsMod);
fdLocalDirectory = new FormData();
fdLocalDirectory.left = new FormAttachment(middle, margin);
fdLocalDirectory.top = new FormAttachment(wFilesComp, 2 * margin);
fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, 0);
wLocalDirectory.setLayoutData(fdLocalDirectory);
// Whenever something changes, set the tooltip to the expanded version:
wLocalDirectory.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wLocalDirectory.setToolTipText(jobMeta.environmentSubstitute(wLocalDirectory.getText()));
}
});
wbLocalDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wLocalDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wLocalDirectory.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wLocalDirectory.setText(dir);
}
}
});
// Wildcard line
wWildcard = new LabelTextVar(jobMeta, wFiles, BaseMessages.getString(PKG, "JobSSH2PUT.Wildcard.Label"), BaseMessages.getString(PKG, "JobSSH2PUT.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wLocalDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// FTP directory
wlFtpDirectory = new Label(wFiles, SWT.RIGHT);
wlFtpDirectory.setText(BaseMessages.getString(PKG, "JobSSH2PUT.RemoteDir.Label"));
props.setLook(wlFtpDirectory);
fdlFtpDirectory = new FormData();
fdlFtpDirectory.left = new FormAttachment(0, 0);
fdlFtpDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdlFtpDirectory.right = new FormAttachment(middle, 0);
wlFtpDirectory.setLayoutData(fdlFtpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobSSH2PUT.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(wWildcard, 2 * margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
// FtpDirectory line
wFtpDirectory = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSSH2PUT.RemoteDir.Label"));
props.setLook(wFtpDirectory);
wFtpDirectory.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.RemoteDir.Tooltip"));
wFtpDirectory.addModifyListener(lsMod);
fdFtpDirectory = new FormData();
fdFtpDirectory.left = new FormAttachment(middle, margin);
fdFtpDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFtpDirectory.setLayoutData(fdFtpDirectory);
// Whenever something changes, set the tooltip to the expanded version:
wFtpDirectory.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFtpDirectory.setToolTipText(jobMeta.environmentSubstitute(wFtpDirectory.getText()));
}
});
// Create remote folder if necessary ...
wlCreateFolder = new Label(wFiles, SWT.RIGHT);
wlCreateFolder.setText(BaseMessages.getString(PKG, "JobSSH2PUT.CreateFolder.Label"));
props.setLook(wlCreateFolder);
fdlCreateFolder = new FormData();
fdlCreateFolder.left = new FormAttachment(0, 0);
fdlCreateFolder.top = new FormAttachment(wFtpDirectory, margin);
fdlCreateFolder.right = new FormAttachment(middle, 0);
wlCreateFolder.setLayoutData(fdlCreateFolder);
wCreateFolder = new Button(wFiles, SWT.CHECK);
wCreateFolder.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.CreateFolder.Tooltip"));
props.setLook(wCreateFolder);
fdCreateFolder = new FormData();
fdCreateFolder.left = new FormAttachment(middle, margin);
fdCreateFolder.top = new FormAttachment(wFtpDirectory, margin);
fdCreateFolder.right = new FormAttachment(100, 0);
wCreateFolder.setLayoutData(fdCreateFolder);
// OnlyNew files after retrieval...
wlOnlyNew = new Label(wFiles, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "JobSSH2PUT.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wCreateFolder, margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wFiles, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, margin);
fdOnlyNew.top = new FormAttachment(wCreateFolder, margin);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
// After FTP Put
wlAfterFTPPut = new Label(wFiles, SWT.RIGHT);
wlAfterFTPPut.setText(BaseMessages.getString(PKG, "JobSSH2PUT.AfterFTPPut.Label"));
props.setLook(wlAfterFTPPut);
fdlAfterFTPPut = new FormData();
fdlAfterFTPPut.left = new FormAttachment(0, 0);
fdlAfterFTPPut.right = new FormAttachment(middle, 0);
fdlAfterFTPPut.top = new FormAttachment(wOnlyNew, 2 * margin);
wlAfterFTPPut.setLayoutData(fdlAfterFTPPut);
wAfterFTPPut = new CCombo(wFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2PUT.Do_Nothing_AfterFTPPut.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2PUT.Delete_Files_AfterFTPPut.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2PUT.Move_Files_AfterFTPPut.Label"));
// +1: starts at -1
wAfterFTPPut.select(0);
props.setLook(wAfterFTPPut);
fdAfterFTPPut = new FormData();
fdAfterFTPPut.left = new FormAttachment(middle, 0);
fdAfterFTPPut.top = new FormAttachment(wOnlyNew, 2 * margin);
fdAfterFTPPut.right = new FormAttachment(100, 0);
wAfterFTPPut.setLayoutData(fdAfterFTPPut);
fdAfterFTPPut = new FormData();
fdAfterFTPPut.left = new FormAttachment(middle, margin);
fdAfterFTPPut.top = new FormAttachment(wOnlyNew, 2 * margin);
fdAfterFTPPut.right = new FormAttachment(100, 0);
wAfterFTPPut.setLayoutData(fdAfterFTPPut);
wAfterFTPPut.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
AfterFTPPutActivate();
}
});
// moveTo Directory
wlDestinationFolder = new Label(wFiles, SWT.RIGHT);
wlDestinationFolder.setText(BaseMessages.getString(PKG, "JobSSH2PUT.DestinationFolder.Label"));
props.setLook(wlDestinationFolder);
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(wFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbMovetoDirectory);
wbMovetoDirectory.setText(BaseMessages.getString(PKG, "JobSSH2PUT.BrowseFolders.Label"));
fdbMovetoDirectory = new FormData();
fdbMovetoDirectory.right = new FormAttachment(100, 0);
fdbMovetoDirectory.top = new FormAttachment(wAfterFTPPut, margin);
wbMovetoDirectory.setLayoutData(fdbMovetoDirectory);
wbMovetoDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wDestinationFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wDestinationFolder.setText(dir);
}
}
});
wDestinationFolder = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSSH2PUT.DestinationFolder.Tooltip"));
props.setLook(wDestinationFolder);
wDestinationFolder.addModifyListener(lsMod);
fdDestinationFolder = new FormData();
fdDestinationFolder.left = new FormAttachment(middle, margin);
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(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wDestinationFolder.setToolTipText(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
}
});
// Create destination folder if necessary ...
wlCreateDestinationFolder = new Label(wFiles, SWT.RIGHT);
wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "JobSSH2PUT.CreateDestinationFolder.Label"));
props.setLook(wlCreateDestinationFolder);
fdlCreateDestinationFolder = new FormData();
fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
fdlCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdlCreateDestinationFolder.right = new FormAttachment(middle, 0);
wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
wCreateDestinationFolder = new Button(wFiles, SWT.CHECK);
wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "JobSSH2PUT.CreateDestinationFolder.Tooltip"));
props.setLook(wCreateDestinationFolder);
fdCreateDestinationFolder = new FormData();
fdCreateDestinationFolder.left = new FormAttachment(middle, margin);
fdCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdCreateDestinationFolder.right = new FormAttachment(100, 0);
wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
fdFiles = new FormData();
fdFiles.left = new FormAttachment(0, margin);
fdFiles.top = new FormAttachment(0, margin);
fdFiles.right = new FormAttachment(100, -margin);
wFiles.setLayoutData(fdFiles);
// ///////////////////////////////////////////////////////////
// / END OF Files GROUP
// /////////////////////////////////////////////////////////
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(500, -margin);
wFilesComp.setLayoutData(fdFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
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(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCheckFolder = new Listener() {
public void handleEvent(Event e) {
checkFTPFolder();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckFolder);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wLocalDirectory.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
// wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activeUseHttpProxy();
AfterFTPPutActivate();
activeUsePublicKey();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobFTPDialogSize");
wTabFolder.setSelection(0);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelText in project pentaho-kettle by pentaho.
the class JobEntrySSH2GETDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
conn = null;
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobSSH2GET.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSSH2GET.Name.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobSSH2GET.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF Host GROUP
// ////////////////////////
wHost = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wHost);
wHost.setText(BaseMessages.getString(PKG, "JobMail.Group.Host.Label"));
FormLayout HostLayout = new FormLayout();
HostLayout.marginWidth = 10;
HostLayout.marginHeight = 10;
wHost.setLayout(HostLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.Server.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
wlServerPort = new Label(wHost, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "JobSSH2GET.Port.Label"));
props.setLook(wlServerPort);
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(jobMeta, wHost, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.Port.Tooltip"));
wServerPort.addModifyListener(lsMod);
fdServerPort = new FormData();
fdServerPort.left = new FormAttachment(middle, margin);
fdServerPort.top = new FormAttachment(wServerName, margin);
fdServerPort.right = new FormAttachment(100, 0);
wServerPort.setLayoutData(fdServerPort);
// cacheHostKey
wlcacheHostKey = new Label(wHost, SWT.RIGHT);
wlcacheHostKey.setText(BaseMessages.getString(PKG, "JobSSH2GET.cacheHostKeyFiles.Label"));
props.setLook(wlcacheHostKey);
fdlcacheHostKey = new FormData();
fdlcacheHostKey.left = new FormAttachment(0, 0);
fdlcacheHostKey.top = new FormAttachment(wServerPort, margin);
fdlcacheHostKey.right = new FormAttachment(middle, 0);
wlcacheHostKey.setLayoutData(fdlcacheHostKey);
wcacheHostKey = new Button(wHost, SWT.CHECK);
wcacheHostKey.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.cacheHostKeyFiles.Tooltip"));
props.setLook(wcacheHostKey);
fdcacheHostKey = new FormData();
fdcacheHostKey.left = new FormAttachment(middle, margin);
fdcacheHostKey.top = new FormAttachment(wServerPort, margin);
fdcacheHostKey.right = new FormAttachment(100, 0);
wcacheHostKey.setLayoutData(fdcacheHostKey);
wcacheHostKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// UserName line
wUserName = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.User.Label"), BaseMessages.getString(PKG, "JobSSH2GET.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wcacheHostKey, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.Password.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Timeout line
wTimeout = new LabelTextVar(jobMeta, wHost, BaseMessages.getString(PKG, "JobSSH2GET.Timeout.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wPassword, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// Test connection button
wTest = new Button(wHost, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobSSH2GET.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wTimeout, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdHost = new FormData();
fdHost.left = new FormAttachment(0, margin);
fdHost.top = new FormAttachment(wName, margin);
fdHost.right = new FormAttachment(100, -margin);
wHost.setLayoutData(fdHost);
// ///////////////////////////////////////////////////////////
// / END OF Host GROUP
// /////////////////////////////////////////////////////////
// ////////////////////////
// START OF HTTPProxy GROUP
// ////////////////////////
wHTTPProxyGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wHTTPProxyGroup);
wHTTPProxyGroup.setText(BaseMessages.getString(PKG, "JobSSH2GET.Group.HTTPProxyGroup.Label"));
FormLayout HTTPProxyGroupLayout = new FormLayout();
HTTPProxyGroupLayout.marginWidth = 10;
HTTPProxyGroupLayout.marginHeight = 10;
wHTTPProxyGroup.setLayout(HTTPProxyGroupLayout);
// useHTTPProxy
wluseHTTPProxy = new Label(wHTTPProxyGroup, SWT.RIGHT);
wluseHTTPProxy.setText(BaseMessages.getString(PKG, "JobSSH2GET.useHTTPProxyFiles.Label"));
props.setLook(wluseHTTPProxy);
fdluseHTTPProxy = new FormData();
fdluseHTTPProxy.left = new FormAttachment(0, 0);
fdluseHTTPProxy.top = new FormAttachment(wHost, margin);
fdluseHTTPProxy.right = new FormAttachment(middle, 0);
wluseHTTPProxy.setLayoutData(fdluseHTTPProxy);
wuseHTTPProxy = new Button(wHTTPProxyGroup, SWT.CHECK);
wuseHTTPProxy.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.useHTTPProxyFiles.Tooltip"));
props.setLook(wuseHTTPProxy);
fduseHTTPProxy = new FormData();
fduseHTTPProxy.left = new FormAttachment(middle, margin);
fduseHTTPProxy.top = new FormAttachment(wHost, margin);
fduseHTTPProxy.right = new FormAttachment(100, 0);
wuseHTTPProxy.setLayoutData(fduseHTTPProxy);
wuseHTTPProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUseHttpProxy();
jobEntry.setChanged();
}
});
// ProxyHost line
wHTTPProxyHost = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2GET.ProxyHost.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Server.Tooltip"));
props.setLook(wHTTPProxyHost);
wHTTPProxyHost.addModifyListener(lsMod);
fdHTTPProxyHost = new FormData();
fdHTTPProxyHost.left = new FormAttachment(0, 0);
fdHTTPProxyHost.top = new FormAttachment(wuseHTTPProxy, margin);
fdHTTPProxyHost.right = new FormAttachment(100, 0);
wHTTPProxyHost.setLayoutData(fdHTTPProxyHost);
// ProxyPort line
wlHTTPProxyPort = new Label(wHTTPProxyGroup, SWT.RIGHT);
wlHTTPProxyPort.setText(BaseMessages.getString(PKG, "JobSSH2GET.ProxyPort.Label"));
props.setLook(wlHTTPProxyPort);
fdlProxyPort = new FormData();
fdlProxyPort.left = new FormAttachment(0, 0);
fdlProxyPort.top = new FormAttachment(wHTTPProxyHost, margin);
fdlProxyPort.right = new FormAttachment(middle, -margin);
wlHTTPProxyPort.setLayoutData(fdlProxyPort);
wHTTPProxyPort = new TextVar(jobMeta, wHTTPProxyGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wHTTPProxyPort);
wHTTPProxyPort.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.ProxyPort.Tooltip"));
wHTTPProxyPort.addModifyListener(lsMod);
fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(middle, margin);
fdProxyPort.top = new FormAttachment(wHTTPProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wHTTPProxyPort.setLayoutData(fdProxyPort);
// useBasicAutentication
wluseBasicAuthentication = new Label(wHTTPProxyGroup, SWT.RIGHT);
wluseBasicAuthentication.setText(BaseMessages.getString(PKG, "JobSSH2GET.useBasicAuthentication.Label"));
props.setLook(wluseBasicAuthentication);
fdluseBasicAuthentication = new FormData();
fdluseBasicAuthentication.left = new FormAttachment(0, 0);
fdluseBasicAuthentication.top = new FormAttachment(wHTTPProxyPort, margin);
fdluseBasicAuthentication.right = new FormAttachment(middle, 0);
wluseBasicAuthentication.setLayoutData(fdluseBasicAuthentication);
wuseBasicAuthentication = new Button(wHTTPProxyGroup, SWT.CHECK);
wuseBasicAuthentication.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.useBasicAuthentication.Tooltip"));
props.setLook(wuseBasicAuthentication);
fduseBasicAuthentication = new FormData();
fduseBasicAuthentication.left = new FormAttachment(middle, margin);
fduseBasicAuthentication.top = new FormAttachment(wHTTPProxyPort, margin);
fduseBasicAuthentication.right = new FormAttachment(100, 0);
wuseBasicAuthentication.setLayoutData(fduseBasicAuthentication);
wuseBasicAuthentication.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeuseBasicAutentication();
jobEntry.setChanged();
}
});
// ProxyUsername line
wHTTPProxyUsername = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyUsername.Label"), BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyUsername.Tooltip"));
props.setLook(wHTTPProxyUsername);
wHTTPProxyUsername.addModifyListener(lsMod);
fdHTTPProxyUsername = new FormData();
fdHTTPProxyUsername.left = new FormAttachment(0, 0);
fdHTTPProxyUsername.top = new FormAttachment(wuseBasicAuthentication, margin);
fdHTTPProxyUsername.right = new FormAttachment(100, 0);
wHTTPProxyUsername.setLayoutData(fdHTTPProxyUsername);
// HttpProxyPassword line
wHTTPProxyPassword = new LabelTextVar(jobMeta, wHTTPProxyGroup, BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyPassword.Label"), BaseMessages.getString(PKG, "JobSSH2GET.HttpProxyPassword.Tooltip"), true);
props.setLook(wHTTPProxyPassword);
wHTTPProxyPassword.addModifyListener(lsMod);
fdHTTPProxyPassword = new FormData();
fdHTTPProxyPassword.left = new FormAttachment(0, 0);
fdHTTPProxyPassword.top = new FormAttachment(wHTTPProxyUsername, margin);
fdHTTPProxyPassword.right = new FormAttachment(100, 0);
wHTTPProxyPassword.setLayoutData(fdHTTPProxyPassword);
fdHTTPProxyGroup = new FormData();
fdHTTPProxyGroup.left = new FormAttachment(0, margin);
fdHTTPProxyGroup.top = new FormAttachment(wHost, margin);
fdHTTPProxyGroup.right = new FormAttachment(100, -margin);
wHTTPProxyGroup.setLayoutData(fdHTTPProxyGroup);
// ///////////////////////////////////////////////////////////
// / END OF HTTPProxy GROUP
// /////////////////////////////////////////////////////////
// ////////////////////////
// START OF PublicKey GROUP
// ////////////////////////
wPublicKey = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wPublicKey);
wPublicKey.setText(BaseMessages.getString(PKG, "JobSSH2GET.Group.PublicKey.Label"));
FormLayout PublicKeyLayout = new FormLayout();
PublicKeyLayout.marginWidth = 10;
PublicKeyLayout.marginHeight = 10;
wPublicKey.setLayout(PublicKeyLayout);
// usePublicKey
wlusePublicKey = new Label(wPublicKey, SWT.RIGHT);
wlusePublicKey.setText(BaseMessages.getString(PKG, "JobSSH2GET.usePublicKeyFiles.Label"));
props.setLook(wlusePublicKey);
fdlusePublicKey = new FormData();
fdlusePublicKey.left = new FormAttachment(0, 0);
fdlusePublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdlusePublicKey.right = new FormAttachment(middle, 0);
wlusePublicKey.setLayoutData(fdlusePublicKey);
wusePublicKey = new Button(wPublicKey, SWT.CHECK);
wusePublicKey.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.usePublicKeyFiles.Tooltip"));
props.setLook(wusePublicKey);
fdusePublicKey = new FormData();
fdusePublicKey.left = new FormAttachment(middle, margin);
fdusePublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdusePublicKey.right = new FormAttachment(100, 0);
wusePublicKey.setLayoutData(fdusePublicKey);
wusePublicKey.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeUsePublicKey();
jobEntry.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wPublicKey, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "JobSSH2GET.KeyFilename.Label"));
props.setLook(wlKeyFilename);
fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wPublicKey, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wusePublicKey, 0);
// fdbKeyFilename.height = 22;
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(jobMeta, wPublicKey, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.KeyFilename.Tooltip"));
props.setLook(wKeyFilename);
wKeyFilename.addModifyListener(lsMod);
fdKeyFilename = new FormData();
fdKeyFilename.left = new FormAttachment(middle, margin);
fdKeyFilename.top = new FormAttachment(wusePublicKey, margin);
fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
wKeyFilename.setLayoutData(fdKeyFilename);
// Whenever something changes, set the tooltip to the expanded version:
wKeyFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wKeyFilename.setToolTipText(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
});
wbKeyFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.pem", "*" });
if (wKeyFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wKeyFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wKeyFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// keyfilePass line
wkeyfilePass = new LabelTextVar(jobMeta, wPublicKey, BaseMessages.getString(PKG, "JobSSH2GET.keyfilePass.Label"), BaseMessages.getString(PKG, "JobSSH2GET.keyfilePass.Tooltip"), true);
props.setLook(wkeyfilePass);
wkeyfilePass.addModifyListener(lsMod);
fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, 0);
fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
fdkeyfilePass.right = new FormAttachment(100, 0);
wkeyfilePass.setLayoutData(fdkeyfilePass);
fdPublicKey = new FormData();
fdPublicKey.left = new FormAttachment(0, margin);
fdPublicKey.top = new FormAttachment(wHTTPProxyGroup, margin);
fdPublicKey.right = new FormAttachment(100, -margin);
wPublicKey.setLayoutData(fdPublicKey);
// ///////////////////////////////////////////////////////////
// / END OF PublicKey GROUP
// /////////////////////////////////////////////////////////
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(500, -margin);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF FILES TAB ///
// ////////////////////////
wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "JobSSH2GET.Tab.Files.Label"));
wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout FilesTabLayout = new FormLayout();
FilesTabLayout.marginWidth = 3;
FilesTabLayout.marginHeight = 3;
wFilesComp.setLayout(FilesTabLayout);
// ////////////////////////
// START OF Files GROUP
// ////////////////////////
wFiles = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wFiles);
wFiles.setText(BaseMessages.getString(PKG, "JobSSH2GET.Group.Files.Label"));
FormLayout FilesLayout = new FormLayout();
FilesLayout.marginWidth = 10;
FilesLayout.marginHeight = 10;
wFiles.setLayout(FilesLayout);
// FTP directory
wlFtpDirectory = new Label(wFiles, SWT.RIGHT);
wlFtpDirectory.setText(BaseMessages.getString(PKG, "JobSSH2GET.RemoteDir.Label"));
props.setLook(wlFtpDirectory);
fdlFtpDirectory = new FormData();
fdlFtpDirectory.left = new FormAttachment(0, 0);
fdlFtpDirectory.top = new FormAttachment(0, margin);
fdlFtpDirectory.right = new FormAttachment(middle, 0);
wlFtpDirectory.setLayoutData(fdlFtpDirectory);
// Test remote folder button ...
wbTestChangeFolderExists = new Button(wFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestChangeFolderExists);
wbTestChangeFolderExists.setText(BaseMessages.getString(PKG, "JobSSH2GET.TestFolderExists.Label"));
fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(0, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
// FtpDirectory line
wFtpDirectory = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSSH2GET.RemoteDir.Label"));
props.setLook(wFtpDirectory);
wFtpDirectory.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.RemoteDir.Tooltip"));
wFtpDirectory.addModifyListener(lsMod);
fdFtpDirectory = new FormData();
fdFtpDirectory.left = new FormAttachment(middle, margin);
fdFtpDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFtpDirectory.setLayoutData(fdFtpDirectory);
// Whenever something changes, set the tooltip to the expanded version:
wFtpDirectory.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFtpDirectory.setToolTipText(jobMeta.environmentSubstitute(wFtpDirectory.getText()));
}
});
// includeSubFolders
wlincludeSubFolders = new Label(wFiles, SWT.RIGHT);
wlincludeSubFolders.setText(BaseMessages.getString(PKG, "JobSSH2GET.includeSubFolders.Label"));
props.setLook(wlincludeSubFolders);
fdlincludeSubFolders = new FormData();
fdlincludeSubFolders.left = new FormAttachment(0, 0);
fdlincludeSubFolders.top = new FormAttachment(wFtpDirectory, margin);
fdlincludeSubFolders.right = new FormAttachment(middle, 0);
wlincludeSubFolders.setLayoutData(fdlincludeSubFolders);
wincludeSubFolders = new Button(wFiles, SWT.CHECK);
wincludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.includeSubFolders.Tooltip"));
props.setLook(wincludeSubFolders);
fdincludeSubFolders = new FormData();
fdincludeSubFolders.left = new FormAttachment(middle, margin);
fdincludeSubFolders.top = new FormAttachment(wFtpDirectory, margin);
fdincludeSubFolders.right = new FormAttachment(100, 0);
wincludeSubFolders.setLayoutData(fdincludeSubFolders);
wincludeSubFolders.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeuseBasicAutentication();
}
});
// Wildcard line
wWildcard = new LabelTextVar(jobMeta, wFiles, BaseMessages.getString(PKG, "JobSSH2GET.Wildcard.Label"), BaseMessages.getString(PKG, "JobSSH2GET.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wincludeSubFolders, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
wlLocalDirectory = new Label(wFiles, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "JobSSH2GET.TargetDir.Label"));
props.setLook(wlLocalDirectory);
fdlLocalDirectory = new FormData();
fdlLocalDirectory.left = new FormAttachment(0, 0);
fdlLocalDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdlLocalDirectory.right = new FormAttachment(middle, -margin);
wlLocalDirectory.setLayoutData(fdlLocalDirectory);
// Browse Local folders button ...
wbLocalDirectory = new Button(wFiles, SWT.PUSH | SWT.CENTER);
props.setLook(wbLocalDirectory);
wbLocalDirectory.setText(BaseMessages.getString(PKG, "JobSSH2GET.BrowseFolders.Label"));
fdbLocalDirectory = new FormData();
fdbLocalDirectory.right = new FormAttachment(100, -margin);
fdbLocalDirectory.top = new FormAttachment(wWildcard, margin);
wbLocalDirectory.setLayoutData(fdbLocalDirectory);
// LocalDirectory line
wLocalDirectory = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLocalDirectory);
wLocalDirectory.addModifyListener(lsMod);
fdLocalDirectory = new FormData();
fdLocalDirectory.left = new FormAttachment(middle, margin);
fdLocalDirectory.top = new FormAttachment(wWildcard, 2 * margin);
fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, 0);
wLocalDirectory.setLayoutData(fdLocalDirectory);
// Whenever something changes, set the tooltip to the expanded version:
wLocalDirectory.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wLocalDirectory.setToolTipText(jobMeta.environmentSubstitute(wLocalDirectory.getText()));
}
});
wbLocalDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wLocalDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wLocalDirectory.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wLocalDirectory.setText(dir);
}
}
});
// createTargetFolder
wlcreateTargetFolder = new Label(wFiles, SWT.RIGHT);
wlcreateTargetFolder.setText(BaseMessages.getString(PKG, "JobSSH2GET.createTargetFolder.Label"));
props.setLook(wlcreateTargetFolder);
fdlcreateTargetFolder = new FormData();
fdlcreateTargetFolder.left = new FormAttachment(0, 0);
fdlcreateTargetFolder.top = new FormAttachment(wLocalDirectory, margin);
fdlcreateTargetFolder.right = new FormAttachment(middle, 0);
wlcreateTargetFolder.setLayoutData(fdlcreateTargetFolder);
wcreateTargetFolder = new Button(wFiles, SWT.CHECK);
wcreateTargetFolder.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.createTargetFolder.Tooltip"));
props.setLook(wcreateTargetFolder);
fdcreateTargetFolder = new FormData();
fdcreateTargetFolder.left = new FormAttachment(middle, margin);
fdcreateTargetFolder.top = new FormAttachment(wLocalDirectory, margin);
fdcreateTargetFolder.right = new FormAttachment(100, 0);
wcreateTargetFolder.setLayoutData(fdcreateTargetFolder);
wcreateTargetFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeuseBasicAutentication();
}
});
// OnlyNew files after retrieval...
wlOnlyNew = new Label(wFiles, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "JobSSH2GET.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wcreateTargetFolder, margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wFiles, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, margin);
fdOnlyNew.top = new FormAttachment(wcreateTargetFolder, margin);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
// After FTP Put
wlAfterFTPPut = new Label(wFiles, SWT.RIGHT);
wlAfterFTPPut.setText(BaseMessages.getString(PKG, "JobSSH2GET.AfterFTPPut.Label"));
props.setLook(wlAfterFTPPut);
fdlAfterFTPPut = new FormData();
fdlAfterFTPPut.left = new FormAttachment(0, 0);
fdlAfterFTPPut.right = new FormAttachment(middle, 0);
fdlAfterFTPPut.top = new FormAttachment(wOnlyNew, 2 * margin);
wlAfterFTPPut.setLayoutData(fdlAfterFTPPut);
wAfterFTPPut = new CCombo(wFiles, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2GET.Do_Nothing_AfterFTPPut.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2GET.Delete_Files_AfterFTPPut.Label"));
wAfterFTPPut.add(BaseMessages.getString(PKG, "JobSSH2GET.Move_Files_AfterFTPPut.Label"));
// +1: starts at -1
wAfterFTPPut.select(0);
props.setLook(wAfterFTPPut);
fdAfterFTPPut = new FormData();
fdAfterFTPPut.left = new FormAttachment(middle, margin);
fdAfterFTPPut.top = new FormAttachment(wOnlyNew, 2 * margin);
fdAfterFTPPut.right = new FormAttachment(100, 0);
wAfterFTPPut.setLayoutData(fdAfterFTPPut);
wAfterFTPPut.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
AfterFTPPutActivate();
}
});
// moveTo Directory
wlDestinationFolder = new Label(wFiles, SWT.RIGHT);
wlDestinationFolder.setText(BaseMessages.getString(PKG, "JobSSH2GET.DestinationFolder.Label"));
props.setLook(wlDestinationFolder);
fdlDestinationFolder = new FormData();
fdlDestinationFolder.left = new FormAttachment(0, 0);
fdlDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
fdlDestinationFolder.right = new FormAttachment(middle, -margin);
wlDestinationFolder.setLayoutData(fdlDestinationFolder);
wDestinationFolder = new TextVar(jobMeta, wFiles, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "JobSSH2GET.DestinationFolder.Tooltip"));
props.setLook(wDestinationFolder);
wDestinationFolder.addModifyListener(lsMod);
fdDestinationFolder = new FormData();
fdDestinationFolder.left = new FormAttachment(middle, margin);
fdDestinationFolder.top = new FormAttachment(wAfterFTPPut, margin);
fdDestinationFolder.right = new FormAttachment(100, -margin);
wDestinationFolder.setLayoutData(fdDestinationFolder);
// Whenever something changes, set the tooltip to the expanded version:
wDestinationFolder.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wDestinationFolder.setToolTipText(jobMeta.environmentSubstitute(wDestinationFolder.getText()));
}
});
// Create destination folder if necessary ...
wlCreateDestinationFolder = new Label(wFiles, SWT.RIGHT);
wlCreateDestinationFolder.setText(BaseMessages.getString(PKG, "JobSSH2GET.CreateDestinationFolder.Label"));
props.setLook(wlCreateDestinationFolder);
fdlCreateDestinationFolder = new FormData();
fdlCreateDestinationFolder.left = new FormAttachment(0, 0);
fdlCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdlCreateDestinationFolder.right = new FormAttachment(middle, 0);
wlCreateDestinationFolder.setLayoutData(fdlCreateDestinationFolder);
wCreateDestinationFolder = new Button(wFiles, SWT.CHECK);
wCreateDestinationFolder.setToolTipText(BaseMessages.getString(PKG, "JobSSH2GET.CreateDestinationFolder.Tooltip"));
props.setLook(wCreateDestinationFolder);
fdCreateDestinationFolder = new FormData();
fdCreateDestinationFolder.left = new FormAttachment(middle, margin);
fdCreateDestinationFolder.top = new FormAttachment(wDestinationFolder, margin);
fdCreateDestinationFolder.right = new FormAttachment(100, 0);
wCreateDestinationFolder.setLayoutData(fdCreateDestinationFolder);
fdFiles = new FormData();
fdFiles.left = new FormAttachment(0, margin);
fdFiles.top = new FormAttachment(0, margin);
fdFiles.right = new FormAttachment(100, -margin);
wFiles.setLayoutData(fdFiles);
// ///////////////////////////////////////////////////////////
// / END OF Files GROUP
// /////////////////////////////////////////////////////////
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(500, -margin);
wFilesComp.setLayoutData(fdFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF FILES TAB
// ///////////////////////////////////////////////////////////
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
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(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
lsCheckFolder = new Listener() {
public void handleEvent(Event e) {
checkFTPFolder();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
wbTestChangeFolderExists.addListener(SWT.Selection, lsCheckFolder);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wUserName.addSelectionListener(lsDef);
wPassword.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wLocalDirectory.addSelectionListener(lsDef);
wFtpDirectory.addSelectionListener(lsDef);
wWildcard.addSelectionListener(lsDef);
// wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
activeUseHttpProxy();
AfterFTPPutActivate();
activeUsePublicKey();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobFTPDialogSize");
wTabFolder.setSelection(0);
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelText in project pentaho-kettle by pentaho.
the class HL7MLLPInputDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "HL7MLLPInputDialog.Title"));
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.Name.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.Name.Tooltip"));
wName.addModifyListener(lsMod);
FormData fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
Control lastControl = wName;
// the server
//
wServer = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.Server.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.Server.Tooltip"));
props.setLook(wServer);
wServer.addModifyListener(lsMod);
FormData fdBatchIdSchema = new FormData();
fdBatchIdSchema.left = new FormAttachment(0, 0);
fdBatchIdSchema.top = new FormAttachment(lastControl, margin);
fdBatchIdSchema.right = new FormAttachment(100, 0);
wServer.setLayoutData(fdBatchIdSchema);
lastControl = wServer;
// the port
//
wPort = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.Port.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
FormData fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(lastControl, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
lastControl = wPort;
// The Message Variable
//
wMessageVariable = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageVariable.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageVariable.Tooltip"));
props.setLook(wMessageVariable);
wMessageVariable.addModifyListener(lsMod);
FormData fdMessageVariable = new FormData();
fdMessageVariable.left = new FormAttachment(0, 0);
fdMessageVariable.top = new FormAttachment(lastControl, margin);
fdMessageVariable.right = new FormAttachment(100, 0);
wMessageVariable.setLayoutData(fdMessageVariable);
lastControl = wMessageVariable;
// The ControlId Variable
//
wMessageTypeVariable = new LabelTextVar(jobMeta, shell, BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageTypeVariable.Label"), BaseMessages.getString(PKG, "HL7MLLPInputDialog.MessageTypeVariable.Tooltip"));
props.setLook(wMessageTypeVariable);
wMessageTypeVariable.addModifyListener(lsMod);
FormData fdMessageTypeVariable = new FormData();
fdMessageTypeVariable.left = new FormAttachment(0, 0);
fdMessageTypeVariable.top = new FormAttachment(lastControl, margin);
fdMessageTypeVariable.right = new FormAttachment(100, 0);
wMessageTypeVariable.setLayoutData(fdMessageTypeVariable);
lastControl = wMessageTypeVariable;
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, lastControl);
// Add listeners
//
wCancel.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
cancel();
}
});
wOK.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
ok();
}
});
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServer.addSelectionListener(lsDef);
wPort.addSelectionListener(lsDef);
wMessageVariable.addSelectionListener(lsDef);
wMessageTypeVariable.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "HL7MLLPInputDialog.DialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.LabelText in project pentaho-kettle by pentaho.
the class JobEntrySendNagiosPassiveCheckDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Name.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, PropsUI.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ServerSettings.General"));
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///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Server.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Port.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// Password String line
wPassword = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Password.Label"), BaseMessages.getString("JobSendNagiosPassiveCheck.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wPort, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Server wConnectionTimeOut line
wConnectionTimeOut = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ConnectionTimeOut.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ConnectionTimeOut.Tooltip"));
props.setLook(wConnectionTimeOut);
wConnectionTimeOut.addModifyListener(lsMod);
fdwConnectionTimeOut = new FormData();
fdwConnectionTimeOut.left = new FormAttachment(0, 0);
fdwConnectionTimeOut.top = new FormAttachment(wPassword, margin);
fdwConnectionTimeOut.right = new FormAttachment(100, 0);
wConnectionTimeOut.setLayoutData(fdwConnectionTimeOut);
// ResponseTimeOut line
wResponseTimeOut = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ResponseTimeOut.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.ResponseTimeOut.Tooltip"));
props.setLook(wResponseTimeOut);
wResponseTimeOut.addModifyListener(lsMod);
fdResponseTimeOut = new FormData();
fdResponseTimeOut.left = new FormAttachment(0, 0);
fdResponseTimeOut.top = new FormAttachment(wConnectionTimeOut, margin);
fdResponseTimeOut.right = new FormAttachment(100, 0);
wResponseTimeOut.setLayoutData(fdResponseTimeOut);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wResponseTimeOut, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
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///
// /
wSenderSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wSenderSettings);
wSenderSettings.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderSettings.Group.Label"));
FormLayout SenderSettingsgroupLayout = new FormLayout();
SenderSettingsgroupLayout.marginWidth = 10;
SenderSettingsgroupLayout.marginHeight = 10;
wSenderSettings.setLayout(SenderSettingsgroupLayout);
// SenderServerName line
wSenderServerName = new LabelTextVar(jobMeta, wSenderSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServerName.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServerName.Tooltip"));
props.setLook(wSenderServerName);
wSenderServerName.addModifyListener(lsMod);
fdSenderServerName = new FormData();
fdSenderServerName.left = new FormAttachment(0, 0);
fdSenderServerName.top = new FormAttachment(wServerSettings, margin);
fdSenderServerName.right = new FormAttachment(100, 0);
wSenderServerName.setLayoutData(fdSenderServerName);
// SenderServiceName line
wSenderServiceName = new LabelTextVar(jobMeta, wSenderSettings, BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServiceName.Label"), BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.SenderServiceName.Tooltip"));
props.setLook(wSenderServiceName);
wSenderServiceName.addModifyListener(lsMod);
fdSenderServiceName = new FormData();
fdSenderServiceName.left = new FormAttachment(0, 0);
fdSenderServiceName.top = new FormAttachment(wSenderServerName, margin);
fdSenderServiceName.right = new FormAttachment(100, 0);
wSenderServiceName.setLayoutData(fdSenderServiceName);
// Encryption mode
wlEncryptionMode = new Label(wSenderSettings, SWT.RIGHT);
wlEncryptionMode.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.EncryptionMode.Label"));
props.setLook(wlEncryptionMode);
fdlEncryptionMode = new FormData();
fdlEncryptionMode.left = new FormAttachment(0, margin);
fdlEncryptionMode.right = new FormAttachment(middle, -margin);
fdlEncryptionMode.top = new FormAttachment(wSenderServiceName, margin);
wlEncryptionMode.setLayoutData(fdlEncryptionMode);
wEncryptionMode = new CCombo(wSenderSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wEncryptionMode.setItems(JobEntrySendNagiosPassiveCheck.encryption_mode_Desc);
props.setLook(wEncryptionMode);
fdEncryptionMode = new FormData();
fdEncryptionMode.left = new FormAttachment(middle, margin);
fdEncryptionMode.top = new FormAttachment(wSenderServiceName, margin);
fdEncryptionMode.right = new FormAttachment(100, 0);
wEncryptionMode.setLayoutData(fdEncryptionMode);
wEncryptionMode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
// Level mode
wlLevelMode = new Label(wSenderSettings, SWT.RIGHT);
wlLevelMode.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.LevelMode.Label"));
props.setLook(wlLevelMode);
fdlLevelMode = new FormData();
fdlLevelMode.left = new FormAttachment(0, margin);
fdlLevelMode.right = new FormAttachment(middle, -margin);
fdlLevelMode.top = new FormAttachment(wEncryptionMode, margin);
wlLevelMode.setLayoutData(fdlLevelMode);
wLevelMode = new CCombo(wSenderSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wLevelMode.setItems(JobEntrySendNagiosPassiveCheck.level_type_Desc);
props.setLook(wLevelMode);
fdLevelMode = new FormData();
fdLevelMode.left = new FormAttachment(middle, margin);
fdLevelMode.top = new FormAttachment(wEncryptionMode, margin);
fdLevelMode.right = new FormAttachment(100, 0);
wLevelMode.setLayoutData(fdLevelMode);
wLevelMode.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
}
});
fdSenderSettings = new FormData();
fdSenderSettings.left = new FormAttachment(0, margin);
fdSenderSettings.top = new FormAttachment(wServerSettings, margin);
fdSenderSettings.right = new FormAttachment(100, -margin);
wSenderSettings.setLayoutData(fdSenderSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF MESSAGE GROUP///
// /
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.MessageGroup.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// Message line
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "JobSendNagiosPassiveCheck.Message.Label"));
props.setLook(wlMessage);
fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, 0);
fdlMessage.top = new FormAttachment(wSenderSettings, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new StyledTextComp(jobMeta, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
fdMessage = new FormData();
fdMessage.left = new FormAttachment(middle, 0);
fdMessage.top = new FormAttachment(wSenderSettings, margin);
fdMessage.right = new FormAttachment(100, -2 * margin);
fdMessage.bottom = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdMessage);
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wSenderSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
fdMessageGroup.bottom = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF MESSAGE GROUP
// ///////////////////////////////////////////////////////////
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
// ///////////////////////////////////////////////////////////
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(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wResponseTimeOut.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSendNagiosPassiveCheckDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
Aggregations