use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class MQTTProducerDialog method buildSetupTab.
private void buildSetupTab() {
CTabItem wSetupTab = new CTabItem(wTabFolder, SWT.NONE);
wSetupTab.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.SetupTab"));
Composite wSetupComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSetupComp);
FormLayout setupLayout = new FormLayout();
setupLayout.marginHeight = 15;
setupLayout.marginWidth = 15;
wSetupComp.setLayout(setupLayout);
Label wlMqttServer = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlMqttServer);
wlMqttServer.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.Connection"));
FormData fdlBootstrapServers = new FormData();
fdlBootstrapServers.left = new FormAttachment(0, 0);
fdlBootstrapServers.top = new FormAttachment(0, 0);
fdlBootstrapServers.right = new FormAttachment(0, INPUT_WIDTH);
wlMqttServer.setLayoutData(fdlBootstrapServers);
wMqttServer = new TextVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMqttServer);
wMqttServer.addModifyListener(lsMod);
FormData fdBootstrapServers = new FormData();
fdBootstrapServers.left = new FormAttachment(0, 0);
fdBootstrapServers.top = new FormAttachment(wlMqttServer, 5);
fdBootstrapServers.right = new FormAttachment(0, INPUT_WIDTH);
wMqttServer.setLayoutData(fdBootstrapServers);
Label wlClientId = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlClientId);
wlClientId.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.ClientId"));
FormData fdlClientId = new FormData();
fdlClientId.left = new FormAttachment(0, 0);
fdlClientId.top = new FormAttachment(wMqttServer, 10);
fdlClientId.right = new FormAttachment(50, 0);
wlClientId.setLayoutData(fdlClientId);
wClientId = new TextVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wClientId);
wClientId.addModifyListener(lsMod);
FormData fdClientId = new FormData();
fdClientId.left = new FormAttachment(0, 0);
fdClientId.top = new FormAttachment(wlClientId, 5);
fdClientId.right = new FormAttachment(0, INPUT_WIDTH);
wClientId.setLayoutData(fdClientId);
Label wlTopic = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlTopic);
wlTopic.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.Topic"));
FormData fdlTopic = new FormData();
fdlTopic.left = new FormAttachment(0, 0);
fdlTopic.top = new FormAttachment(wClientId, 10);
fdlTopic.width = 200;
wlTopic.setLayoutData(fdlTopic);
wTopic = new TextVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTopic);
wTopic.addModifyListener(lsMod);
FormData fdTopic = new FormData();
fdTopic.left = new FormAttachment(0, 0);
fdTopic.top = new FormAttachment(wlTopic, 5);
fdTopic.width = 200;
wTopic.setLayoutData(fdTopic);
Label wlQOS = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlQOS);
wlQOS.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.QOS"));
FormData fdlQOS = new FormData();
fdlQOS.left = new FormAttachment(wlTopic, 15);
fdlQOS.top = new FormAttachment(wClientId, 10);
fdlQOS.width = 120;
wlQOS.setLayoutData(fdlQOS);
wQOS = new ComboVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wQOS);
wQOS.addModifyListener(lsMod);
FormData fdQOS = new FormData();
fdQOS.left = new FormAttachment(wTopic, 15);
fdQOS.top = new FormAttachment(wlQOS, 5);
fdQOS.width = 135;
wQOS.setLayoutData(fdQOS);
wQOS.add("0");
wQOS.add("1");
wQOS.add("2");
Label wlMessageField = new Label(wSetupComp, SWT.LEFT);
props.setLook(wlMessageField);
wlMessageField.setText(BaseMessages.getString(PKG, "MQTTProducerDialog.MessageField"));
FormData fdlMessageField = new FormData();
fdlMessageField.left = new FormAttachment(0, 0);
fdlMessageField.top = new FormAttachment(wTopic, 10);
fdlMessageField.right = new FormAttachment(50, 0);
wlMessageField.setLayoutData(fdlMessageField);
wMessageField = new ComboVar(transMeta, wSetupComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMessageField);
wMessageField.addModifyListener(lsMod);
FormData fdMessageField = new FormData();
fdMessageField.left = new FormAttachment(0, 0);
fdMessageField.top = new FormAttachment(wlMessageField, 5);
fdMessageField.right = new FormAttachment(0, INPUT_WIDTH);
wMessageField.setLayoutData(fdMessageField);
Listener lsMessageFocus = e -> {
String current = wMessageField.getText();
wMessageField.getCComboWidget().removeAll();
wMessageField.setText(current);
try {
RowMetaInterface rmi = transMeta.getPrevStepFields(meta.getParentStepMeta().getName());
List ls = rmi.getValueMetaList();
for (Object l : ls) {
ValueMetaBase vmb = (ValueMetaBase) l;
wMessageField.add(vmb.getName());
}
} catch (KettleStepException ex) {
// do nothing
}
};
wMessageField.getCComboWidget().addListener(SWT.FocusIn, lsMessageFocus);
FormData fdSetupComp = new FormData();
fdSetupComp.left = new FormAttachment(0, 0);
fdSetupComp.top = new FormAttachment(0, 0);
fdSetupComp.right = new FormAttachment(100, 0);
fdSetupComp.bottom = new FormAttachment(100, 0);
wSetupComp.setLayoutData(fdSetupComp);
wSetupComp.layout();
wSetupTab.setControl(wSetupComp);
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntrySQLDialog 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, "JobSQL.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
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, null);
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobSQL.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
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);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// Connection line
wConnection = addConnectionLine(shell, wName, middle, margin);
if (jobEntry.getDatabase() == null && jobMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsMod);
// SQL from file?
wlSQLFromFile = new Label(shell, SWT.RIGHT);
wlSQLFromFile.setText(BaseMessages.getString(PKG, "JobSQL.SQLFromFile.Label"));
props.setLook(wlSQLFromFile);
fdlSQLFromFile = new FormData();
fdlSQLFromFile.left = new FormAttachment(0, 0);
fdlSQLFromFile.top = new FormAttachment(wConnection, 2 * margin);
fdlSQLFromFile.right = new FormAttachment(middle, -margin);
wlSQLFromFile.setLayoutData(fdlSQLFromFile);
wSQLFromFile = new Button(shell, SWT.CHECK);
props.setLook(wSQLFromFile);
wSQLFromFile.setToolTipText(BaseMessages.getString(PKG, "JobSQL.SQLFromFile.Tooltip"));
fdSQLFromFile = new FormData();
fdSQLFromFile.left = new FormAttachment(middle, 0);
fdSQLFromFile.top = new FormAttachment(wConnection, 2 * margin);
fdSQLFromFile.right = new FormAttachment(100, 0);
wSQLFromFile.setLayoutData(fdSQLFromFile);
wSQLFromFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeSQLFromFile();
jobEntry.setChanged();
}
});
// Filename line
wlFilename = new Label(shell, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "JobSQL.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(wSQLFromFile, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(wSQLFromFile, margin);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.setToolTipText(BaseMessages.getString(PKG, "JobSQL.Filename.Tooltip"));
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(wSQLFromFile, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
}
});
wbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.sql", "*.txt", "*" });
if (wFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// Send one SQL Statement?
wlUseOneStatement = new Label(shell, SWT.RIGHT);
wlUseOneStatement.setText(BaseMessages.getString(PKG, "JobSQL.SendOneStatement.Label"));
props.setLook(wlUseOneStatement);
fdlUseOneStatement = new FormData();
fdlUseOneStatement.left = new FormAttachment(0, 0);
fdlUseOneStatement.top = new FormAttachment(wbFilename, margin);
fdlUseOneStatement.right = new FormAttachment(middle, -margin);
wlUseOneStatement.setLayoutData(fdlUseOneStatement);
wSendOneStatement = new Button(shell, SWT.CHECK);
props.setLook(wSendOneStatement);
wSendOneStatement.setToolTipText(BaseMessages.getString(PKG, "JobSQL.SendOneStatement.Tooltip"));
fdUseOneStatement = new FormData();
fdUseOneStatement.left = new FormAttachment(middle, 0);
fdUseOneStatement.top = new FormAttachment(wbFilename, margin);
fdUseOneStatement.right = new FormAttachment(100, 0);
wSendOneStatement.setLayoutData(fdUseOneStatement);
wSendOneStatement.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Use variable substitution?
wlUseSubs = new Label(shell, SWT.RIGHT);
wlUseSubs.setText(BaseMessages.getString(PKG, "JobSQL.UseVariableSubst.Label"));
props.setLook(wlUseSubs);
fdlUseSubs = new FormData();
fdlUseSubs.left = new FormAttachment(0, 0);
fdlUseSubs.top = new FormAttachment(wSendOneStatement, margin);
fdlUseSubs.right = new FormAttachment(middle, -margin);
wlUseSubs.setLayoutData(fdlUseSubs);
wUseSubs = new Button(shell, SWT.CHECK);
props.setLook(wUseSubs);
wUseSubs.setToolTipText(BaseMessages.getString(PKG, "JobSQL.UseVariableSubst.Tooltip"));
fdUseSubs = new FormData();
fdUseSubs.left = new FormAttachment(middle, 0);
fdUseSubs.top = new FormAttachment(wSendOneStatement, margin);
fdUseSubs.right = new FormAttachment(100, 0);
wUseSubs.setLayoutData(fdUseSubs);
wUseSubs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setUseVariableSubstitution(!jobEntry.getUseVariableSubstitution());
jobEntry.setChanged();
}
});
wlPosition = new Label(shell, SWT.NONE);
wlPosition.setText(BaseMessages.getString(PKG, "JobSQL.LineNr.Label", "0"));
props.setLook(wlPosition);
fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(0, 0);
fdlPosition.right = new FormAttachment(100, 0);
fdlPosition.bottom = new FormAttachment(wOK, -margin);
wlPosition.setLayoutData(fdlPosition);
// Script line
wlSQL = new Label(shell, SWT.NONE);
wlSQL.setText(BaseMessages.getString(PKG, "JobSQL.Script.Label"));
props.setLook(wlSQL);
fdlSQL = new FormData();
fdlSQL.left = new FormAttachment(0, 0);
fdlSQL.top = new FormAttachment(wUseSubs, margin);
wlSQL.setLayoutData(fdlSQL);
wSQL = new StyledTextComp(jobEntry, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wSQL, Props.WIDGET_STYLE_FIXED);
wSQL.addModifyListener(lsMod);
fdSQL = new FormData();
fdSQL.left = new FormAttachment(0, 0);
fdSQL.top = new FormAttachment(wlSQL, margin);
fdSQL.right = new FormAttachment(100, -10);
fdSQL.bottom = new FormAttachment(wlPosition, -margin);
wSQL.setLayoutData(fdSQL);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wSQL.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
setPosition();
}
});
wSQL.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
setPosition();
}
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wSQL.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
setPosition();
}
public void focusLost(FocusEvent e) {
setPosition();
}
});
wSQL.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
public void mouseDown(MouseEvent e) {
setPosition();
}
public void mouseUp(MouseEvent e) {
setPosition();
}
});
wSQL.addModifyListener(lsMod);
// Text Higlighting
wSQL.addLineStyleListener(new SQLValuesHighlight());
getData();
activeSQLFromFile();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSQLDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntryTableExistsDialog 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, "JobTableExists.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobTableExists.Name.Label"));
props.setLook(wlName);
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);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// Connection line
wConnection = addConnectionLine(shell, wName, middle, margin);
if (jobEntry.getDatabase() == null && jobMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsMod);
// Schema name line
wlSchemaname = new Label(shell, SWT.RIGHT);
wlSchemaname.setText(BaseMessages.getString(PKG, "JobTableExists.Schemaname.Label"));
props.setLook(wlSchemaname);
fdlSchemaname = new FormData();
fdlSchemaname.left = new FormAttachment(0, 0);
fdlSchemaname.right = new FormAttachment(middle, -margin);
fdlSchemaname.top = new FormAttachment(wConnection, 2 * margin);
wlSchemaname.setLayoutData(fdlSchemaname);
wbSchema = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbSchema);
wbSchema.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbSchema = new FormData();
fdbSchema.top = new FormAttachment(wConnection, 2 * margin);
fdbSchema.right = new FormAttachment(100, 0);
wbSchema.setLayoutData(fdbSchema);
wbSchema.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getSchemaNames();
}
});
wSchemaname = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSchemaname);
wSchemaname.addModifyListener(lsMod);
fdSchemaname = new FormData();
fdSchemaname.left = new FormAttachment(middle, 0);
fdSchemaname.top = new FormAttachment(wConnection, 2 * margin);
fdSchemaname.right = new FormAttachment(wbSchema, -margin);
wSchemaname.setLayoutData(fdSchemaname);
// Table name line
wlTablename = new Label(shell, SWT.RIGHT);
wlTablename.setText(BaseMessages.getString(PKG, "JobTableExists.Tablename.Label"));
props.setLook(wlTablename);
fdlTablename = new FormData();
fdlTablename.left = new FormAttachment(0, 0);
fdlTablename.right = new FormAttachment(middle, -margin);
fdlTablename.top = new FormAttachment(wbSchema, margin);
wlTablename.setLayoutData(fdlTablename);
wbTable = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbTable);
wbTable.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
FormData fdbTable = new FormData();
fdbTable.right = new FormAttachment(100, 0);
fdbTable.top = new FormAttachment(wbSchema, margin);
wbTable.setLayoutData(fdbTable);
wbTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getTableName();
}
});
wTablename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTablename);
wTablename.addModifyListener(lsMod);
fdTablename = new FormData();
fdTablename.left = new FormAttachment(middle, 0);
fdTablename.top = new FormAttachment(wbSchema, margin);
fdTablename.right = new FormAttachment(wbTable, -margin);
wTablename.setLayoutData(fdTablename);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
FormData fd = new FormData();
fd.right = new FormAttachment(50, -10);
fd.bottom = new FormAttachment(100, 0);
fd.width = 100;
wOK.setLayoutData(fd);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
fd = new FormData();
fd.left = new FormAttachment(50, 10);
fd.bottom = new FormAttachment(100, 0);
fd.width = 100;
wCancel.setLayoutData(fd);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTablename);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wTablename.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, "JobTableExistsDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntryTalendJobExecDialog 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, "JobEntryTalendJobExec.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobEntryTalendJobExec.Name.Label"));
props.setLook(wlName);
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);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
Control lastControl = wName;
// Filename line
wlFilename = new Label(shell, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "JobEntryTalendJobExec.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(lastControl, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(lastControl, 0);
// fdbFilename.height = 22;
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(lastControl, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
}
});
wbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
try {
FileObject fileName = null;
try {
String curFile = wFilename.getText();
if (curFile.trim().length() > 0) {
fileName = KettleVFS.getInstance().getFileSystemManager().resolveFile(jobMeta.environmentSubstitute(wFilename.getText()));
} else {
fileName = KettleVFS.getInstance().getFileSystemManager().resolveFile(Const.getUserHomeDirectory());
}
} catch (FileSystemException ex) {
fileName = KettleVFS.getInstance().getFileSystemManager().resolveFile(Const.getUserHomeDirectory());
}
VfsFileChooserDialog vfsFileChooser = Spoon.getInstance().getVfsFileChooserDialog(fileName.getParent(), fileName);
FileObject selected = vfsFileChooser.open(shell, null, EXTENSIONS, FILETYPES, VfsFileChooserDialog.VFS_DIALOG_OPEN_FILE);
wFilename.setText(selected != null ? selected.getURL().toString() : Const.EMPTY_STRING);
} catch (FileSystemException ex) {
ex.printStackTrace();
}
}
});
lastControl = wFilename;
// Filename line
Label wlClassName = new Label(shell, SWT.RIGHT);
wlClassName.setText(BaseMessages.getString(PKG, "JobEntryTalendJobExec.ClassName.Label"));
props.setLook(wlClassName);
FormData fdlClassName = new FormData();
fdlClassName.left = new FormAttachment(0, 0);
fdlClassName.right = new FormAttachment(middle, -margin);
fdlClassName.top = new FormAttachment(lastControl, margin);
wlClassName.setLayoutData(fdlClassName);
wClassName = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wClassName.setToolTipText(BaseMessages.getString(PKG, "JobEntryTalendJobExec.ClassName.Tooltip"));
props.setLook(wClassName);
wClassName.addModifyListener(lsMod);
FormData fdClassName = new FormData();
fdClassName.left = new FormAttachment(middle, 0);
fdClassName.top = new FormAttachment(lastControl, margin);
fdClassName.right = new FormAttachment(100, 0);
wClassName.setLayoutData(fdClassName);
lastControl = wClassName;
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
FormData fd = new FormData();
fd.right = new FormAttachment(50, -10);
fd.bottom = new FormAttachment(100, 0);
fd.width = 100;
wOK.setLayoutData(fd);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
fd = new FormData();
fd.left = new FormAttachment(50, 10);
fd.bottom = new FormAttachment(100, 0);
fd.width = 100;
wCancel.setLayoutData(fd);
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wClassName);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wFilename.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, "JobEntryTalendJobExec.DialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.TextVar in project pentaho-kettle by pentaho.
the class JobEntryBaseDialog method createElements.
protected void createElements() {
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
getJobEntry().setChanged();
}
};
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = 15;
formLayout.marginHeight = 15;
shell.setLayout(formLayout);
Label wicon = new Label(shell, SWT.RIGHT);
wicon.setImage(getImage());
FormData fdlicon = new FormData();
fdlicon.top = new FormAttachment(0, 0);
fdlicon.right = new FormAttachment(100, 0);
wicon.setLayoutData(fdlicon);
props.setLook(wicon);
wlName = new Label(shell, SWT.LEFT);
props.setLook(wlName);
wlName.setText(BaseMessages.getString(PKG, "JobTrans.JobStep.Label"));
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, 0);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
fdName = new FormData();
fdName.width = 250;
fdName.top = new FormAttachment(wlName, 5);
fdName.left = new FormAttachment(0, 0);
wName.setLayoutData(fdName);
Label spacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdSpacer = new FormData();
fdSpacer.left = new FormAttachment(0, 0);
fdSpacer.top = new FormAttachment(wName, 15);
fdSpacer.right = new FormAttachment(100, 0);
spacer.setLayoutData(fdSpacer);
wlPath = new Label(shell, SWT.LEFT);
props.setLook(wlPath);
FormData fdlTransformation = new FormData();
fdlTransformation.left = new FormAttachment(0, 0);
fdlTransformation.top = new FormAttachment(spacer, 20);
fdlTransformation.right = new FormAttachment(50, 0);
wlPath.setLayoutData(fdlTransformation);
wPath = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPath);
FormData fdTransformation = new FormData();
fdTransformation.left = new FormAttachment(0, 0);
fdTransformation.top = new FormAttachment(wlPath, 5);
fdTransformation.right = new FormAttachment(50, 0);
wPath.setLayoutData(fdTransformation);
wbBrowse = new Button(shell, SWT.PUSH);
props.setLook(wbBrowse);
wbBrowse.setText(BaseMessages.getString(PKG, "JobTrans.Browse.Label"));
FormData fdBrowse = new FormData();
fdBrowse.left = new FormAttachment(wPath, 5);
fdBrowse.top = new FormAttachment(wlPath, Const.isOSX() ? 0 : 5);
wbBrowse.setLayoutData(fdBrowse);
CTabFolder wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// Options Tab Start
CTabItem wOptionsTab = new CTabItem(wTabFolder, SWT.NONE);
wOptionsTab.setText(BaseMessages.getString(PKG, "JobTrans.Options.Group.Label"));
wOptions = new Composite(wTabFolder, SWT.SHADOW_NONE);
props.setLook(wOptions);
FormLayout specLayout = new FormLayout();
specLayout.marginWidth = 15;
specLayout.marginHeight = 15;
wOptions.setLayout(specLayout);
gExecution = new Group(wOptions, SWT.SHADOW_ETCHED_IN);
props.setLook(gExecution);
gExecution.setText(BaseMessages.getString(PKG, "JobTrans.Execution.Group.Label"));
FormLayout gExecutionLayout = new FormLayout();
gExecutionLayout.marginWidth = 15;
gExecutionLayout.marginHeight = 15;
gExecution.setLayout(gExecutionLayout);
fdgExecution = new FormData();
fdgExecution.top = new FormAttachment(0, 10);
fdgExecution.left = new FormAttachment(0, 0);
fdgExecution.right = new FormAttachment(100, 0);
gExecution.setLayoutData(fdgExecution);
wEveryRow = new Button(gExecution, SWT.CHECK);
props.setLook(wEveryRow);
wEveryRow.setText(BaseMessages.getString(PKG, "JobTrans.ExecForEveryInputRow.Label"));
FormData fdbExecute = new FormData();
fdbExecute.left = new FormAttachment(0, 0);
fdbExecute.top = new FormAttachment(0, 0);
wEveryRow.setLayoutData(fdbExecute);
wOptionsTab.setControl(wOptions);
FormData fdOptions = new FormData();
fdOptions.left = new FormAttachment(0, 0);
fdOptions.top = new FormAttachment(0, 0);
fdOptions.right = new FormAttachment(100, 0);
fdOptions.bottom = new FormAttachment(100, 0);
wOptions.setLayoutData(fdOptions);
// Options Tab End
// Logging Tab Start
CTabItem wLoggingTab = new CTabItem(wTabFolder, SWT.NONE);
wLoggingTab.setText(BaseMessages.getString(PKG, "JobTrans.LogSettings.Group.Label"));
Composite wLogging = new Composite(wTabFolder, SWT.SHADOW_NONE);
props.setLook(wLogging);
FormLayout loggingLayout = new FormLayout();
loggingLayout.marginWidth = 15;
loggingLayout.marginHeight = 15;
wLogging.setLayout(loggingLayout);
wSetLogfile = new Button(wLogging, SWT.CHECK);
props.setLook(wSetLogfile);
wSetLogfile.setText(BaseMessages.getString(PKG, "JobTrans.Specify.Logfile.Label"));
FormData fdSpecifyLogFile = new FormData();
fdSpecifyLogFile.left = new FormAttachment(0, 0);
fdSpecifyLogFile.top = new FormAttachment(0, 0);
wSetLogfile.setLayoutData(fdSpecifyLogFile);
gLogFile = new Group(wLogging, SWT.SHADOW_ETCHED_IN);
props.setLook(gLogFile);
gLogFile.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.Group.Label"));
FormLayout gLogFileLayout = new FormLayout();
gLogFileLayout.marginWidth = 15;
gLogFileLayout.marginHeight = 15;
gLogFile.setLayout(gLogFileLayout);
FormData fdgLogFile = new FormData();
fdgLogFile.top = new FormAttachment(wSetLogfile, 10);
fdgLogFile.left = new FormAttachment(0, 0);
fdgLogFile.right = new FormAttachment(100, 0);
gLogFile.setLayoutData(fdgLogFile);
wlLogfile = new Label(gLogFile, SWT.LEFT);
props.setLook(wlLogfile);
wlLogfile.setText(BaseMessages.getString(PKG, "JobTrans.NameOfLogfile.Label"));
FormData fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, 0);
wlLogfile.setLayoutData(fdlName);
wLogfile = new TextVar(jobMeta, gLogFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLogfile);
FormData fdName = new FormData();
fdName.width = 250;
fdName.left = new FormAttachment(0, 0);
fdName.top = new FormAttachment(wlLogfile, 5);
wLogfile.setLayoutData(fdName);
wbLogFilename = new Button(gLogFile, SWT.PUSH | SWT.CENTER);
props.setLook(wbLogFilename);
wbLogFilename.setText(BaseMessages.getString(PKG, "JobTrans.Browse.Label"));
fdbLogFilename = new FormData();
fdbLogFilename.top = new FormAttachment(wlLogfile, Const.isOSX() ? 0 : 5);
fdbLogFilename.left = new FormAttachment(wLogfile, 5);
wbLogFilename.setLayoutData(fdbLogFilename);
wlLogext = new Label(gLogFile, SWT.LEFT);
props.setLook(wlLogext);
wlLogext.setText(BaseMessages.getString(PKG, "JobTrans.LogfileExtension.Label"));
FormData fdlExtension = new FormData();
fdlExtension.left = new FormAttachment(0, 0);
fdlExtension.top = new FormAttachment(wLogfile, 10);
wlLogext.setLayoutData(fdlExtension);
wLogext = new TextVar(jobMeta, gLogFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLogext);
FormData fdExtension = new FormData();
fdExtension.width = 250;
fdExtension.left = new FormAttachment(0, 0);
fdExtension.top = new FormAttachment(wlLogext, 5);
wLogext.setLayoutData(fdExtension);
wlLoglevel = new Label(gLogFile, SWT.LEFT);
props.setLook(wlLoglevel);
wlLoglevel.setText(BaseMessages.getString(PKG, "JobTrans.Loglevel.Label"));
FormData fdlLogLevel = new FormData();
fdlLogLevel.left = new FormAttachment(0, 0);
fdlLogLevel.top = new FormAttachment(wLogext, 10);
wlLoglevel.setLayoutData(fdlLogLevel);
wLoglevel = new CCombo(gLogFile, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wLoglevel.setItems(LogLevel.getLogLevelDescriptions());
props.setLook(wLoglevel);
FormData fdLogLevel = new FormData();
fdLogLevel.width = 250;
fdLogLevel.left = new FormAttachment(0, 0);
fdLogLevel.top = new FormAttachment(wlLoglevel, 5);
wLoglevel.setLayoutData(fdLogLevel);
wAppendLogfile = new Button(gLogFile, SWT.CHECK);
props.setLook(wAppendLogfile);
wAppendLogfile.setText(BaseMessages.getString(PKG, "JobTrans.Append.Logfile.Label"));
FormData fdLogFile = new FormData();
fdLogFile.left = new FormAttachment(0, 0);
fdLogFile.top = new FormAttachment(wLoglevel, 10);
wAppendLogfile.setLayoutData(fdLogFile);
wCreateParentFolder = new Button(gLogFile, SWT.CHECK);
props.setLook(wCreateParentFolder);
wCreateParentFolder.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.CreateParentFolder.Label"));
FormData fdCreateParent = new FormData();
fdCreateParent.left = new FormAttachment(0, 0);
fdCreateParent.top = new FormAttachment(wAppendLogfile, 10);
wCreateParentFolder.setLayoutData(fdCreateParent);
wAddDate = new Button(gLogFile, SWT.CHECK);
props.setLook(wAddDate);
wAddDate.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.IncludeDate.Label"));
FormData fdIncludeDate = new FormData();
fdIncludeDate.left = new FormAttachment(0, 0);
fdIncludeDate.top = new FormAttachment(wCreateParentFolder, 10);
wAddDate.setLayoutData(fdIncludeDate);
wAddTime = new Button(gLogFile, SWT.CHECK);
props.setLook(wAddTime);
wAddTime.setText(BaseMessages.getString(PKG, "JobTrans.Logfile.IncludeTime.Label"));
FormData fdIncludeTime = new FormData();
fdIncludeTime.left = new FormAttachment(0, 0);
fdIncludeTime.top = new FormAttachment(wAddDate, 10);
wAddTime.setLayoutData(fdIncludeTime);
wSetLogfile.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
setActive();
}
});
wLoggingTab.setControl(wLogging);
FormData fdLogging = new FormData();
fdLogging.left = new FormAttachment(0, 0);
fdLogging.top = new FormAttachment(0, 0);
fdLogging.right = new FormAttachment(100, 0);
fdLogging.bottom = new FormAttachment(100, 0);
wOptions.setLayoutData(fdLogging);
// Logging Tab End
CTabItem wArgumentTab = new CTabItem(wTabFolder, SWT.NONE);
wArgumentTab.setText(BaseMessages.getString(PKG, "JobTrans.Fields.Arguments.Label"));
FormLayout fieldLayout = new FormLayout();
fieldLayout.marginWidth = 15;
fieldLayout.marginHeight = 15;
Composite wFieldComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFieldComp);
wFieldComp.setLayout(fieldLayout);
wPrevious = new Button(wFieldComp, SWT.CHECK);
props.setLook(wPrevious);
wPrevious.setSelection(getArgFromPrev());
wPrevious.setText(BaseMessages.getString(PKG, "JobTrans.Previous.Label"));
FormData fdCopyResults = new FormData();
fdCopyResults.top = new FormAttachment(0, 0);
fdCopyResults.left = new FormAttachment(0, 0);
wPrevious.setLayoutData(fdCopyResults);
wPrevious.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
wFields.setEnabled(!getArgFromPrev());
}
});
final int FieldsCols = 1;
int rows = getArguments() == null ? 1 : (getArguments().length == 0 ? 0 : getArguments().length);
final int FieldsRows = rows;
ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
colinf[0] = new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Arguments.Argument.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false);
colinf[0].setUsingVariables(true);
wFields = new TableView(jobMeta, wFieldComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.NO_SCROLL | SWT.V_SCROLL, colinf, FieldsRows, false, lsMod, props, false);
FormData fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wPrevious, 15);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, 0);
wFields.setLayoutData(fdFields);
wFields.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 100));
FormData fdFieldsComp = new FormData();
fdFieldsComp.left = new FormAttachment(0, 0);
fdFieldsComp.top = new FormAttachment(0, 0);
fdFieldsComp.right = new FormAttachment(100, 0);
fdFieldsComp.bottom = new FormAttachment(100, 0);
wFieldComp.setLayoutData(fdFieldsComp);
wFieldComp.layout();
wArgumentTab.setControl(wFieldComp);
CTabItem wParametersTab = new CTabItem(wTabFolder, SWT.NONE);
wParametersTab.setText(BaseMessages.getString(PKG, "JobTrans.Fields.Parameters.Label"));
fieldLayout = new FormLayout();
fieldLayout.marginWidth = 15;
fieldLayout.marginHeight = 15;
Composite wParameterComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wParameterComp);
wParameterComp.setLayout(fieldLayout);
wPrevToParams = new Button(wParameterComp, SWT.CHECK);
props.setLook(wPrevToParams);
wPrevToParams.setText(BaseMessages.getString(PKG, "JobTrans.PrevToParams.Label"));
FormData fdCopyResultsParams = new FormData();
fdCopyResultsParams.left = new FormAttachment(0, 0);
fdCopyResultsParams.top = new FormAttachment(0, 0);
wPrevToParams.setLayoutData(fdCopyResultsParams);
wPrevToParams.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
getJobEntry().setChanged();
}
});
wPassParams = new Button(wParameterComp, SWT.CHECK);
props.setLook(wPassParams);
FormData fdPassParams = new FormData();
fdPassParams.left = new FormAttachment(0, 0);
fdPassParams.top = new FormAttachment(wPrevToParams, 10);
wPassParams.setLayoutData(fdPassParams);
wbGetParams = new Button(wParameterComp, SWT.PUSH);
wbGetParams.setText(BaseMessages.getString(PKG, "JobTrans.GetParameters.Button.Label"));
FormData fdGetParams = new FormData();
fdGetParams.bottom = new FormAttachment(100, 0);
fdGetParams.right = new FormAttachment(100, 0);
wbGetParams.setLayoutData(fdGetParams);
final int parameterRows = getParamters() != null ? getParamters().length : 0;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Parameters.Parameter.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Parameters.ColumnName.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "JobTrans.Parameters.Value.Label"), ColumnInfo.COLUMN_TYPE_TEXT, false) };
colinf[2].setUsingVariables(true);
wParameters = new TableView(jobMeta, wParameterComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, parameterRows, false, lsMod, props, false);
props.setLook(wParameters);
FormData fdParameters = new FormData();
fdParameters.left = new FormAttachment(0, 0);
fdParameters.top = new FormAttachment(wPassParams, 10);
fdParameters.right = new FormAttachment(100);
fdParameters.bottom = new FormAttachment(wbGetParams, -10);
wParameters.setLayoutData(fdParameters);
wParameters.getTable().addListener(SWT.Resize, new ColumnsResizer(0, 33, 33, 33));
FormData fdParametersComp = new FormData();
fdParametersComp.left = new FormAttachment(0, 0);
fdParametersComp.top = new FormAttachment(0, 0);
fdParametersComp.right = new FormAttachment(100, 0);
fdParametersComp.bottom = new FormAttachment(100, 0);
wParameterComp.setLayoutData(fdParametersComp);
wParameterComp.layout();
wParametersTab.setControl(wParameterComp);
wTabFolder.setSelection(0);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
FormData fdCancel = new FormData();
fdCancel.right = new FormAttachment(100, 0);
fdCancel.bottom = new FormAttachment(100, 0);
wCancel.setLayoutData(fdCancel);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
FormData fdOk = new FormData();
fdOk.right = new FormAttachment(wCancel, -5);
fdOk.bottom = new FormAttachment(100, 0);
wOK.setLayoutData(fdOk);
Label hSpacer = new Label(shell, SWT.HORIZONTAL | SWT.SEPARATOR);
FormData fdhSpacer = new FormData();
fdhSpacer.left = new FormAttachment(0, 0);
fdhSpacer.bottom = new FormAttachment(wCancel, -15);
fdhSpacer.right = new FormAttachment(100, 0);
hSpacer.setLayoutData(fdhSpacer);
FormData fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wPath, 20);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(hSpacer, -15);
wTabFolder.setLayoutData(fdTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wPath.addSelectionListener(lsDef);
}
Aggregations