use of org.apache.hop.workflow.WorkflowMeta in project hop by apache.
the class HopRun method runWorkflow.
private void runWorkflow(CommandLine cmd, ILogChannel log, WorkflowExecutionConfiguration configuration, WorkflowMeta workflowMeta) {
try {
String runConfigurationName = variables.resolve(configuration.getRunConfiguration());
IWorkflowEngine<WorkflowMeta> workflow = WorkflowEngineFactory.createWorkflowEngine(variables, runConfigurationName, metadataProvider, workflowMeta, null);
workflow.initializeFrom(null);
workflow.getWorkflowMeta().setInternalHopVariables(workflow);
workflow.setVariables(configuration.getVariablesMap());
workflow.setLogLevel(configuration.getLogLevel());
// Copy the parameter definitions from the metadata, with empty values
//
workflow.copyParametersFromDefinitions(workflowMeta);
configureParametersAndVariables(cmd, configuration, workflow, workflow);
// Also copy the parameter values over to the variables...
//
workflow.activateParameters(workflow);
log.logMinimal("Starting workflow: " + workflowMeta.getFilename());
workflow.startExecution();
setFinishedWithoutError(workflow.getResult().getResult());
} catch (Exception e) {
throw new ExecutionException(cmd, "Error running workflow locally", e);
}
}
use of org.apache.hop.workflow.WorkflowMeta in project hop by apache.
the class HopRun method runWorkflow.
private void runWorkflow(CommandLine cmd, ILogChannel log) {
try {
calculateRealFilename();
// Run the workflow with the given filename
//
WorkflowMeta workflowMeta = new WorkflowMeta(variables, realFilename, metadataProvider);
// Configure the basic execution settings
//
WorkflowExecutionConfiguration configuration = new WorkflowExecutionConfiguration();
// Overwrite the run configuration with optional command line options
//
parseOptions(cmd, configuration, workflowMeta);
// Certain Hop plugins rely on this. Meh.
//
ExtensionPointHandler.callExtensionPoint(log, variables, HopExtensionPoint.HopGuiWorkflowBeforeStart.id, new Object[] { configuration, null, workflowMeta, null });
//
if (printingOptions) {
printOptions(configuration);
}
runWorkflow(cmd, log, configuration, workflowMeta);
} catch (Exception e) {
throw new ExecutionException(cmd, "There was an error during execution of workflow '" + filename + "'", e);
}
}
use of org.apache.hop.workflow.WorkflowMeta in project hop by apache.
the class ActionFtpPutDialog method connectToFtp.
private boolean connectToFtp(boolean checkFolder, String remoteFolderName) {
boolean retval = false;
String realServername = null;
try {
WorkflowMeta workflowMeta = getWorkflowMeta();
ActionFtpPut actionFtpPut = new ActionFtpPut();
getInfo(actionFtpPut);
if (ftpclient == null || !ftpclient.isConnected()) {
// Create ftp client to host:port ...
//
ftpclient = FtpClientUtil.connectAndLogin(LogChannel.UI, variables, actionFtpPut, actionFtpPut.getName());
pwdFolder = ftpclient.printWorkingDirectory();
}
if (checkFolder) {
if (pwdFolder != null) {
ftpclient.changeWorkingDirectory(pwdFolder);
}
// move to spool dir ...
if (!Utils.isEmpty(remoteFolderName)) {
String realFtpDirectory = variables.resolve(remoteFolderName);
ftpclient.changeWorkingDirectory(realFtpDirectory);
}
}
retval = true;
} catch (Exception e) {
if (ftpclient != null) {
try {
ftpclient.quit();
} catch (Exception ignored) {
// We've tried quitting the FTP Client exception
// nothing else can be done if the FTP Client was already disconnected
}
ftpclient = null;
FtpClientUtil.clearSocksJvmSettings();
}
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "ActionFtpPut.ErrorConnect.NOK", realServername, e.getMessage()) + Const.CR);
mb.setText(BaseMessages.getString(PKG, "ActionFtpPut.ErrorConnect.Title.Bad"));
mb.open();
}
return retval;
}
use of org.apache.hop.workflow.WorkflowMeta in project hop by apache.
the class ActionFtpPutDialog method open.
@Override
public IAction open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
props.setLook(shell);
WorkflowDialog.setShellImage(shell, action);
WorkflowMeta workflowMeta = getWorkflowMeta();
ModifyListener lsMod = e -> {
ftpclient = null;
pwdFolder = null;
action.setChanged();
};
changed = action.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "ActionFtpPut.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
Label wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "ActionFtpPut.Name.Label"));
props.setLook(wlName);
FormData fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
FormData fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// The buttons at the bottom
//
Button wOk = new Button(shell, SWT.PUSH);
wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wOk.addListener(SWT.Selection, e -> ok());
Button wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, e -> cancel());
BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
// The tab folder between the name and the buttons
//
CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "ActionFtpPut.Tab.General.Label"));
Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
Group wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.ServerSettings.Group.Label"));
FormLayout serverSettingsgroupLayout = new FormLayout();
serverSettingsgroupLayout.marginWidth = 10;
serverSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(serverSettingsgroupLayout);
// ServerName line
Label wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "ActionFtpPut.Server.Label"));
props.setLook(wlServerName);
FormData fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(wName, margin);
fdlServerName.right = new FormAttachment(middle, 0);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
FormData fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, margin);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// ServerPort line
Label wlServerPort = new Label(wServerSettings, SWT.RIGHT);
wlServerPort.setText(BaseMessages.getString(PKG, "ActionFtpPut.Port.Label"));
props.setLook(wlServerPort);
FormData fdlServerPort = new FormData();
fdlServerPort.left = new FormAttachment(0, 0);
fdlServerPort.top = new FormAttachment(wServerName, margin);
fdlServerPort.right = new FormAttachment(middle, 0);
wlServerPort.setLayoutData(fdlServerPort);
wServerPort = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerPort);
wServerPort.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.Port.Tooltip"));
wServerPort.addModifyListener(lsMod);
FormData fdServerPort = new FormData();
fdServerPort.left = new FormAttachment(middle, margin);
fdServerPort.top = new FormAttachment(wServerName, margin);
fdServerPort.right = new FormAttachment(100, 0);
wServerPort.setLayoutData(fdServerPort);
// UserName line
Label wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "ActionFtpPut.Username.Label"));
props.setLook(wlUserName);
FormData fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wServerPort, margin);
fdlUserName.right = new FormAttachment(middle, 0);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
FormData fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, margin);
fdUserName.top = new FormAttachment(wServerPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
Label wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "ActionFtpPut.Password.Label"));
props.setLook(wlPassword);
FormData fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, 0);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, margin);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Proxy host line
wProxyHost = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyHost.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyHost.Tooltip"), false, false);
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
FormData fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, 0);
fdProxyHost.top = new FormAttachment(wPassword, 2 * margin);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// Proxy port line
wProxyPort = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyPort.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyPort.Tooltip"), false, false);
props.setLook(wProxyPort);
wProxyPort.addModifyListener(lsMod);
FormData fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(0, 0);
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
// Proxy username line
wProxyUsername = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyUsername.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyUsername.Tooltip"), false, false);
props.setLook(wProxyUsername);
wProxyUsername.addModifyListener(lsMod);
FormData fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(0, 0);
fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Proxy password line
wProxyPassword = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.ProxyPassword.Label"), BaseMessages.getString(PKG, "ActionFtpPut.ProxyPassword.Tooltip"), true, false);
props.setLook(wProxyPassword);
wProxyPassword.addModifyListener(lsMod);
FormData fdProxyPasswd = new FormData();
fdProxyPasswd.left = new FormAttachment(0, 0);
fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
fdProxyPasswd.right = new FormAttachment(100, 0);
wProxyPassword.setLayoutData(fdProxyPasswd);
// Test connection button
Button wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "ActionFtpPut.TestConnection.Label"));
props.setLook(wTest);
FormData fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wProxyPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
wTest.addListener(SWT.Selection, e -> test());
FormData fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Advanced SETTINGS GROUP///
// /
Group wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedSettings);
wAdvancedSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.AdvancedSettings.Group.Label"));
FormLayout advancedSettingsgroupLayout = new FormLayout();
advancedSettingsgroupLayout.marginWidth = 10;
advancedSettingsgroupLayout.marginHeight = 10;
wAdvancedSettings.setLayout(advancedSettingsgroupLayout);
// Binary mode selection...
Label wlBinaryMode = new Label(wAdvancedSettings, SWT.RIGHT);
wlBinaryMode.setText(BaseMessages.getString(PKG, "ActionFtpPut.BinaryMode.Label"));
props.setLook(wlBinaryMode);
FormData fdlBinaryMode = new FormData();
fdlBinaryMode.left = new FormAttachment(0, 0);
fdlBinaryMode.top = new FormAttachment(wServerSettings, margin);
fdlBinaryMode.right = new FormAttachment(middle, 0);
wlBinaryMode.setLayoutData(fdlBinaryMode);
wBinaryMode = new Button(wAdvancedSettings, SWT.CHECK);
props.setLook(wBinaryMode);
wBinaryMode.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.BinaryMode.Tooltip"));
FormData fdBinaryMode = new FormData();
fdBinaryMode.left = new FormAttachment(middle, 0);
fdBinaryMode.top = new FormAttachment(wlBinaryMode, 0, SWT.CENTER);
fdBinaryMode.right = new FormAttachment(100, 0);
wBinaryMode.setLayoutData(fdBinaryMode);
// TimeOut...
Label wlTimeout = new Label(wAdvancedSettings, SWT.RIGHT);
wlTimeout.setText(BaseMessages.getString(PKG, "ActionFtpPut.Timeout.Label"));
props.setLook(wlTimeout);
FormData fdlTimeout = new FormData();
fdlTimeout.left = new FormAttachment(0, 0);
fdlTimeout.top = new FormAttachment(wlBinaryMode, 2 * margin);
fdlTimeout.right = new FormAttachment(middle, 0);
wlTimeout.setLayoutData(fdlTimeout);
wTimeout = new TextVar(variables, wAdvancedSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.Timeout.Tooltip"));
FormData fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(middle, 0);
fdTimeout.top = new FormAttachment(wBinaryMode, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// active connection?
Label wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
wlActive.setText(BaseMessages.getString(PKG, "ActionFtpPut.ActiveConns.Label"));
props.setLook(wlActive);
FormData fdlActive = new FormData();
fdlActive.left = new FormAttachment(0, 0);
fdlActive.top = new FormAttachment(wTimeout, margin);
fdlActive.right = new FormAttachment(middle, 0);
wlActive.setLayoutData(fdlActive);
wActive = new Button(wAdvancedSettings, SWT.CHECK);
wActive.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.ActiveConns.Tooltip"));
props.setLook(wActive);
FormData fdActive = new FormData();
fdActive.left = new FormAttachment(middle, 0);
fdActive.top = new FormAttachment(wlActive, 0, SWT.CENTER);
fdActive.right = new FormAttachment(100, 0);
wActive.setLayoutData(fdActive);
// Control encoding line
//
// The drop down is editable as it may happen an encoding may not be present
// on one machine, but you may want to use it on your execution server
//
Label wlControlEncoding = new Label(wAdvancedSettings, SWT.RIGHT);
wlControlEncoding.setText(BaseMessages.getString(PKG, "ActionFtpPut.ControlEncoding.Label"));
props.setLook(wlControlEncoding);
FormData fdlControlEncoding = new FormData();
fdlControlEncoding.left = new FormAttachment(0, 0);
fdlControlEncoding.top = new FormAttachment(wlActive, 2 * margin);
fdlControlEncoding.right = new FormAttachment(middle, 0);
wlControlEncoding.setLayoutData(fdlControlEncoding);
wControlEncoding = new Combo(wAdvancedSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wControlEncoding.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.ControlEncoding.Tooltip"));
wControlEncoding.setItems(encodings);
props.setLook(wControlEncoding);
FormData fdControlEncoding = new FormData();
fdControlEncoding.left = new FormAttachment(middle, 0);
fdControlEncoding.top = new FormAttachment(wlControlEncoding, 0, SWT.CENTER);
fdControlEncoding.right = new FormAttachment(100, 0);
wControlEncoding.setLayoutData(fdControlEncoding);
FormData fdAdvancedSettings = new FormData();
fdAdvancedSettings.left = new FormAttachment(0, margin);
fdAdvancedSettings.top = new FormAttachment(wServerSettings, margin);
fdAdvancedSettings.right = new FormAttachment(100, -margin);
wAdvancedSettings.setLayoutData(fdAdvancedSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
FormData fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Files TAB ///
// ////////////////////////
CTabItem wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "ActionFtpPut.Tab.Files.Label"));
Composite wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout filesLayout = new FormLayout();
filesLayout.marginWidth = 3;
filesLayout.marginHeight = 3;
wFilesComp.setLayout(filesLayout);
// ////////////////////////
// START OF Source SETTINGS GROUP///
// /
Group wSourceSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wSourceSettings);
wSourceSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.SourceSettings.Group.Label"));
FormLayout sourceSettinsgroupLayout = new FormLayout();
sourceSettinsgroupLayout.marginWidth = 10;
sourceSettinsgroupLayout.marginHeight = 10;
wSourceSettings.setLayout(sourceSettinsgroupLayout);
// Local (source) directory line
Label wlLocalDirectory = new Label(wSourceSettings, SWT.RIGHT);
wlLocalDirectory.setText(BaseMessages.getString(PKG, "ActionFtpPut.LocalDir.Label"));
props.setLook(wlLocalDirectory);
FormData fdlLocalDirectory = new FormData();
fdlLocalDirectory.left = new FormAttachment(0, 0);
fdlLocalDirectory.top = new FormAttachment(0, margin);
fdlLocalDirectory.right = new FormAttachment(middle, -margin);
wlLocalDirectory.setLayoutData(fdlLocalDirectory);
// Browse folders button ...
Button wbLocalDirectory = new Button(wSourceSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbLocalDirectory);
wbLocalDirectory.setText(BaseMessages.getString(PKG, "ActionFtpPut.BrowseFolders.Label"));
FormData fdbLocalDirectory = new FormData();
fdbLocalDirectory.right = new FormAttachment(100, 0);
fdbLocalDirectory.top = new FormAttachment(0, margin);
wbLocalDirectory.setLayoutData(fdbLocalDirectory);
wbLocalDirectory.addListener(SWT.Selection, e -> BaseDialog.presentDirectoryDialog(shell, wLocalDirectory, variables));
wLocalDirectory = new TextVar(variables, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.LocalDir.Tooltip"));
props.setLook(wLocalDirectory);
wLocalDirectory.addModifyListener(lsMod);
FormData fdLocalDirectory = new FormData();
fdLocalDirectory.left = new FormAttachment(middle, 0);
fdLocalDirectory.top = new FormAttachment(0, margin);
fdLocalDirectory.right = new FormAttachment(wbLocalDirectory, -margin);
wLocalDirectory.setLayoutData(fdLocalDirectory);
// Wildcard line
Label wlWildcard = new Label(wSourceSettings, SWT.RIGHT);
wlWildcard.setText(BaseMessages.getString(PKG, "ActionFtpPut.Wildcard.Label"));
props.setLook(wlWildcard);
FormData fdlWildcard = new FormData();
fdlWildcard.left = new FormAttachment(0, 0);
fdlWildcard.top = new FormAttachment(wLocalDirectory, margin);
fdlWildcard.right = new FormAttachment(middle, -margin);
wlWildcard.setLayoutData(fdlWildcard);
wWildcard = new TextVar(variables, wSourceSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.Wildcard.Tooltip"));
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
FormData fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(middle, 0);
fdWildcard.top = new FormAttachment(wLocalDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
// Remove files after retrieval...
Label wlRemove = new Label(wSourceSettings, SWT.RIGHT);
wlRemove.setText(BaseMessages.getString(PKG, "ActionFtpPut.RemoveFiles.Label"));
props.setLook(wlRemove);
FormData fdlRemove = new FormData();
fdlRemove.left = new FormAttachment(0, 0);
fdlRemove.top = new FormAttachment(wWildcard, 2 * margin);
fdlRemove.right = new FormAttachment(middle, -margin);
wlRemove.setLayoutData(fdlRemove);
wRemove = new Button(wSourceSettings, SWT.CHECK);
props.setLook(wRemove);
wRemove.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.RemoveFiles.Tooltip"));
FormData fdRemove = new FormData();
fdRemove.left = new FormAttachment(middle, 0);
fdRemove.top = new FormAttachment(wlRemove, 0, SWT.CENTER);
fdRemove.right = new FormAttachment(100, 0);
wRemove.setLayoutData(fdRemove);
// OnlyNew files after retrieval...
Label wlOnlyNew = new Label(wSourceSettings, SWT.RIGHT);
wlOnlyNew.setText(BaseMessages.getString(PKG, "ActionFtpPut.DontOverwrite.Label"));
props.setLook(wlOnlyNew);
FormData fdlOnlyNew = new FormData();
fdlOnlyNew.left = new FormAttachment(0, 0);
fdlOnlyNew.top = new FormAttachment(wlRemove, 2 * margin);
fdlOnlyNew.right = new FormAttachment(middle, 0);
wlOnlyNew.setLayoutData(fdlOnlyNew);
wOnlyNew = new Button(wSourceSettings, SWT.CHECK);
wOnlyNew.setToolTipText(BaseMessages.getString(PKG, "ActionFtpPut.DontOverwrite.Tooltip"));
props.setLook(wOnlyNew);
FormData fdOnlyNew = new FormData();
fdOnlyNew.left = new FormAttachment(middle, 0);
fdOnlyNew.top = new FormAttachment(wlOnlyNew, 0, SWT.CENTER);
fdOnlyNew.right = new FormAttachment(100, 0);
wOnlyNew.setLayoutData(fdOnlyNew);
FormData fdSourceSettings = new FormData();
fdSourceSettings.left = new FormAttachment(0, margin);
fdSourceSettings.top = new FormAttachment(0, 2 * margin);
fdSourceSettings.right = new FormAttachment(100, -margin);
wSourceSettings.setLayoutData(fdSourceSettings);
// ///////////////////////////////////////////////////////////
// / END OF Source SETTINGSGROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target SETTINGS GROUP///
// /
Group wTargetSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wTargetSettings);
wTargetSettings.setText(BaseMessages.getString(PKG, "ActionFtpPut.TargetSettings.Group.Label"));
FormLayout targetSettinsgroupLayout = new FormLayout();
targetSettinsgroupLayout.marginWidth = 10;
targetSettinsgroupLayout.marginHeight = 10;
wTargetSettings.setLayout(targetSettinsgroupLayout);
// Remote Directory line
Label wlRemoteDirectory = new Label(wTargetSettings, SWT.RIGHT);
wlRemoteDirectory.setText(BaseMessages.getString(PKG, "ActionFtpPut.RemoteDir.Label"));
props.setLook(wlRemoteDirectory);
FormData fdlRemoteDirectory = new FormData();
fdlRemoteDirectory.left = new FormAttachment(0, 0);
fdlRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
fdlRemoteDirectory.right = new FormAttachment(middle, -margin);
wlRemoteDirectory.setLayoutData(fdlRemoteDirectory);
// Test remote folder button ...
Button wbTestRemoteDirectoryExists = new Button(wTargetSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbTestRemoteDirectoryExists);
wbTestRemoteDirectoryExists.setText(BaseMessages.getString(PKG, "ActionFtpPut.TestFolderExists.Label"));
FormData fdbTestRemoteDirectoryExists = new FormData();
fdbTestRemoteDirectoryExists.right = new FormAttachment(100, 0);
fdbTestRemoteDirectoryExists.top = new FormAttachment(wSourceSettings, margin);
wbTestRemoteDirectoryExists.setLayoutData(fdbTestRemoteDirectoryExists);
wbTestRemoteDirectoryExists.addListener(SWT.Selection, e -> checkRemoteFolder(variables.resolve(wRemoteDirectory.getText())));
wRemoteDirectory = new TextVar(variables, wTargetSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpPut.RemoteDir.Tooltip"));
props.setLook(wRemoteDirectory);
wRemoteDirectory.addModifyListener(lsMod);
FormData fdRemoteDirectory = new FormData();
fdRemoteDirectory.left = new FormAttachment(middle, 0);
fdRemoteDirectory.top = new FormAttachment(wSourceSettings, margin);
fdRemoteDirectory.right = new FormAttachment(wbTestRemoteDirectoryExists, -margin);
wRemoteDirectory.setLayoutData(fdRemoteDirectory);
FormData fdTargetSettings = new FormData();
fdTargetSettings.left = new FormAttachment(0, margin);
fdTargetSettings.top = new FormAttachment(wSourceSettings, margin);
fdTargetSettings.right = new FormAttachment(100, -margin);
wTargetSettings.setLayoutData(fdTargetSettings);
// ///////////////////////////////////////////////////////////
// / END OF Target SETTINGSGROUP
// ///////////////////////////////////////////////////////////
FormData fdFilesComp = new FormData();
fdFilesComp.left = new FormAttachment(0, 0);
fdFilesComp.top = new FormAttachment(0, 0);
fdFilesComp.right = new FormAttachment(100, 0);
fdFilesComp.bottom = new FormAttachment(100, 0);
wFilesComp.setLayoutData(fdFilesComp);
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF Files TAB
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Start of Socks Proxy Tab
// ///////////////////////////////////////////////////////////
CTabItem wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
wSocksProxyTab.setText(BaseMessages.getString(PKG, "ActionFtpPut.Tab.Socks.Label"));
Composite wSocksProxyComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSocksProxyComp);
FormLayout soxProxyLayout = new FormLayout();
soxProxyLayout.marginWidth = 3;
soxProxyLayout.marginHeight = 3;
wSocksProxyComp.setLayout(soxProxyLayout);
// ////////////////////////////////////////////////////////
// Start of Proxy Group
// ////////////////////////////////////////////////////////
Group wSocksProxy = new Group(wSocksProxyComp, SWT.SHADOW_NONE);
props.setLook(wSocksProxy);
wSocksProxy.setText(BaseMessages.getString(PKG, "ActionFtpPut.SocksProxy.Group.Label"));
FormLayout socksProxyGroupLayout = new FormLayout();
socksProxyGroupLayout.marginWidth = 10;
socksProxyGroupLayout.marginHeight = 10;
wSocksProxy.setLayout(socksProxyGroupLayout);
// host line
wSocksProxyHost = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyHost.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyHost.Tooltip"), false, false);
props.setLook(wSocksProxyHost);
wSocksProxyHost.addModifyListener(lsMod);
FormData fdSocksProxyHost = new FormData();
fdSocksProxyHost.left = new FormAttachment(0, 0);
fdSocksProxyHost.top = new FormAttachment(wName, margin);
fdSocksProxyHost.right = new FormAttachment(100, margin);
wSocksProxyHost.setLayoutData(fdSocksProxyHost);
// port line
wSocksProxyPort = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPort.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPort.Tooltip"), false, false);
props.setLook(wSocksProxyPort);
wSocksProxyPort.addModifyListener(lsMod);
FormData fdSocksProxyPort = new FormData();
fdSocksProxyPort.left = new FormAttachment(0, 0);
fdSocksProxyPort.top = new FormAttachment(wSocksProxyHost, margin);
fdSocksProxyPort.right = new FormAttachment(100, margin);
wSocksProxyPort.setLayoutData(fdSocksProxyPort);
// username line
wSocksProxyUsername = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPassword.Tooltip"), false, false);
props.setLook(wSocksProxyUsername);
wSocksProxyUsername.addModifyListener(lsMod);
FormData fdSocksProxyUsername = new FormData();
fdSocksProxyUsername.left = new FormAttachment(0, 0);
fdSocksProxyUsername.top = new FormAttachment(wSocksProxyPort, margin);
fdSocksProxyUsername.right = new FormAttachment(100, margin);
wSocksProxyUsername.setLayoutData(fdSocksProxyUsername);
// password line
wSocksProxyPassword = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "ActionFtpPut.SocksProxyPassword.Tooltip"), true, false);
props.setLook(wSocksProxyPort);
wSocksProxyPassword.addModifyListener(lsMod);
FormData fdSocksProxyPassword = new FormData();
fdSocksProxyPassword.left = new FormAttachment(0, 0);
fdSocksProxyPassword.top = new FormAttachment(wSocksProxyUsername, margin);
fdSocksProxyPassword.right = new FormAttachment(100, margin);
wSocksProxyPassword.setLayoutData(fdSocksProxyPassword);
// ///////////////////////////////////////////////////////////////
// End of socks proxy group
// ///////////////////////////////////////////////////////////////
FormData fdSocksProxyComp = new FormData();
fdSocksProxyComp.left = new FormAttachment(0, margin);
fdSocksProxyComp.top = new FormAttachment(0, margin);
fdSocksProxyComp.right = new FormAttachment(100, -margin);
wSocksProxy.setLayoutData(fdSocksProxyComp);
wSocksProxyComp.layout();
wSocksProxyTab.setControl(wSocksProxyComp);
props.setLook(wSocksProxyComp);
// ////////////////////////////////////////////////////////
// End of Socks Proxy Tab
// ////////////////////////////////////////////////////////
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
wTabFolder.setLayoutData(fdTabFolder);
getData();
wTabFolder.setSelection(0);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return action;
}
use of org.apache.hop.workflow.WorkflowMeta in project hop by apache.
the class ActionFtpDeleteDialog method open.
@Override
public IAction open() {
Shell parent = getParent();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
props.setLook(shell);
WorkflowDialog.setShellImage(shell, action);
WorkflowMeta workflowMeta = getWorkflowMeta();
ModifyListener lsMod = e -> {
pwdFolder = null;
ftpclient = null;
sftpclient = null;
action.setChanged();
};
changed = action.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "ActionFtpDelete.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Action name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "ActionFtpDelete.Name.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.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);
// The buttons at the bottom...
//
Button wOk = new Button(shell, SWT.PUSH);
wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wOk.addListener(SWT.Selection, e -> ok());
Button wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
wCancel.addListener(SWT.Selection, e -> cancel());
BaseTransformDialog.positionBottomButtons(shell, new Button[] { wOk, wCancel }, margin, null);
// The tab folder between the name and the buttons
//
CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
CTabItem wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "ActionFtpDelete.Tab.General.Label"));
Composite wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
Group wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "ActionFtpDelete.ServerSettings.Group.Label"));
FormLayout serverSettingsgroupLayout = new FormLayout();
serverSettingsgroupLayout.marginWidth = 10;
serverSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(serverSettingsgroupLayout);
// Protocol
Label wlProtocol = new Label(wServerSettings, SWT.RIGHT);
wlProtocol.setText(BaseMessages.getString(PKG, "ActionFtpDelete.Protocol.Label"));
props.setLook(wlProtocol);
FormData fdlProtocol = new FormData();
fdlProtocol.left = new FormAttachment(0, 0);
fdlProtocol.top = new FormAttachment(wName, margin);
fdlProtocol.right = new FormAttachment(middle, 0);
wlProtocol.setLayoutData(fdlProtocol);
wProtocol = new Combo(wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wProtocol.setToolTipText(BaseMessages.getString(PKG, "ActionFtpDelete.Protocol.Tooltip"));
wProtocol.add(ActionFtpDelete.PROTOCOL_FTP);
wProtocol.add(ActionFtpDelete.PROTOCOL_SFTP);
props.setLook(wProtocol);
FormData fdProtocol = new FormData();
fdProtocol.left = new FormAttachment(middle, margin);
fdProtocol.top = new FormAttachment(wName, margin);
fdProtocol.right = new FormAttachment(100, 0);
wProtocol.setLayoutData(fdProtocol);
wProtocol.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
activeFtpProtocol();
action.setChanged();
}
});
// ServerName line
wServerName = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.Server.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.Server.Tooltip"), false, false);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
FormData fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wProtocol, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Proxy port line
wPort = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.Port.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.Port.Tooltip"), false, false);
props.setLook(wPort);
wPort.addModifyListener(lsMod);
FormData 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(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.User.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.User.Tooltip"), false, false);
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
FormData 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(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.Password.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.Password.Tooltip"), true, false);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
FormData fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Use proxy...
Label wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
wlUseProxy.setText(BaseMessages.getString(PKG, "ActionFtpDelete.useProxy.Label"));
props.setLook(wlUseProxy);
FormData fdlUseProxy = new FormData();
fdlUseProxy.left = new FormAttachment(0, 0);
fdlUseProxy.top = new FormAttachment(wPassword, margin);
fdlUseProxy.right = new FormAttachment(middle, 0);
wlUseProxy.setLayoutData(fdlUseProxy);
wUseProxy = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseProxy);
wUseProxy.setToolTipText(BaseMessages.getString(PKG, "ActionFtpDelete.useProxy.Tooltip"));
FormData fdUseProxy = new FormData();
fdUseProxy.left = new FormAttachment(middle, margin);
fdUseProxy.top = new FormAttachment(wlUseProxy, 0, SWT.CENTER);
fdUseProxy.right = new FormAttachment(100, 0);
wUseProxy.setLayoutData(fdUseProxy);
wUseProxy.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
activeProxy();
action.setChanged();
}
});
// Proxy host line
wProxyHost = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.ProxyHost.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.ProxyHost.Tooltip"), false, false);
props.setLook(wProxyHost);
wProxyHost.addModifyListener(lsMod);
FormData fdProxyHost = new FormData();
fdProxyHost.left = new FormAttachment(0, 0);
fdProxyHost.top = new FormAttachment(wlUseProxy, 2 * margin);
fdProxyHost.right = new FormAttachment(100, 0);
wProxyHost.setLayoutData(fdProxyHost);
// Proxy port line
wProxyPort = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.ProxyPort.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.ProxyPort.Tooltip"), false, false);
props.setLook(wProxyPort);
wProxyPort.addModifyListener(lsMod);
FormData fdProxyPort = new FormData();
fdProxyPort.left = new FormAttachment(0, 0);
fdProxyPort.top = new FormAttachment(wProxyHost, margin);
fdProxyPort.right = new FormAttachment(100, 0);
wProxyPort.setLayoutData(fdProxyPort);
// Proxy username line
wProxyUsername = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.ProxyUsername.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.ProxyUsername.Tooltip"), false, false);
props.setLook(wProxyUsername);
wProxyUsername.addModifyListener(lsMod);
FormData fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(0, 0);
fdProxyUsername.top = new FormAttachment(wProxyPort, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Proxy password line
wProxyPassword = new LabelTextVar(variables, wServerSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.ProxyPassword.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.ProxyPassword.Tooltip"), true, false);
props.setLook(wProxyPassword);
wProxyPassword.addModifyListener(lsMod);
FormData fdProxyPasswd = new FormData();
fdProxyPasswd.left = new FormAttachment(0, 0);
fdProxyPasswd.top = new FormAttachment(wProxyUsername, margin);
fdProxyPasswd.right = new FormAttachment(100, 0);
wProxyPassword.setLayoutData(fdProxyPasswd);
// usePublicKey
wlUsePublicKey = new Label(wServerSettings, SWT.RIGHT);
wlUsePublicKey.setText(BaseMessages.getString(PKG, "ActionFtpDelete.usePublicKeyFiles.Label"));
props.setLook(wlUsePublicKey);
FormData fdlusePublicKey = new FormData();
fdlusePublicKey.left = new FormAttachment(0, 0);
fdlusePublicKey.top = new FormAttachment(wProxyPassword, margin);
fdlusePublicKey.right = new FormAttachment(middle, 0);
wlUsePublicKey.setLayoutData(fdlusePublicKey);
wUsePublicKey = new Button(wServerSettings, SWT.CHECK);
wUsePublicKey.setToolTipText(BaseMessages.getString(PKG, "ActionFtpDelete.usePublicKeyFiles.Tooltip"));
props.setLook(wUsePublicKey);
FormData fdusePublicKey = new FormData();
fdusePublicKey.left = new FormAttachment(middle, margin);
fdusePublicKey.top = new FormAttachment(wlUsePublicKey, 0, SWT.CENTER);
fdusePublicKey.right = new FormAttachment(100, 0);
wUsePublicKey.setLayoutData(fdusePublicKey);
wUsePublicKey.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
activeUsePublicKey();
action.setChanged();
}
});
// Key File
wlKeyFilename = new Label(wServerSettings, SWT.RIGHT);
wlKeyFilename.setText(BaseMessages.getString(PKG, "ActionFtpDelete.KeyFilename.Label"));
props.setLook(wlKeyFilename);
FormData fdlKeyFilename = new FormData();
fdlKeyFilename.left = new FormAttachment(0, 0);
fdlKeyFilename.top = new FormAttachment(wlUsePublicKey, 2 * margin);
fdlKeyFilename.right = new FormAttachment(middle, -margin);
wlKeyFilename.setLayoutData(fdlKeyFilename);
wbKeyFilename = new Button(wServerSettings, SWT.PUSH | SWT.CENTER);
props.setLook(wbKeyFilename);
wbKeyFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
FormData fdbKeyFilename = new FormData();
fdbKeyFilename.right = new FormAttachment(100, 0);
fdbKeyFilename.top = new FormAttachment(wlKeyFilename, 0, SWT.CENTER);
wbKeyFilename.setLayoutData(fdbKeyFilename);
wKeyFilename = new TextVar(variables, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wKeyFilename.setToolTipText(BaseMessages.getString(PKG, "ActionFtpDelete.KeyFilename.Tooltip"));
props.setLook(wKeyFilename);
wKeyFilename.addModifyListener(lsMod);
FormData fdKeyFilename = new FormData();
fdKeyFilename.left = new FormAttachment(middle, margin);
fdKeyFilename.top = new FormAttachment(wlKeyFilename, 0, SWT.CENTER);
fdKeyFilename.right = new FormAttachment(wbKeyFilename, -margin);
wKeyFilename.setLayoutData(fdKeyFilename);
// Whenever something changes, set the tooltip to the expanded version:
wKeyFilename.addModifyListener(e -> wKeyFilename.setToolTipText(variables.resolve(wKeyFilename.getText())));
wbKeyFilename.addListener(SWT.Selection, e -> BaseDialog.presentFileDialog(shell, wKeyFilename, variables, new String[] { "*.pem", "*" }, FILETYPES, true));
// keyfilePass line
wKeyFilePass = new LabelTextVar(variables, wServerSettings, BaseMessages.getString(PKG, "ActionFtpDelete.keyfilePass.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.keyfilePass.Tooltip"), true);
props.setLook(wKeyFilePass);
wKeyFilePass.addModifyListener(lsMod);
FormData fdkeyfilePass = new FormData();
fdkeyfilePass.left = new FormAttachment(0, 0);
fdkeyfilePass.top = new FormAttachment(wKeyFilename, margin);
fdkeyfilePass.right = new FormAttachment(100, 0);
wKeyFilePass.setLayoutData(fdkeyfilePass);
// Test connection button
Button wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "ActionFtpDelete.TestConnection.Label"));
props.setLook(wTest);
FormData fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "ActionFtpDelete.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wKeyFilePass, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
wTest.addListener(SWT.Selection, e -> test());
FormData fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
FormData fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Advanced TAB ///
// ////////////////////////
CTabItem wFilesTab = new CTabItem(wTabFolder, SWT.NONE);
wFilesTab.setText(BaseMessages.getString(PKG, "ActionFtpDelete.Tab.Files.Label"));
Composite wFilesComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFilesComp);
FormLayout advancedLayout = new FormLayout();
advancedLayout.marginWidth = 3;
advancedLayout.marginHeight = 3;
wFilesComp.setLayout(advancedLayout);
// ////////////////////////
// START OF Advanced SETTINGS GROUP///
// /
Group wAdvancedSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedSettings);
wAdvancedSettings.setText(BaseMessages.getString(PKG, "ActionFtpDelete.AdvancedSettings.Group.Label"));
FormLayout advancedSettingsgroupLayout = new FormLayout();
advancedSettingsgroupLayout.marginWidth = 10;
advancedSettingsgroupLayout.marginHeight = 10;
wAdvancedSettings.setLayout(advancedSettingsgroupLayout);
// Timeout line
wTimeout = new LabelTextVar(variables, wAdvancedSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.Timeout.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.Timeout.Tooltip"), false, false);
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
FormData fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wActive, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
// active connection?
Label wlActive = new Label(wAdvancedSettings, SWT.RIGHT);
wlActive.setText(BaseMessages.getString(PKG, "ActionFtpDelete.ActiveConns.Label"));
props.setLook(wlActive);
FormData fdlActive = new FormData();
fdlActive.left = new FormAttachment(0, 0);
fdlActive.top = new FormAttachment(wTimeout, margin);
fdlActive.right = new FormAttachment(middle, 0);
wlActive.setLayoutData(fdlActive);
wActive = new Button(wAdvancedSettings, SWT.CHECK);
wActive.setToolTipText(BaseMessages.getString(PKG, "ActionFtpDelete.ActiveConns.Tooltip"));
props.setLook(wActive);
FormData fdActive = new FormData();
fdActive.left = new FormAttachment(middle, margin);
fdActive.top = new FormAttachment(wlActive, 0, SWT.CENTER);
fdActive.right = new FormAttachment(100, 0);
wActive.setLayoutData(fdActive);
FormData fdAdvancedSettings = new FormData();
fdAdvancedSettings.left = new FormAttachment(0, margin);
fdAdvancedSettings.top = new FormAttachment(0, margin);
fdAdvancedSettings.right = new FormAttachment(100, -margin);
wAdvancedSettings.setLayoutData(fdAdvancedSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Remote SETTINGS GROUP///
// /
Group wRemoteSettings = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wRemoteSettings);
wRemoteSettings.setText(BaseMessages.getString(PKG, "ActionFtpDelete.RemoteSettings.Group.Label"));
FormLayout remoteSettinsgroupLayout = new FormLayout();
remoteSettinsgroupLayout.marginWidth = 10;
remoteSettinsgroupLayout.marginHeight = 10;
wRemoteSettings.setLayout(remoteSettinsgroupLayout);
// Get arguments from previous result...
Label wlGetPrevious = new Label(wRemoteSettings, SWT.RIGHT);
wlGetPrevious.setText(BaseMessages.getString(PKG, "ActionFtpDelete.getPrevious.Label"));
props.setLook(wlGetPrevious);
FormData fdlGetPrevious = new FormData();
fdlGetPrevious.left = new FormAttachment(0, 0);
fdlGetPrevious.top = new FormAttachment(wAdvancedSettings, margin);
fdlGetPrevious.right = new FormAttachment(middle, 0);
wlGetPrevious.setLayoutData(fdlGetPrevious);
wGetPrevious = new Button(wRemoteSettings, SWT.CHECK);
props.setLook(wGetPrevious);
wGetPrevious.setToolTipText(BaseMessages.getString(PKG, "ActionFtpDelete.getPrevious.Tooltip"));
FormData fdGetPrevious = new FormData();
fdGetPrevious.left = new FormAttachment(middle, margin);
fdGetPrevious.top = new FormAttachment(wlGetPrevious, 0, SWT.CENTER);
fdGetPrevious.right = new FormAttachment(100, 0);
wGetPrevious.setLayoutData(fdGetPrevious);
wGetPrevious.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
activeCopyFromPrevious();
action.setChanged();
}
});
// FTP directory
wlFtpDirectory = new Label(wRemoteSettings, SWT.RIGHT);
wlFtpDirectory.setText(BaseMessages.getString(PKG, "ActionFtpDelete.RemoteDir.Label"));
props.setLook(wlFtpDirectory);
FormData fdlFtpDirectory = new FormData();
fdlFtpDirectory.left = new FormAttachment(0, 0);
fdlFtpDirectory.top = new FormAttachment(wlGetPrevious, 2 * 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, "ActionFtpDelete.TestFolderExists.Label"));
FormData fdbTestChangeFolderExists = new FormData();
fdbTestChangeFolderExists.right = new FormAttachment(100, 0);
fdbTestChangeFolderExists.top = new FormAttachment(wGetPrevious, margin);
wbTestChangeFolderExists.setLayoutData(fdbTestChangeFolderExists);
wbTestChangeFolderExists.addListener(SWT.Selection, e -> checkFtpFolder());
wFtpDirectory = new TextVar(variables, wRemoteSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpDelete.RemoteDir.Tooltip"));
props.setLook(wFtpDirectory);
wFtpDirectory.addModifyListener(lsMod);
FormData fdFtpDirectory = new FormData();
fdFtpDirectory.left = new FormAttachment(middle, margin);
fdFtpDirectory.top = new FormAttachment(wGetPrevious, margin);
fdFtpDirectory.right = new FormAttachment(wbTestChangeFolderExists, -margin);
wFtpDirectory.setLayoutData(fdFtpDirectory);
// Wildcard line
wWildcard = new LabelTextVar(variables, wRemoteSettings, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.Wildcard.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.Wildcard.Tooltip"), false, false);
props.setLook(wWildcard);
wWildcard.addModifyListener(lsMod);
FormData fdWildcard = new FormData();
fdWildcard.left = new FormAttachment(0, 0);
fdWildcard.top = new FormAttachment(wFtpDirectory, margin);
fdWildcard.right = new FormAttachment(100, 0);
wWildcard.setLayoutData(fdWildcard);
FormData fdRemoteSettings = new FormData();
fdRemoteSettings.left = new FormAttachment(0, margin);
fdRemoteSettings.top = new FormAttachment(wAdvancedSettings, margin);
fdRemoteSettings.right = new FormAttachment(100, -margin);
wRemoteSettings.setLayoutData(fdRemoteSettings);
// ///////////////////////////////////////////////////////////
// / END OF Remote SETTINGSGROUP
// ///////////////////////////////////////////////////////////
// SuccessOngrouping?
// ////////////////////////
// START OF SUCCESS ON GROUP///
// /
Group wSuccessOn = new Group(wFilesComp, SWT.SHADOW_NONE);
props.setLook(wSuccessOn);
wSuccessOn.setText(BaseMessages.getString(PKG, "ActionFtpDelete.SuccessOn.Group.Label"));
FormLayout successongroupLayout = new FormLayout();
successongroupLayout.marginWidth = 10;
successongroupLayout.marginHeight = 10;
wSuccessOn.setLayout(successongroupLayout);
// Success Condition
Label wlSuccessCondition = new Label(wSuccessOn, SWT.RIGHT);
wlSuccessCondition.setText(BaseMessages.getString(PKG, "ActionFtpDelete.SuccessCondition.Label") + " ");
props.setLook(wlSuccessCondition);
FormData fdlSuccessCondition = new FormData();
fdlSuccessCondition.left = new FormAttachment(0, 0);
fdlSuccessCondition.right = new FormAttachment(middle, 0);
fdlSuccessCondition.top = new FormAttachment(wRemoteSettings, margin);
wlSuccessCondition.setLayoutData(fdlSuccessCondition);
wSuccessCondition = new CCombo(wSuccessOn, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wSuccessCondition.add(BaseMessages.getString(PKG, "ActionFtpDelete.SuccessWhenAllWorksFine.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "ActionFtpDelete.SuccessWhenAtLeat.Label"));
wSuccessCondition.add(BaseMessages.getString(PKG, "ActionFtpDelete.SuccessWhenNrErrorsLessThan.Label"));
// +1: starts at -1
wSuccessCondition.select(0);
props.setLook(wSuccessCondition);
FormData fdSuccessCondition = new FormData();
fdSuccessCondition.left = new FormAttachment(middle, 0);
fdSuccessCondition.top = new FormAttachment(wRemoteSettings, margin);
fdSuccessCondition.right = new FormAttachment(100, 0);
wSuccessCondition.setLayoutData(fdSuccessCondition);
wSuccessCondition.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
activeSuccessCondition();
}
});
// Success when number of errors less than
wlNrErrorsLessThan = new Label(wSuccessOn, SWT.RIGHT);
wlNrErrorsLessThan.setText(BaseMessages.getString(PKG, "ActionFtpDelete.NrBadFormedLessThan.Label") + " ");
props.setLook(wlNrErrorsLessThan);
FormData 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(variables, wSuccessOn, SWT.SINGLE | SWT.LEFT | SWT.BORDER, BaseMessages.getString(PKG, "ActionFtpDelete.NrBadFormedLessThan.Tooltip"));
props.setLook(wNrErrorsLessThan);
wNrErrorsLessThan.addModifyListener(lsMod);
FormData fdNrErrorsLessThan = new FormData();
fdNrErrorsLessThan.left = new FormAttachment(middle, 0);
fdNrErrorsLessThan.top = new FormAttachment(wSuccessCondition, margin);
fdNrErrorsLessThan.right = new FormAttachment(100, -margin);
wNrErrorsLessThan.setLayoutData(fdNrErrorsLessThan);
FormData fdSuccessOn = new FormData();
fdSuccessOn.left = new FormAttachment(0, margin);
fdSuccessOn.top = new FormAttachment(wRemoteSettings, margin);
fdSuccessOn.right = new FormAttachment(100, -margin);
wSuccessOn.setLayoutData(fdSuccessOn);
// ///////////////////////////////////////////////////////////
// / END OF Success ON GROUP
// ///////////////////////////////////////////////////////////
FormData fdFilesComp = new FormData();
fdFilesComp.left = new FormAttachment(0, 0);
fdFilesComp.top = new FormAttachment(0, 0);
fdFilesComp.right = new FormAttachment(100, 0);
fdFilesComp.bottom = new FormAttachment(100, 0);
wFilesComp.setLayoutData(fdFilesComp);
wFilesComp.layout();
wFilesTab.setControl(wFilesComp);
props.setLook(wFilesComp);
// ///////////////////////////////////////////////////////////
// / END OF Advanced TAB
// ///////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////
// Start of Socks Proxy Tab
// ///////////////////////////////////////////////////////////
CTabItem wSocksProxyTab = new CTabItem(wTabFolder, SWT.NONE);
wSocksProxyTab.setText(BaseMessages.getString(PKG, "ActionFtpDelete.Tab.Socks.Label"));
Composite wSocksProxyComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSocksProxyComp);
FormLayout soxProxyLayout = new FormLayout();
soxProxyLayout.marginWidth = 3;
soxProxyLayout.marginHeight = 3;
wSocksProxyComp.setLayout(soxProxyLayout);
// ////////////////////////////////////////////////////////
// Start of Proxy Group
// ////////////////////////////////////////////////////////
wSocksProxy = new Group(wSocksProxyComp, SWT.SHADOW_NONE);
props.setLook(wSocksProxy);
wSocksProxy.setText(BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxy.Group.Label"));
FormLayout socksProxyGroupLayout = new FormLayout();
socksProxyGroupLayout.marginWidth = 10;
socksProxyGroupLayout.marginHeight = 10;
wSocksProxy.setLayout(socksProxyGroupLayout);
// host line
wSocksProxyHost = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyHost.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyHost.Tooltip"), false, false);
props.setLook(wSocksProxyHost);
wSocksProxyHost.addModifyListener(lsMod);
FormData fdSocksProxyHost = new FormData();
fdSocksProxyHost.left = new FormAttachment(0, 0);
fdSocksProxyHost.top = new FormAttachment(wName, margin);
fdSocksProxyHost.right = new FormAttachment(100, margin);
wSocksProxyHost.setLayoutData(fdSocksProxyHost);
// port line
wSocksProxyPort = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyPort.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyPort.Tooltip"), false, false);
props.setLook(wSocksProxyPort);
wSocksProxyPort.addModifyListener(lsMod);
FormData fdSocksProxyPort = new FormData();
fdSocksProxyPort.left = new FormAttachment(0, 0);
fdSocksProxyPort.top = new FormAttachment(wSocksProxyHost, margin);
fdSocksProxyPort.right = new FormAttachment(100, margin);
wSocksProxyPort.setLayoutData(fdSocksProxyPort);
// username line
wSocksProxyUsername = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyUsername.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyPassword.Tooltip"), false, false);
props.setLook(wSocksProxyUsername);
wSocksProxyUsername.addModifyListener(lsMod);
FormData fdSocksProxyUsername = new FormData();
fdSocksProxyUsername.left = new FormAttachment(0, 0);
fdSocksProxyUsername.top = new FormAttachment(wSocksProxyPort, margin);
fdSocksProxyUsername.right = new FormAttachment(100, margin);
wSocksProxyUsername.setLayoutData(fdSocksProxyUsername);
// password line
wSocksProxyPassword = new LabelTextVar(variables, wSocksProxy, SWT.NONE, BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyPassword.Label"), BaseMessages.getString(PKG, "ActionFtpDelete.SocksProxyPassword.Tooltip"), true, false);
props.setLook(wSocksProxyPort);
wSocksProxyPassword.addModifyListener(lsMod);
FormData fdSocksProxyPassword = new FormData();
fdSocksProxyPassword.left = new FormAttachment(0, 0);
fdSocksProxyPassword.top = new FormAttachment(wSocksProxyUsername, margin);
fdSocksProxyPassword.right = new FormAttachment(100, margin);
wSocksProxyPassword.setLayoutData(fdSocksProxyPassword);
// ///////////////////////////////////////////////////////////////
// End of socks proxy group
// ///////////////////////////////////////////////////////////////
FormData fdSocksProxyComp = new FormData();
fdSocksProxyComp.left = new FormAttachment(0, margin);
fdSocksProxyComp.top = new FormAttachment(0, margin);
fdSocksProxyComp.right = new FormAttachment(100, -margin);
wSocksProxy.setLayoutData(fdSocksProxyComp);
wSocksProxyComp.layout();
wSocksProxyTab.setControl(wSocksProxyComp);
props.setLook(wSocksProxyComp);
// ////////////////////////////////////////////////////////
// End of Socks Proxy Tab
// ////////////////////////////////////////////////////////
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(wOk, -2 * margin);
wTabFolder.setLayoutData(fdTabFolder);
getData();
activeSuccessCondition();
activeUsePublicKey();
activeProxy();
activeFtpProtocol();
activeCopyFromPrevious();
wTabFolder.setSelection(0);
BaseDialog.defaultShellHandling(shell, c -> ok(), c -> cancel());
return action;
}
Aggregations