use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class SalesforceInputDialog method open.
@Override
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN);
props.setLook(shell);
setShellImage(shell, input);
ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
input.setChanged();
}
};
SelectionListener checkBoxModifyListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
input.setChanged();
}
};
changed = input.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.DialogTitle"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
wlStepname = new Label(shell, SWT.RIGHT);
wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
props.setLook(wlStepname);
fdlStepname = new FormData();
fdlStepname.left = new FormAttachment(0, 0);
fdlStepname.top = new FormAttachment(0, margin);
fdlStepname.right = new FormAttachment(middle, -margin);
wlStepname.setLayoutData(fdlStepname);
wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wStepname.setText(stepname);
props.setLook(wStepname);
wStepname.addModifyListener(lsMod);
fdStepname = new FormData();
fdStepname.left = new FormAttachment(middle, 0);
fdStepname.top = new FormAttachment(0, margin);
fdStepname.right = new FormAttachment(100, 0);
wStepname.setLayoutData(fdStepname);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF FILE TAB ///
// ////////////////////////
wFileTab = new CTabItem(wTabFolder, SWT.NONE);
wFileTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.File.Tab"));
wFileComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wFileComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wFileComp.setLayout(fileLayout);
// ////////////////////////
// START CONNECTION GROUP
wConnectionGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
wConnectionGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ConnectionGroup.Label"));
FormLayout fconnLayout = new FormLayout();
fconnLayout.marginWidth = 3;
fconnLayout.marginHeight = 3;
wConnectionGroup.setLayout(fconnLayout);
props.setLook(wConnectionGroup);
// Webservice URL
wURL = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.URL.Tooltip"));
props.setLook(wURL);
wURL.addModifyListener(lsMod);
fdURL = new FormData();
fdURL.left = new FormAttachment(0, 0);
fdURL.top = new FormAttachment(0, margin);
fdURL.right = new FormAttachment(100, 0);
wURL.setLayoutData(fdURL);
// UserName line
wUserName = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.User.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.User.Tooltip"));
props.setLook(wUserName);
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(0, 0);
fdUserName.top = new FormAttachment(wURL, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wPassword = new LabelTextVar(transMeta, wConnectionGroup, BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Label"), BaseMessages.getString(PKG, "SalesforceInputDialog.Password.Tooltip"), true);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(0, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// Test Salesforce connection button
wTest = new Button(wConnectionGroup, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wPassword, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
FormData fdConnectionGroup = new FormData();
fdConnectionGroup.left = new FormAttachment(0, 0);
fdConnectionGroup.right = new FormAttachment(100, 0);
fdConnectionGroup.top = new FormAttachment(0, margin);
wConnectionGroup.setLayoutData(fdConnectionGroup);
// END CONNECTION GROUP
// ////////////////////////
// ////////////////////////
// START SETTINGS GROUP
wSettingsGroup = new Group(wFileComp, SWT.SHADOW_ETCHED_IN);
wSettingsGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.HttpAuthGroup.Label"));
FormLayout fsettingsLayout = new FormLayout();
fsettingsLayout.marginWidth = 3;
fsettingsLayout.marginHeight = 3;
wSettingsGroup.setLayout(fsettingsLayout);
props.setLook(wSettingsGroup);
wlspecifyQuery = new Label(wSettingsGroup, SWT.RIGHT);
wlspecifyQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Label"));
props.setLook(wlspecifyQuery);
fdlspecifyQuery = new FormData();
fdlspecifyQuery.left = new FormAttachment(0, 0);
fdlspecifyQuery.top = new FormAttachment(wConnectionGroup, 2 * margin);
fdlspecifyQuery.right = new FormAttachment(middle, -margin);
wlspecifyQuery.setLayoutData(fdlspecifyQuery);
wspecifyQuery = new Button(wSettingsGroup, SWT.CHECK);
props.setLook(wspecifyQuery);
wspecifyQuery.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.specifyQuery.Tooltip"));
fdspecifyQuery = new FormData();
fdspecifyQuery.left = new FormAttachment(middle, 0);
fdspecifyQuery.top = new FormAttachment(wConnectionGroup, 2 * margin);
wspecifyQuery.setLayoutData(fdspecifyQuery);
wspecifyQuery.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableQuery();
input.setChanged();
}
});
// Module
wlModule = new Label(wSettingsGroup, SWT.RIGHT);
wlModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Module.Label"));
props.setLook(wlModule);
fdlModule = new FormData();
fdlModule.left = new FormAttachment(0, 0);
fdlModule.top = new FormAttachment(wspecifyQuery, margin);
fdlModule.right = new FormAttachment(middle, -margin);
wlModule.setLayoutData(fdlModule);
wModule = new ComboVar(transMeta, wSettingsGroup, SWT.BORDER | SWT.READ_ONLY);
wModule.setEditable(true);
props.setLook(wModule);
wModule.addModifyListener(lsMod);
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, margin);
fdModule.top = new FormAttachment(wspecifyQuery, margin);
fdModule.right = new FormAttachment(100, -margin);
wModule.setLayoutData(fdModule);
wModule.addFocusListener(new FocusListener() {
@Override
public void focusLost(org.eclipse.swt.events.FocusEvent e) {
getModulesListError = false;
}
@Override
public void focusGained(org.eclipse.swt.events.FocusEvent e) {
// check if the URL and login credentials passed and not just had error
if (Utils.isEmpty(wURL.getText()) || Utils.isEmpty(wUserName.getText()) || Utils.isEmpty(wPassword.getText()) || (getModulesListError)) {
return;
}
getModulesList();
}
});
wlPosition = new Label(wSettingsGroup, SWT.NONE);
props.setLook(wlPosition);
fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(middle, 0);
fdlPosition.right = new FormAttachment(100, 0);
fdlPosition.bottom = new FormAttachment(100, -margin);
wlPosition.setLayoutData(fdlPosition);
// condition
wlCondition = new Label(wSettingsGroup, SWT.RIGHT);
wlCondition.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Label"));
props.setLook(wlCondition);
FormData fdlCondition = new FormData();
fdlCondition.left = new FormAttachment(0, -margin);
fdlCondition.top = new FormAttachment(wModule, margin);
fdlCondition.right = new FormAttachment(middle, -margin);
wlCondition.setLayoutData(fdlCondition);
wCondition = new StyledTextComp(transMeta, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wCondition.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.Condition.Tooltip"));
props.setLook(wCondition, Props.WIDGET_STYLE_FIXED);
wCondition.addModifyListener(lsMod);
fdCondition = new FormData();
fdCondition.left = new FormAttachment(middle, margin);
fdCondition.top = new FormAttachment(wModule, margin);
fdCondition.right = new FormAttachment(100, -2 * margin);
fdCondition.bottom = new FormAttachment(wlPosition, -margin);
wCondition.setLayoutData(fdCondition);
wCondition.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
setQueryToolTip();
setPosition();
}
});
wCondition.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wCondition.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
wCondition.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// Text Higlighting
wCondition.addLineStyleListener(new SOQLValuesHighlight());
// Query
wlQuery = new Label(wSettingsGroup, SWT.RIGHT);
wlQuery.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Query.Label"));
props.setLook(wlQuery);
fdlQuery = new FormData();
fdlQuery.left = new FormAttachment(0, -margin);
fdlQuery.top = new FormAttachment(wspecifyQuery, margin);
fdlQuery.right = new FormAttachment(middle, -margin);
wlQuery.setLayoutData(fdlQuery);
wQuery = new StyledTextComp(transMeta, wSettingsGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wQuery, Props.WIDGET_STYLE_FIXED);
wQuery.addModifyListener(lsMod);
fdQuery = new FormData();
fdQuery.left = new FormAttachment(middle, 0);
fdQuery.top = new FormAttachment(wspecifyQuery, margin);
fdQuery.right = new FormAttachment(100, -2 * margin);
fdQuery.bottom = new FormAttachment(wlPosition, -margin);
wQuery.setLayoutData(fdQuery);
wQuery.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent arg0) {
setQueryToolTip();
}
});
wQuery.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wQuery.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
wQuery.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// Text Higlighting
wQuery.addLineStyleListener(new SOQLValuesHighlight());
FormData fdSettingsGroup = new FormData();
fdSettingsGroup.left = new FormAttachment(0, 0);
fdSettingsGroup.right = new FormAttachment(100, 0);
fdSettingsGroup.bottom = new FormAttachment(100, 0);
fdSettingsGroup.top = new FormAttachment(wConnectionGroup, margin);
wSettingsGroup.setLayoutData(fdSettingsGroup);
// END SETTINGS GROUP
// ////////////////////////
fdFileComp = new FormData();
fdFileComp.left = new FormAttachment(0, 0);
fdFileComp.top = new FormAttachment(0, 0);
fdFileComp.right = new FormAttachment(100, 0);
fdFileComp.bottom = new FormAttachment(100, 0);
wFileComp.setLayoutData(fdFileComp);
wFileComp.layout();
wFileTab.setControl(wFileComp);
// ///////////////////////////////////////////////////////////
// / END OF FILE TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT TAB///
// /
wContentTab = new CTabItem(wTabFolder, SWT.NONE);
wContentTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Content.Tab"));
FormLayout contentLayout = new FormLayout();
contentLayout.marginWidth = 3;
contentLayout.marginHeight = 3;
wContentComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wContentComp);
wContentComp.setLayout(contentLayout);
// ///////////////////////////////
// START OF Advanced GROUP //
// ///////////////////////////////
wAdvancedGroup = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedGroup);
wAdvancedGroup.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.AdvancedGroup.Label"));
FormLayout advancedgroupLayout = new FormLayout();
advancedgroupLayout.marginWidth = 10;
advancedgroupLayout.marginHeight = 10;
wAdvancedGroup.setLayout(advancedgroupLayout);
// RecordsFilter
wlRecordsFilter = new Label(wAdvancedGroup, SWT.RIGHT);
wlRecordsFilter.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.RecordsFilter.Label"));
props.setLook(wlRecordsFilter);
fdlRecordsFilter = new FormData();
fdlRecordsFilter.left = new FormAttachment(0, 0);
fdlRecordsFilter.right = new FormAttachment(middle, -margin);
fdlRecordsFilter.top = new FormAttachment(0, 2 * margin);
wlRecordsFilter.setLayoutData(fdlRecordsFilter);
wRecordsFilter = new CCombo(wAdvancedGroup, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wRecordsFilter);
wRecordsFilter.addModifyListener(lsMod);
fdRecordsFilter = new FormData();
fdRecordsFilter.left = new FormAttachment(middle, 0);
fdRecordsFilter.top = new FormAttachment(0, 2 * margin);
fdRecordsFilter.right = new FormAttachment(100, -margin);
wRecordsFilter.setLayoutData(fdRecordsFilter);
wRecordsFilter.setItems(SalesforceConnectionUtils.recordsFilterDesc);
wRecordsFilter.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateRecordsFilter();
}
});
// Query All?
wlQueryAll = new Label(wAdvancedGroup, SWT.RIGHT);
wlQueryAll.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Label"));
props.setLook(wlQueryAll);
FormData fdlQueryAll = new FormData();
fdlQueryAll.left = new FormAttachment(0, 0);
fdlQueryAll.top = new FormAttachment(wRecordsFilter, margin);
fdlQueryAll.right = new FormAttachment(middle, -margin);
wlQueryAll.setLayoutData(fdlQueryAll);
wQueryAll = new Button(wAdvancedGroup, SWT.CHECK);
wQueryAll.addSelectionListener(checkBoxModifyListener);
props.setLook(wQueryAll);
wQueryAll.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.QueryAll.Tooltip"));
FormData fdQueryAll = new FormData();
fdQueryAll.left = new FormAttachment(middle, 0);
fdQueryAll.top = new FormAttachment(wRecordsFilter, margin);
wQueryAll.setLayoutData(fdQueryAll);
wQueryAll.addSelectionListener(new ComponentSelectionListener(input));
open = new Button(wAdvancedGroup, SWT.PUSH);
open.setImage(GUIResource.getInstance().getImageCalendar());
open.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
FormData fdlButton = new FormData();
fdlButton.top = new FormAttachment(wQueryAll, margin);
fdlButton.right = new FormAttachment(100, 0);
open.setLayoutData(fdlButton);
open.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
dialog.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
dialog.setImage(GUIResource.getInstance().getImageSpoon());
dialog.setLayout(new GridLayout(3, false));
final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
new Label(dialog, SWT.NONE);
new Label(dialog, SWT.NONE);
Button ok = new Button(dialog, SWT.PUSH);
ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
ok.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wReadFrom.setText(calendar.getYear() + "-" + ((calendar.getMonth() + 1) < 10 ? "0" + (calendar.getMonth() + 1) : (calendar.getMonth() + 1)) + "-" + (calendar.getDay() < 10 ? "0" + calendar.getDay() : calendar.getDay()) + " " + (time.getHours() < 10 ? "0" + time.getHours() : time.getHours()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()) + ":" + (time.getMinutes() < 10 ? "0" + time.getMinutes() : time.getMinutes()));
dialog.close();
}
});
dialog.setDefaultButton(ok);
dialog.pack();
dialog.open();
}
});
wlReadFrom = new Label(wAdvancedGroup, SWT.RIGHT);
wlReadFrom.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Label"));
props.setLook(wlReadFrom);
fdlReadFrom = new FormData();
fdlReadFrom.left = new FormAttachment(0, 0);
fdlReadFrom.top = new FormAttachment(wQueryAll, margin);
fdlReadFrom.right = new FormAttachment(middle, -margin);
wlReadFrom.setLayoutData(fdlReadFrom);
wReadFrom = new TextVar(transMeta, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadFrom.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadFrom.Tooltip"));
props.setLook(wReadFrom);
wReadFrom.addModifyListener(lsMod);
fdReadFrom = new FormData();
fdReadFrom.left = new FormAttachment(middle, 0);
fdReadFrom.top = new FormAttachment(wQueryAll, margin);
fdReadFrom.right = new FormAttachment(open, -margin);
wReadFrom.setLayoutData(fdReadFrom);
opento = new Button(wAdvancedGroup, SWT.PUSH);
opento.setImage(GUIResource.getInstance().getImageCalendar());
opento.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.OpenCalendar"));
FormData fdlButtonto = new FormData();
fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
fdlButtonto.right = new FormAttachment(100, 0);
opento.setLayoutData(fdlButtonto);
opento.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
dialogto.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.SelectDate"));
dialogto.setImage(GUIResource.getInstance().getImageSpoon());
dialogto.setLayout(new GridLayout(3, false));
final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
new Label(dialogto, SWT.NONE);
new Label(dialogto, SWT.NONE);
Button okto = new Button(dialogto, SWT.PUSH);
okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
okto.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
wReadTo.setText(calendarto.getYear() + "-" + ((calendarto.getMonth() + 1) < 10 ? "0" + (calendarto.getMonth() + 1) : (calendarto.getMonth() + 1)) + "-" + (calendarto.getDay() < 10 ? "0" + calendarto.getDay() : calendarto.getDay()) + " " + (timeto.getHours() < 10 ? "0" + timeto.getHours() : timeto.getHours()) + ":" + (timeto.getMinutes() < 10 ? "0" + timeto.getMinutes() : timeto.getMinutes()) + ":" + (timeto.getSeconds() < 10 ? "0" + timeto.getSeconds() : timeto.getSeconds()));
dialogto.close();
}
});
dialogto.setDefaultButton(okto);
dialogto.pack();
dialogto.open();
}
});
wlReadTo = new Label(wAdvancedGroup, SWT.RIGHT);
wlReadTo.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Label"));
props.setLook(wlReadTo);
fdlReadTo = new FormData();
fdlReadTo.left = new FormAttachment(0, 0);
fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdlReadTo.right = new FormAttachment(middle, -margin);
wlReadTo.setLayoutData(fdlReadTo);
wReadTo = new TextVar(transMeta, wAdvancedGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadTo.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.ReadTo.Tooltip"));
props.setLook(wReadTo);
wReadTo.addModifyListener(lsMod);
fdReadTo = new FormData();
fdReadTo.left = new FormAttachment(middle, 0);
fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdReadTo.right = new FormAttachment(opento, -margin);
wReadTo.setLayoutData(fdReadTo);
fdAdvancedGroup = new FormData();
fdAdvancedGroup.left = new FormAttachment(0, margin);
fdAdvancedGroup.top = new FormAttachment(0, 2 * margin);
fdAdvancedGroup.right = new FormAttachment(100, -margin);
wAdvancedGroup.setLayoutData(fdAdvancedGroup);
// ///////////////////////////////////////////////////////////
// / END OF Advanced GROUP
// ///////////////////////////////////////////////////////////
// ///////////////////////////////
// START OF Additional Fields GROUP //
// ///////////////////////////////
wAdditionalFields = new Group(wContentComp, SWT.SHADOW_NONE);
props.setLook(wAdditionalFields);
wAdditionalFields.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.wAdditionalFields.Label"));
FormLayout AdditionalFieldsgroupLayout = new FormLayout();
AdditionalFieldsgroupLayout.marginWidth = 10;
AdditionalFieldsgroupLayout.marginHeight = 10;
wAdditionalFields.setLayout(AdditionalFieldsgroupLayout);
// Add Salesforce URL in the output stream ?
wlInclURL = new Label(wAdditionalFields, SWT.RIGHT);
wlInclURL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Label"));
props.setLook(wlInclURL);
fdlInclURL = new FormData();
fdlInclURL.left = new FormAttachment(0, 0);
fdlInclURL.top = new FormAttachment(wAdvancedGroup, margin);
fdlInclURL.right = new FormAttachment(middle, -margin);
wlInclURL.setLayoutData(fdlInclURL);
wInclURL = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclURL);
wInclURL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURL.Tooltip"));
fdInclURL = new FormData();
fdInclURL.left = new FormAttachment(middle, 0);
fdInclURL.top = new FormAttachment(wAdvancedGroup, margin);
wInclURL.setLayoutData(fdInclURL);
wInclURL.addSelectionListener(checkBoxModifyListener);
wInclURL.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclTargetURL();
input.setChanged();
}
});
wlInclURLField = new Label(wAdditionalFields, SWT.LEFT);
wlInclURLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclURLField.Label"));
props.setLook(wlInclURLField);
fdlInclURLField = new FormData();
fdlInclURLField.left = new FormAttachment(wInclURL, margin);
fdlInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
wlInclURLField.setLayoutData(fdlInclURLField);
wInclURLField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclURLField);
wInclURLField.addModifyListener(lsMod);
fdInclURLField = new FormData();
fdInclURLField.left = new FormAttachment(wlInclURLField, margin);
fdInclURLField.top = new FormAttachment(wAdvancedGroup, margin);
fdInclURLField.right = new FormAttachment(100, 0);
wInclURLField.setLayoutData(fdInclURLField);
// Add module in the output stream ?
wlInclModule = new Label(wAdditionalFields, SWT.RIGHT);
wlInclModule.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Label"));
props.setLook(wlInclModule);
fdlInclModule = new FormData();
fdlInclModule.left = new FormAttachment(0, 0);
fdlInclModule.top = new FormAttachment(wInclURLField, margin);
fdlInclModule.right = new FormAttachment(middle, -margin);
wlInclModule.setLayoutData(fdlInclModule);
wInclModule = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclModule);
wInclModule.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModule.Tooltip"));
fdModule = new FormData();
fdModule.left = new FormAttachment(middle, 0);
fdModule.top = new FormAttachment(wInclURLField, margin);
wInclModule.setLayoutData(fdModule);
wInclModule.addSelectionListener(checkBoxModifyListener);
wInclModule.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclModule();
input.setChanged();
}
});
wlInclModuleField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclModuleField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclModuleField.Label"));
props.setLook(wlInclModuleField);
fdlInclModuleField = new FormData();
fdlInclModuleField.left = new FormAttachment(wInclModule, margin);
fdlInclModuleField.top = new FormAttachment(wInclURLField, margin);
wlInclModuleField.setLayoutData(fdlInclModuleField);
wInclModuleField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclModuleField);
wInclModuleField.addModifyListener(lsMod);
fdInclModuleField = new FormData();
fdInclModuleField.left = new FormAttachment(wlInclModuleField, margin);
fdInclModuleField.top = new FormAttachment(wInclURLField, margin);
fdInclModuleField.right = new FormAttachment(100, 0);
wInclModuleField.setLayoutData(fdInclModuleField);
// Add SQL in the output stream ?
wlInclSQL = new Label(wAdditionalFields, SWT.RIGHT);
wlInclSQL.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Label"));
props.setLook(wlInclSQL);
fdlInclSQL = new FormData();
fdlInclSQL.left = new FormAttachment(0, 0);
fdlInclSQL.top = new FormAttachment(wInclModuleField, margin);
fdlInclSQL.right = new FormAttachment(middle, -margin);
wlInclSQL.setLayoutData(fdlInclSQL);
wInclSQL = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclSQL);
wInclSQL.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQL.Tooltip"));
fdInclSQL = new FormData();
fdInclSQL.left = new FormAttachment(middle, 0);
fdInclSQL.top = new FormAttachment(wInclModuleField, margin);
wInclSQL.setLayoutData(fdInclSQL);
wInclSQL.addSelectionListener(checkBoxModifyListener);
wInclSQL.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclSQL();
input.setChanged();
}
});
wlInclSQLField = new Label(wAdditionalFields, SWT.LEFT);
wlInclSQLField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclSQLField.Label"));
props.setLook(wlInclSQLField);
fdlInclSQLField = new FormData();
fdlInclSQLField.left = new FormAttachment(wInclSQL, margin);
fdlInclSQLField.top = new FormAttachment(wInclModuleField, margin);
wlInclSQLField.setLayoutData(fdlInclSQLField);
wInclSQLField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclSQLField);
wInclSQLField.addModifyListener(lsMod);
fdInclSQLField = new FormData();
fdInclSQLField.left = new FormAttachment(wlInclSQLField, margin);
fdInclSQLField.top = new FormAttachment(wInclModuleField, margin);
fdInclSQLField.right = new FormAttachment(100, 0);
wInclSQLField.setLayoutData(fdInclSQLField);
// Add Timestamp in the output stream ?
wlInclTimestamp = new Label(wAdditionalFields, SWT.RIGHT);
wlInclTimestamp.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Label"));
props.setLook(wlInclTimestamp);
fdlInclTimestamp = new FormData();
fdlInclTimestamp.left = new FormAttachment(0, 0);
fdlInclTimestamp.top = new FormAttachment(wInclSQLField, margin);
fdlInclTimestamp.right = new FormAttachment(middle, -margin);
wlInclTimestamp.setLayoutData(fdlInclTimestamp);
wInclTimestamp = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclTimestamp);
wInclTimestamp.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestamp.Tooltip"));
fdInclTimestamp = new FormData();
fdInclTimestamp.left = new FormAttachment(middle, 0);
fdInclTimestamp.top = new FormAttachment(wInclSQLField, margin);
wInclTimestamp.setLayoutData(fdInclTimestamp);
wInclTimestamp.addSelectionListener(checkBoxModifyListener);
wInclTimestamp.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclTimestamp();
input.setChanged();
}
});
wlInclTimestampField = new Label(wAdditionalFields, SWT.LEFT);
wlInclTimestampField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclTimestampField.Label"));
props.setLook(wlInclTimestampField);
fdlInclTimestampField = new FormData();
fdlInclTimestampField.left = new FormAttachment(wInclTimestamp, margin);
fdlInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
wlInclTimestampField.setLayoutData(fdlInclTimestampField);
wInclTimestampField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wlInclTimestampField);
wInclTimestampField.addModifyListener(lsMod);
fdInclTimestampField = new FormData();
fdInclTimestampField.left = new FormAttachment(wlInclTimestampField, margin);
fdInclTimestampField.top = new FormAttachment(wInclSQLField, margin);
fdInclTimestampField.right = new FormAttachment(100, 0);
wInclTimestampField.setLayoutData(fdInclTimestampField);
// Include Rownum in output stream?
wlInclRownum = new Label(wAdditionalFields, SWT.RIGHT);
wlInclRownum.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownum.Label"));
props.setLook(wlInclRownum);
FormData fdlInclRownum = new FormData();
fdlInclRownum.left = new FormAttachment(0, 0);
fdlInclRownum.top = new FormAttachment(wInclTimestampField, margin);
fdlInclRownum.right = new FormAttachment(middle, -margin);
wlInclRownum.setLayoutData(fdlInclRownum);
wInclRownum = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclRownum);
wInclRownum.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownum.Tooltip"));
FormData fdRownum = new FormData();
fdRownum.left = new FormAttachment(middle, 0);
fdRownum.top = new FormAttachment(wInclTimestampField, margin);
wInclRownum.setLayoutData(fdRownum);
wInclRownum.addSelectionListener(checkBoxModifyListener);
wInclRownum.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclRownum();
input.setChanged();
}
});
wlInclRownumField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclRownumField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclRownumField.Label"));
props.setLook(wlInclRownumField);
fdlInclRownumField = new FormData();
fdlInclRownumField.left = new FormAttachment(wInclRownum, margin);
fdlInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
wlInclRownumField.setLayoutData(fdlInclRownumField);
wInclRownumField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclRownumField);
wInclRownumField.addModifyListener(lsMod);
FormData fdInclRownumField = new FormData();
fdInclRownumField.left = new FormAttachment(wlInclRownumField, margin);
fdInclRownumField.top = new FormAttachment(wInclTimestampField, margin);
fdInclRownumField.right = new FormAttachment(100, 0);
wInclRownumField.setLayoutData(fdInclRownumField);
// Include DeletionDate in output stream?
wlInclDeletionDate = new Label(wAdditionalFields, SWT.RIGHT);
wlInclDeletionDate.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Label"));
props.setLook(wlInclDeletionDate);
fdlInclDeletionDate = new FormData();
fdlInclDeletionDate.left = new FormAttachment(0, 0);
fdlInclDeletionDate.top = new FormAttachment(wInclRownumField, margin);
fdlInclDeletionDate.right = new FormAttachment(middle, -margin);
wlInclDeletionDate.setLayoutData(fdlInclDeletionDate);
wInclDeletionDate = new Button(wAdditionalFields, SWT.CHECK);
props.setLook(wInclDeletionDate);
wInclDeletionDate.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDate.Tooltip"));
fdDeletionDate = new FormData();
fdDeletionDate.left = new FormAttachment(middle, 0);
fdDeletionDate.top = new FormAttachment(wInclRownumField, margin);
wInclDeletionDate.setLayoutData(fdDeletionDate);
wInclDeletionDate.addSelectionListener(checkBoxModifyListener);
wInclDeletionDate.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setEnableInclDeletionDate();
input.setChanged();
}
});
wlInclDeletionDateField = new Label(wAdditionalFields, SWT.RIGHT);
wlInclDeletionDateField.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.InclDeletionDateField.Label"));
props.setLook(wlInclDeletionDateField);
fdlInclDeletionDateField = new FormData();
fdlInclDeletionDateField.left = new FormAttachment(wInclDeletionDate, margin);
fdlInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
wlInclDeletionDateField.setLayoutData(fdlInclDeletionDateField);
wInclDeletionDateField = new TextVar(transMeta, wAdditionalFields, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wInclDeletionDateField);
wInclDeletionDateField.addModifyListener(lsMod);
fdInclDeletionDateField = new FormData();
fdInclDeletionDateField.left = new FormAttachment(wlInclDeletionDateField, margin);
fdInclDeletionDateField.top = new FormAttachment(wInclRownumField, margin);
fdInclDeletionDateField.right = new FormAttachment(100, 0);
wInclDeletionDateField.setLayoutData(fdInclDeletionDateField);
fdAdditionalFields = new FormData();
fdAdditionalFields.left = new FormAttachment(0, margin);
fdAdditionalFields.top = new FormAttachment(wAdvancedGroup, margin);
fdAdditionalFields.right = new FormAttachment(100, -margin);
wAdditionalFields.setLayoutData(fdAdditionalFields);
// ///////////////////////////////////////////////////////////
// / END OF Additional Fields GROUP
// ///////////////////////////////////////////////////////////
// Timeout
wlTimeOut = new Label(wContentComp, SWT.RIGHT);
wlTimeOut.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.TimeOut.Label"));
props.setLook(wlTimeOut);
fdlTimeOut = new FormData();
fdlTimeOut.left = new FormAttachment(0, 0);
fdlTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
fdlTimeOut.right = new FormAttachment(middle, -margin);
wlTimeOut.setLayoutData(fdlTimeOut);
wTimeOut = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wTimeOut);
wTimeOut.addModifyListener(lsMod);
fdTimeOut = new FormData();
fdTimeOut.left = new FormAttachment(middle, 0);
fdTimeOut.top = new FormAttachment(wAdditionalFields, 2 * margin);
fdTimeOut.right = new FormAttachment(100, 0);
wTimeOut.setLayoutData(fdTimeOut);
// Use compression?
wlUseCompression = new Label(wContentComp, SWT.RIGHT);
wlUseCompression.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Label"));
props.setLook(wlUseCompression);
FormData fdlUseCompression = new FormData();
fdlUseCompression.left = new FormAttachment(0, 0);
fdlUseCompression.top = new FormAttachment(wTimeOut, margin);
fdlUseCompression.right = new FormAttachment(middle, -margin);
wlUseCompression.setLayoutData(fdlUseCompression);
wUseCompression = new Button(wContentComp, SWT.CHECK);
wUseCompression.addSelectionListener(checkBoxModifyListener);
props.setLook(wUseCompression);
wUseCompression.setToolTipText(BaseMessages.getString(PKG, "SalesforceInputDialog.UseCompression.Tooltip"));
FormData fdUseCompression = new FormData();
fdUseCompression.left = new FormAttachment(middle, 0);
fdUseCompression.top = new FormAttachment(wTimeOut, margin);
wUseCompression.setLayoutData(fdUseCompression);
wUseCompression.addSelectionListener(new ComponentSelectionListener(input));
// Limit rows
wlLimit = new Label(wContentComp, SWT.RIGHT);
wlLimit.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Limit.Label"));
props.setLook(wlLimit);
fdlLimit = new FormData();
fdlLimit.left = new FormAttachment(0, 0);
fdlLimit.top = new FormAttachment(wUseCompression, margin);
fdlLimit.right = new FormAttachment(middle, -margin);
wlLimit.setLayoutData(fdlLimit);
wLimit = new TextVar(transMeta, wContentComp, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wLimit);
wLimit.addModifyListener(lsMod);
fdLimit = new FormData();
fdLimit.left = new FormAttachment(middle, 0);
fdLimit.top = new FormAttachment(wUseCompression, margin);
fdLimit.right = new FormAttachment(100, 0);
wLimit.setLayoutData(fdLimit);
fdContentComp = new FormData();
fdContentComp.left = new FormAttachment(0, 0);
fdContentComp.top = new FormAttachment(0, 0);
fdContentComp.right = new FormAttachment(100, 0);
fdContentComp.bottom = new FormAttachment(100, 0);
wContentComp.setLayoutData(fdContentComp);
wContentComp.layout();
wContentTab.setControl(wContentComp);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT TAB
// ///////////////////////////////////////////////////////////
// Fields tab...
//
wFieldsTab = new CTabItem(wTabFolder, SWT.NONE);
wFieldsTab.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Fields.Tab"));
FormLayout fieldsLayout = new FormLayout();
fieldsLayout.marginWidth = Const.FORM_MARGIN;
fieldsLayout.marginHeight = Const.FORM_MARGIN;
wFieldsComp = new Composite(wTabFolder, SWT.NONE);
wFieldsComp.setLayout(fieldsLayout);
props.setLook(wFieldsComp);
wGet = new Button(wFieldsComp, SWT.PUSH);
wGet.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.GetFields.Button"));
fdGet = new FormData();
fdGet.left = new FormAttachment(50, 0);
fdGet.bottom = new FormAttachment(100, 0);
wGet.setLayoutData(fdGet);
final int FieldsRows = input.getInputFields().length;
colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { "" }, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.IsIdLookup.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Type.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames(), true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Format.Column"), ColumnInfo.COLUMN_TYPE_FORMAT, 3), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Length.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Precision.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Currency.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Decimal.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Group.Column"), ColumnInfo.COLUMN_TYPE_TEXT, false), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.TrimType.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, SalesforceInputField.trimTypeDesc, true), new ColumnInfo(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Repeat.Column"), ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] { BaseMessages.getString(PKG, "System.Combo.Yes"), BaseMessages.getString(PKG, "System.Combo.No") }, true) };
colinf[0].setUsingVariables(true);
colinf[0].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Name.Column.Tooltip"));
colinf[1].setUsingVariables(true);
colinf[1].setToolTip(BaseMessages.getString(PKG, "SalesforceInputDialog.FieldsTable.Field.Column.Tooltip"));
colinf[2].setReadOnly(true);
wFields = new TableView(transMeta, wFieldsComp, SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(0, 0);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(wGet, -margin);
wFields.setLayoutData(fdFields);
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);
wFieldsComp.setLayoutData(fdFieldsComp);
wFieldsComp.layout();
wFieldsTab.setControl(wFieldsComp);
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wStepname, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
// THE BUTTONS
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wPreview = new Button(shell, SWT.PUSH);
wPreview.setText(BaseMessages.getString(PKG, "SalesforceInputDialog.Button.PreviewRows"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, wTabFolder);
// Add listeners
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
@Override
public void handleEvent(Event e) {
test();
}
};
lsGet = new Listener() {
@Override
public void handleEvent(Event e) {
Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
shell.setCursor(busy);
get();
shell.setCursor(null);
busy.dispose();
input.setChanged();
}
};
lsPreview = new Listener() {
@Override
public void handleEvent(Event e) {
preview();
}
};
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wGet.addListener(SWT.Selection, lsGet);
wTest.addListener(SWT.Selection, lsTest);
wPreview.addListener(SWT.Selection, lsPreview);
wCancel.addListener(SWT.Selection, lsCancel);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wStepname.addSelectionListener(lsDef);
wLimit.addSelectionListener(lsDef);
wInclModuleField.addSelectionListener(lsDef);
wInclURLField.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
wTabFolder.setSelection(0);
// Set the shell size, based upon previous time...
setSize();
getData(input);
setEnableInclTargetURL();
setEnableInclSQL();
setEnableInclTimestamp();
setEnableInclModule();
setEnableInclRownum();
setEnableInclDeletionDate();
setEnableQuery();
input.setChanged(changed);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.eclipse.swt.events.SelectionListener in project pentaho-kettle by pentaho.
the class JobEntryGetPOPDialog 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) {
closeMailConnection();
jobEntry.setChanged();
}
};
SelectionListener lsSelection = new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
closeMailConnection();
}
};
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, "JobGetPOP.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobGetPOP.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);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobGetPOP.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wlServerName = new Label(wServerSettings, SWT.RIGHT);
wlServerName.setText(BaseMessages.getString(PKG, "JobGetPOP.Server.Label"));
props.setLook(wlServerName);
fdlServerName = new FormData();
fdlServerName.left = new FormAttachment(0, 0);
fdlServerName.top = new FormAttachment(0, 2 * margin);
fdlServerName.right = new FormAttachment(middle, -margin);
wlServerName.setLayoutData(fdlServerName);
wServerName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(middle, 0);
fdServerName.top = new FormAttachment(0, 2 * margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// USE connection with SSL
wlUseSSL = new Label(wServerSettings, SWT.RIGHT);
wlUseSSL.setText(BaseMessages.getString(PKG, "JobGetPOP.UseSSLMails.Label"));
props.setLook(wlUseSSL);
fdlUseSSL = new FormData();
fdlUseSSL.left = new FormAttachment(0, 0);
fdlUseSSL.top = new FormAttachment(wServerName, margin);
fdlUseSSL.right = new FormAttachment(middle, -margin);
wlUseSSL.setLayoutData(fdlUseSSL);
wUseSSL = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseSSL);
fdUseSSL = new FormData();
wUseSSL.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.UseSSLMails.Tooltip"));
fdUseSSL.left = new FormAttachment(middle, 0);
fdUseSSL.top = new FormAttachment(wServerName, margin);
fdUseSSL.right = new FormAttachment(100, 0);
wUseSSL.setLayoutData(fdUseSSL);
wUseSSL.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
closeMailConnection();
refreshPort(true);
}
});
// port
wlPort = new Label(wServerSettings, SWT.RIGHT);
wlPort.setText(BaseMessages.getString(PKG, "JobGetPOP.SSLPort.Label"));
props.setLook(wlPort);
fdlPort = new FormData();
fdlPort.left = new FormAttachment(0, 0);
fdlPort.top = new FormAttachment(wUseSSL, margin);
fdlPort.right = new FormAttachment(middle, -margin);
wlPort.setLayoutData(fdlPort);
wPort = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPort);
wPort.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SSLPort.Tooltip"));
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(middle, 0);
fdPort.top = new FormAttachment(wUseSSL, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// UserName line
wlUserName = new Label(wServerSettings, SWT.RIGHT);
wlUserName.setText(BaseMessages.getString(PKG, "JobGetPOP.Username.Label"));
props.setLook(wlUserName);
fdlUserName = new FormData();
fdlUserName.left = new FormAttachment(0, 0);
fdlUserName.top = new FormAttachment(wPort, margin);
fdlUserName.right = new FormAttachment(middle, -margin);
wlUserName.setLayoutData(fdlUserName);
wUserName = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wUserName);
wUserName.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.Username.Tooltip"));
wUserName.addModifyListener(lsMod);
fdUserName = new FormData();
fdUserName.left = new FormAttachment(middle, 0);
fdUserName.top = new FormAttachment(wPort, margin);
fdUserName.right = new FormAttachment(100, 0);
wUserName.setLayoutData(fdUserName);
// Password line
wlPassword = new Label(wServerSettings, SWT.RIGHT);
wlPassword.setText(BaseMessages.getString(PKG, "JobGetPOP.Password.Label"));
props.setLook(wlPassword);
fdlPassword = new FormData();
fdlPassword.left = new FormAttachment(0, 0);
fdlPassword.top = new FormAttachment(wUserName, margin);
fdlPassword.right = new FormAttachment(middle, -margin);
wlPassword.setLayoutData(fdlPassword);
wPassword = new PasswordTextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wPassword);
wPassword.addModifyListener(lsMod);
fdPassword = new FormData();
fdPassword.left = new FormAttachment(middle, 0);
fdPassword.top = new FormAttachment(wUserName, margin);
fdPassword.right = new FormAttachment(100, 0);
wPassword.setLayoutData(fdPassword);
// USE proxy
wlUseProxy = new Label(wServerSettings, SWT.RIGHT);
wlUseProxy.setText(BaseMessages.getString(PKG, "JobGetPOP.UseProxyMails.Label"));
props.setLook(wlUseProxy);
fdlUseProxy = new FormData();
fdlUseProxy.left = new FormAttachment(0, 0);
fdlUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdlUseProxy.right = new FormAttachment(middle, -margin);
wlUseProxy.setLayoutData(fdlUseProxy);
wUseProxy = new Button(wServerSettings, SWT.CHECK);
props.setLook(wUseProxy);
fdUseProxy = new FormData();
wUseProxy.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.UseProxyMails.Tooltip"));
fdUseProxy.left = new FormAttachment(middle, 0);
fdUseProxy.top = new FormAttachment(wPassword, 2 * margin);
fdUseProxy.right = new FormAttachment(100, 0);
wUseProxy.setLayoutData(fdUseProxy);
wUseProxy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setUserProxy();
jobEntry.setChanged();
}
});
// ProxyUsername line
wlProxyUsername = new Label(wServerSettings, SWT.RIGHT);
wlProxyUsername.setText(BaseMessages.getString(PKG, "JobGetPOP.ProxyUsername.Label"));
props.setLook(wlProxyUsername);
fdlProxyUsername = new FormData();
fdlProxyUsername.left = new FormAttachment(0, 0);
fdlProxyUsername.top = new FormAttachment(wUseProxy, margin);
fdlProxyUsername.right = new FormAttachment(middle, -margin);
wlProxyUsername.setLayoutData(fdlProxyUsername);
wProxyUsername = new TextVar(jobMeta, wServerSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wProxyUsername);
wProxyUsername.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ProxyUsername.Tooltip"));
wProxyUsername.addModifyListener(lsMod);
fdProxyUsername = new FormData();
fdProxyUsername.left = new FormAttachment(middle, 0);
fdProxyUsername.top = new FormAttachment(wUseProxy, margin);
fdProxyUsername.right = new FormAttachment(100, 0);
wProxyUsername.setLayoutData(fdProxyUsername);
// Protocol
wlProtocol = new Label(wServerSettings, SWT.RIGHT);
wlProtocol.setText(BaseMessages.getString(PKG, "JobGetPOP.Protocol.Label"));
props.setLook(wlProtocol);
fdlProtocol = new FormData();
fdlProtocol.left = new FormAttachment(0, 0);
fdlProtocol.right = new FormAttachment(middle, -margin);
fdlProtocol.top = new FormAttachment(wProxyUsername, margin);
wlProtocol.setLayoutData(fdlProtocol);
wProtocol = new CCombo(wServerSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wProtocol.setItems(MailConnectionMeta.protocolCodes);
wProtocol.select(0);
props.setLook(wProtocol);
fdProtocol = new FormData();
fdProtocol.left = new FormAttachment(middle, 0);
fdProtocol.top = new FormAttachment(wProxyUsername, margin);
fdProtocol.right = new FormAttachment(100, 0);
wProtocol.setLayoutData(fdProtocol);
wProtocol.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refreshProtocol(true);
}
});
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobGetPOP.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestConnection.Tooltip"));
// fdTest.left = new FormAttachment(middle, 0);
fdTest.top = new FormAttachment(wProtocol, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wProtocol, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Target Folder GROUP///
// /
wTargetFolder = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wTargetFolder);
wTargetFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TargetFolder.Group.Label"));
FormLayout TargetFoldergroupLayout = new FormLayout();
TargetFoldergroupLayout.marginWidth = 10;
TargetFoldergroupLayout.marginHeight = 10;
wTargetFolder.setLayout(TargetFoldergroupLayout);
// OutputDirectory line
wlOutputDirectory = new Label(wTargetFolder, SWT.RIGHT);
wlOutputDirectory.setText(BaseMessages.getString(PKG, "JobGetPOP.OutputDirectory.Label"));
props.setLook(wlOutputDirectory);
fdlOutputDirectory = new FormData();
fdlOutputDirectory.left = new FormAttachment(0, 0);
fdlOutputDirectory.top = new FormAttachment(wServerSettings, margin);
fdlOutputDirectory.right = new FormAttachment(middle, -margin);
wlOutputDirectory.setLayoutData(fdlOutputDirectory);
// Browse Source folders button ...
wbDirectory = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
props.setLook(wbDirectory);
wbDirectory.setText(BaseMessages.getString(PKG, "JobGetPOP.BrowseFolders.Label"));
fdbDirectory = new FormData();
fdbDirectory.right = new FormAttachment(100, -margin);
fdbDirectory.top = new FormAttachment(wServerSettings, margin);
wbDirectory.setLayoutData(fdbDirectory);
wbDirectory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wOutputDirectory.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wOutputDirectory.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wOutputDirectory.setText(dir);
}
}
});
wOutputDirectory = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wOutputDirectory);
wOutputDirectory.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OutputDirectory.Tooltip"));
wOutputDirectory.addModifyListener(lsMod);
fdOutputDirectory = new FormData();
fdOutputDirectory.left = new FormAttachment(middle, 0);
fdOutputDirectory.top = new FormAttachment(wServerSettings, margin);
fdOutputDirectory.right = new FormAttachment(wbDirectory, -margin);
wOutputDirectory.setLayoutData(fdOutputDirectory);
// Create local folder
wlcreateLocalFolder = new Label(wTargetFolder, SWT.RIGHT);
wlcreateLocalFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.createLocalFolder.Label"));
props.setLook(wlcreateLocalFolder);
fdlcreateLocalFolder = new FormData();
fdlcreateLocalFolder.left = new FormAttachment(0, 0);
fdlcreateLocalFolder.top = new FormAttachment(wOutputDirectory, margin);
fdlcreateLocalFolder.right = new FormAttachment(middle, -margin);
wlcreateLocalFolder.setLayoutData(fdlcreateLocalFolder);
wcreateLocalFolder = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wcreateLocalFolder);
fdcreateLocalFolder = new FormData();
wcreateLocalFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.createLocalFolder.Tooltip"));
fdcreateLocalFolder.left = new FormAttachment(middle, 0);
fdcreateLocalFolder.top = new FormAttachment(wOutputDirectory, margin);
fdcreateLocalFolder.right = new FormAttachment(100, 0);
wcreateLocalFolder.setLayoutData(fdcreateLocalFolder);
// Filename pattern line
wlFilenamePattern = new Label(wTargetFolder, SWT.RIGHT);
wlFilenamePattern.setText(BaseMessages.getString(PKG, "JobGetPOP.FilenamePattern.Label"));
props.setLook(wlFilenamePattern);
fdlFilenamePattern = new FormData();
fdlFilenamePattern.left = new FormAttachment(0, 0);
fdlFilenamePattern.top = new FormAttachment(wcreateLocalFolder, margin);
fdlFilenamePattern.right = new FormAttachment(middle, -margin);
wlFilenamePattern.setLayoutData(fdlFilenamePattern);
wFilenamePattern = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilenamePattern);
wFilenamePattern.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.FilenamePattern.Tooltip"));
wFilenamePattern.addModifyListener(lsMod);
fdFilenamePattern = new FormData();
fdFilenamePattern.left = new FormAttachment(middle, 0);
fdFilenamePattern.top = new FormAttachment(wcreateLocalFolder, margin);
fdFilenamePattern.right = new FormAttachment(100, 0);
wFilenamePattern.setLayoutData(fdFilenamePattern);
// Whenever something changes, set the tooltip to the expanded version:
wFilenamePattern.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilenamePattern.setToolTipText(jobMeta.environmentSubstitute(wFilenamePattern.getText()));
}
});
// Get message?
wlGetMessage = new Label(wTargetFolder, SWT.RIGHT);
wlGetMessage.setText(BaseMessages.getString(PKG, "JobGetPOP.GetMessageMails.Label"));
props.setLook(wlGetMessage);
fdlGetMessage = new FormData();
fdlGetMessage.left = new FormAttachment(0, 0);
fdlGetMessage.top = new FormAttachment(wFilenamePattern, margin);
fdlGetMessage.right = new FormAttachment(middle, -margin);
wlGetMessage.setLayoutData(fdlGetMessage);
wGetMessage = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wGetMessage);
fdGetMessage = new FormData();
wGetMessage.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.GetMessageMails.Tooltip"));
fdGetMessage.left = new FormAttachment(middle, 0);
fdGetMessage.top = new FormAttachment(wFilenamePattern, margin);
fdGetMessage.right = new FormAttachment(100, 0);
wGetMessage.setLayoutData(fdGetMessage);
wGetMessage.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!wGetAttachment.getSelection() && !wGetMessage.getSelection()) {
wGetAttachment.setSelection(true);
}
}
});
// Get attachment?
wlGetAttachment = new Label(wTargetFolder, SWT.RIGHT);
wlGetAttachment.setText(BaseMessages.getString(PKG, "JobGetPOP.GetAttachmentMails.Label"));
props.setLook(wlGetAttachment);
fdlGetAttachment = new FormData();
fdlGetAttachment.left = new FormAttachment(0, 0);
fdlGetAttachment.top = new FormAttachment(wGetMessage, margin);
fdlGetAttachment.right = new FormAttachment(middle, -margin);
wlGetAttachment.setLayoutData(fdlGetAttachment);
wGetAttachment = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wGetAttachment);
fdGetAttachment = new FormData();
wGetAttachment.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.GetAttachmentMails.Tooltip"));
fdGetAttachment.left = new FormAttachment(middle, 0);
fdGetAttachment.top = new FormAttachment(wGetMessage, margin);
fdGetAttachment.right = new FormAttachment(100, 0);
wGetAttachment.setLayoutData(fdGetAttachment);
wGetAttachment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAttachmentFolder();
}
});
// different folder for attachment?
wlDifferentFolderForAttachment = new Label(wTargetFolder, SWT.RIGHT);
wlDifferentFolderForAttachment.setText(BaseMessages.getString(PKG, "JobGetPOP.DifferentFolderForAttachmentMails.Label"));
props.setLook(wlDifferentFolderForAttachment);
fdlDifferentFolderForAttachment = new FormData();
fdlDifferentFolderForAttachment.left = new FormAttachment(0, 0);
fdlDifferentFolderForAttachment.top = new FormAttachment(wGetAttachment, margin);
fdlDifferentFolderForAttachment.right = new FormAttachment(middle, -margin);
wlDifferentFolderForAttachment.setLayoutData(fdlDifferentFolderForAttachment);
wDifferentFolderForAttachment = new Button(wTargetFolder, SWT.CHECK);
props.setLook(wDifferentFolderForAttachment);
fdDifferentFolderForAttachment = new FormData();
wDifferentFolderForAttachment.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.DifferentFolderForAttachmentMails.Tooltip"));
fdDifferentFolderForAttachment.left = new FormAttachment(middle, 0);
fdDifferentFolderForAttachment.top = new FormAttachment(wGetAttachment, margin);
fdDifferentFolderForAttachment.right = new FormAttachment(100, 0);
wDifferentFolderForAttachment.setLayoutData(fdDifferentFolderForAttachment);
wDifferentFolderForAttachment.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeAttachmentFolder();
}
});
// AttachmentFolder line
wlAttachmentFolder = new Label(wTargetFolder, SWT.RIGHT);
wlAttachmentFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentFolder.Label"));
props.setLook(wlAttachmentFolder);
fdlAttachmentFolder = new FormData();
fdlAttachmentFolder.left = new FormAttachment(0, 0);
fdlAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
fdlAttachmentFolder.right = new FormAttachment(middle, -margin);
wlAttachmentFolder.setLayoutData(fdlAttachmentFolder);
// Browse Source folders button ...
wbAttachmentFolder = new Button(wTargetFolder, SWT.PUSH | SWT.CENTER);
props.setLook(wbAttachmentFolder);
wbAttachmentFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.BrowseFolders.Label"));
fdbAttachmentFolder = new FormData();
fdbAttachmentFolder.right = new FormAttachment(100, -margin);
fdbAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
wbAttachmentFolder.setLayoutData(fdbAttachmentFolder);
wbAttachmentFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog ddialog = new DirectoryDialog(shell, SWT.OPEN);
if (wAttachmentFolder.getText() != null) {
ddialog.setFilterPath(jobMeta.environmentSubstitute(wAttachmentFolder.getText()));
}
// Calling open() will open and run the dialog.
// It will return the selected directory, or
// null if user cancels
String dir = ddialog.open();
if (dir != null) {
// Set the text box to the new selection
wAttachmentFolder.setText(dir);
}
}
});
wAttachmentFolder = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wAttachmentFolder);
wAttachmentFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentFolder.Tooltip"));
wAttachmentFolder.addModifyListener(lsMod);
fdAttachmentFolder = new FormData();
fdAttachmentFolder.left = new FormAttachment(middle, 0);
fdAttachmentFolder.top = new FormAttachment(wDifferentFolderForAttachment, margin);
fdAttachmentFolder.right = new FormAttachment(wbAttachmentFolder, -margin);
wAttachmentFolder.setLayoutData(fdAttachmentFolder);
// Limit attached files
wlAttachmentWildcard = new Label(wTargetFolder, SWT.RIGHT);
wlAttachmentWildcard.setText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentWildcard.Label"));
props.setLook(wlAttachmentWildcard);
fdlAttachmentWildcard = new FormData();
fdlAttachmentWildcard.left = new FormAttachment(0, 0);
fdlAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
fdlAttachmentWildcard.right = new FormAttachment(middle, -margin);
wlAttachmentWildcard.setLayoutData(fdlAttachmentWildcard);
wAttachmentWildcard = new TextVar(jobMeta, wTargetFolder, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wAttachmentWildcard);
wAttachmentWildcard.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.AttachmentWildcard.Tooltip"));
wAttachmentWildcard.addModifyListener(lsMod);
fdAttachmentWildcard = new FormData();
fdAttachmentWildcard.left = new FormAttachment(middle, 0);
fdAttachmentWildcard.top = new FormAttachment(wbAttachmentFolder, margin);
fdAttachmentWildcard.right = new FormAttachment(100, 0);
wAttachmentWildcard.setLayoutData(fdAttachmentWildcard);
// Whenever something changes, set the tooltip to the expanded version:
wAttachmentWildcard.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wAttachmentWildcard.setToolTipText(jobMeta.environmentSubstitute(wAttachmentWildcard.getText()));
}
});
fdTargetFolder = new FormData();
fdTargetFolder.left = new FormAttachment(0, margin);
fdTargetFolder.top = new FormAttachment(wServerSettings, margin);
fdTargetFolder.right = new FormAttachment(100, -margin);
wTargetFolder.setLayoutData(fdTargetFolder);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(wName, 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 SETTINGS TAB ///
// ////////////////////////
wSettingsTab = new CTabItem(wTabFolder, SWT.NONE);
wSettingsTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.Pop.Label"));
wSettingsComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSettingsComp);
FormLayout PopLayout = new FormLayout();
PopLayout.marginWidth = 3;
PopLayout.marginHeight = 3;
wSettingsComp.setLayout(PopLayout);
// Action type
wlActionType = new Label(wSettingsComp, SWT.RIGHT);
wlActionType.setText(BaseMessages.getString(PKG, "JobGetPOP.ActionType.Label"));
props.setLook(wlActionType);
fdlActionType = new FormData();
fdlActionType.left = new FormAttachment(0, 0);
fdlActionType.right = new FormAttachment(middle, -margin);
fdlActionType.top = new FormAttachment(0, 3 * margin);
wlActionType.setLayoutData(fdlActionType);
wActionType = new CCombo(wSettingsComp, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wActionType.setItems(MailConnectionMeta.actionTypeDesc);
// +1: starts at -1
wActionType.select(0);
props.setLook(wActionType);
fdActionType = new FormData();
fdActionType.left = new FormAttachment(middle, 0);
fdActionType.top = new FormAttachment(0, 3 * margin);
fdActionType.right = new FormAttachment(100, 0);
wActionType.setLayoutData(fdActionType);
wActionType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setActionType();
jobEntry.setChanged();
}
});
// Message: for POP3, only INBOX folder is available!
wlPOP3Message = new Label(wSettingsComp, SWT.RIGHT);
wlPOP3Message.setText(BaseMessages.getString(PKG, "JobGetPOP.POP3Message.Label"));
props.setLook(wlPOP3Message);
fdlPOP3Message = new FormData();
fdlPOP3Message.left = new FormAttachment(0, margin);
fdlPOP3Message.top = new FormAttachment(wActionType, 3 * margin);
wlPOP3Message.setLayoutData(fdlPOP3Message);
wlPOP3Message.setForeground(GUIResource.getInstance().getColorOrange());
// ////////////////////////
// START OF POP3 Settings GROUP///
// /
wPOP3Settings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wPOP3Settings);
wPOP3Settings.setText(BaseMessages.getString(PKG, "JobGetPOP.POP3Settings.Group.Label"));
FormLayout POP3SettingsgroupLayout = new FormLayout();
POP3SettingsgroupLayout.marginWidth = 10;
POP3SettingsgroupLayout.marginHeight = 10;
wPOP3Settings.setLayout(POP3SettingsgroupLayout);
// List of mails of retrieve
wlListmails = new Label(wPOP3Settings, SWT.RIGHT);
wlListmails.setText(BaseMessages.getString(PKG, "JobGetPOP.Listmails.Label"));
props.setLook(wlListmails);
fdlListmails = new FormData();
fdlListmails.left = new FormAttachment(0, 0);
fdlListmails.right = new FormAttachment(middle, 0);
fdlListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
wlListmails.setLayoutData(fdlListmails);
wListmails = new CCombo(wPOP3Settings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wListmails.add(BaseMessages.getString(PKG, "JobGetPOP.RetrieveAllMails.Label"));
// PDI-7241 POP3 does not support retrive unread
// wListmails.add( BaseMessages.getString( PKG, "JobGetPOP.RetrieveUnreadMails.Label" ) );
wListmails.add(BaseMessages.getString(PKG, "JobGetPOP.RetrieveFirstMails.Label"));
// +1: starts at -1
wListmails.select(0);
props.setLook(wListmails);
fdListmails = new FormData();
fdListmails.left = new FormAttachment(middle, 0);
fdListmails.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdListmails.right = new FormAttachment(100, 0);
wListmails.setLayoutData(fdListmails);
wListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
chooseListMails();
}
});
// Retrieve the first ... mails
wlFirstmails = new Label(wPOP3Settings, SWT.RIGHT);
wlFirstmails.setText(BaseMessages.getString(PKG, "JobGetPOP.Firstmails.Label"));
props.setLook(wlFirstmails);
fdlFirstmails = new FormData();
fdlFirstmails.left = new FormAttachment(0, 0);
fdlFirstmails.right = new FormAttachment(middle, -margin);
fdlFirstmails.top = new FormAttachment(wListmails, margin);
wlFirstmails.setLayoutData(fdlFirstmails);
wFirstmails = new TextVar(jobMeta, wPOP3Settings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFirstmails);
wFirstmails.addModifyListener(lsMod);
fdFirstmails = new FormData();
fdFirstmails.left = new FormAttachment(middle, 0);
fdFirstmails.top = new FormAttachment(wListmails, margin);
fdFirstmails.right = new FormAttachment(100, 0);
wFirstmails.setLayoutData(fdFirstmails);
// Delete mails after retrieval...
wlDelete = new Label(wPOP3Settings, SWT.RIGHT);
wlDelete.setText(BaseMessages.getString(PKG, "JobGetPOP.DeleteMails.Label"));
props.setLook(wlDelete);
fdlDelete = new FormData();
fdlDelete.left = new FormAttachment(0, 0);
fdlDelete.top = new FormAttachment(wFirstmails, margin);
fdlDelete.right = new FormAttachment(middle, -margin);
wlDelete.setLayoutData(fdlDelete);
wDelete = new Button(wPOP3Settings, SWT.CHECK);
props.setLook(wDelete);
fdDelete = new FormData();
wDelete.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.DeleteMails.Tooltip"));
fdDelete.left = new FormAttachment(middle, 0);
fdDelete.top = new FormAttachment(wFirstmails, margin);
fdDelete.right = new FormAttachment(100, 0);
wDelete.setLayoutData(fdDelete);
fdPOP3Settings = new FormData();
fdPOP3Settings.left = new FormAttachment(0, margin);
fdPOP3Settings.top = new FormAttachment(wlPOP3Message, 2 * margin);
fdPOP3Settings.right = new FormAttachment(100, -margin);
wPOP3Settings.setLayoutData(fdPOP3Settings);
// ///////////////////////////////////////////////////////////
// / END OF POP3 SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF IMAP Settings GROUP///
// /
wIMAPSettings = new Group(wSettingsComp, SWT.SHADOW_NONE);
props.setLook(wIMAPSettings);
wIMAPSettings.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPSettings.Groupp.Label"));
FormLayout IMAPSettingsgroupLayout = new FormLayout();
IMAPSettingsgroupLayout.marginWidth = 10;
IMAPSettingsgroupLayout.marginHeight = 10;
wIMAPSettings.setLayout(IMAPSettingsgroupLayout);
// SelectFolder button
wSelectFolder = new Button(wIMAPSettings, SWT.PUSH);
wSelectFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectFolderConnection.Label"));
props.setLook(wSelectFolder);
fdSelectFolder = new FormData();
wSelectFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SelectFolderConnection.Tooltip"));
fdSelectFolder.top = new FormAttachment(wPOP3Settings, margin);
fdSelectFolder.right = new FormAttachment(100, 0);
wSelectFolder.setLayoutData(fdSelectFolder);
// TestIMAPFolder button
wTestIMAPFolder = new Button(wIMAPSettings, SWT.PUSH);
wTestIMAPFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TestIMAPFolderConnection.Label"));
props.setLook(wTestIMAPFolder);
fdTestIMAPFolder = new FormData();
wTestIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestIMAPFolderConnection.Tooltip"));
fdTestIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdTestIMAPFolder.right = new FormAttachment(wSelectFolder, -margin);
wTestIMAPFolder.setLayoutData(fdTestIMAPFolder);
// IMAPFolder line
wlIMAPFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFolder.Label"));
props.setLook(wlIMAPFolder);
fdlIMAPFolder = new FormData();
fdlIMAPFolder.left = new FormAttachment(0, 0);
fdlIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdlIMAPFolder.right = new FormAttachment(middle, -margin);
wlIMAPFolder.setLayoutData(fdlIMAPFolder);
wIMAPFolder = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFolder);
wIMAPFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFolder.Tooltip"));
wIMAPFolder.addModifyListener(lsMod);
fdIMAPFolder = new FormData();
fdIMAPFolder.left = new FormAttachment(middle, 0);
fdIMAPFolder.top = new FormAttachment(wPOP3Settings, margin);
fdIMAPFolder.right = new FormAttachment(wTestIMAPFolder, -margin);
wIMAPFolder.setLayoutData(fdIMAPFolder);
// Include subfolders?
wlIncludeSubFolders = new Label(wIMAPSettings, SWT.RIGHT);
wlIncludeSubFolders.setText(BaseMessages.getString(PKG, "JobGetPOP.IncludeSubFoldersMails.Label"));
props.setLook(wlIncludeSubFolders);
fdlIncludeSubFolders = new FormData();
fdlIncludeSubFolders.left = new FormAttachment(0, 0);
fdlIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdlIncludeSubFolders.right = new FormAttachment(middle, -margin);
wlIncludeSubFolders.setLayoutData(fdlIncludeSubFolders);
wIncludeSubFolders = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wIncludeSubFolders);
fdIncludeSubFolders = new FormData();
wIncludeSubFolders.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.IncludeSubFoldersMails.Tooltip"));
fdIncludeSubFolders.left = new FormAttachment(middle, 0);
fdIncludeSubFolders.top = new FormAttachment(wIMAPFolder, margin);
fdIncludeSubFolders.right = new FormAttachment(100, 0);
wIncludeSubFolders.setLayoutData(fdIncludeSubFolders);
wIncludeSubFolders.addSelectionListener(lsSelection);
// List of mails of retrieve
wlIMAPListmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPListmails.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPListmails.Label"));
props.setLook(wlIMAPListmails);
fdlIMAPListmails = new FormData();
fdlIMAPListmails.left = new FormAttachment(0, 0);
fdlIMAPListmails.right = new FormAttachment(middle, -margin);
fdlIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
wlIMAPListmails.setLayoutData(fdlIMAPListmails);
wIMAPListmails = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wIMAPListmails.setItems(MailConnectionMeta.valueIMAPListDesc);
// +1: starts at -1
wIMAPListmails.select(0);
props.setLook(wIMAPListmails);
fdIMAPListmails = new FormData();
fdIMAPListmails.left = new FormAttachment(middle, 0);
fdIMAPListmails.top = new FormAttachment(wIncludeSubFolders, margin);
fdIMAPListmails.right = new FormAttachment(100, 0);
wIMAPListmails.setLayoutData(fdIMAPListmails);
wIMAPListmails.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
// ChooseIMAPListmails();
}
});
// Retrieve the first ... mails
wlIMAPFirstmails = new Label(wIMAPSettings, SWT.RIGHT);
wlIMAPFirstmails.setText(BaseMessages.getString(PKG, "JobGetPOP.IMAPFirstmails.Label"));
props.setLook(wlIMAPFirstmails);
fdlIMAPFirstmails = new FormData();
fdlIMAPFirstmails.left = new FormAttachment(0, 0);
fdlIMAPFirstmails.right = new FormAttachment(middle, -margin);
fdlIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
wlIMAPFirstmails.setLayoutData(fdlIMAPFirstmails);
wIMAPFirstmails = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wIMAPFirstmails);
wIMAPFirstmails.addModifyListener(lsMod);
fdIMAPFirstmails = new FormData();
fdIMAPFirstmails.left = new FormAttachment(middle, 0);
fdIMAPFirstmails.top = new FormAttachment(wIMAPListmails, margin);
fdIMAPFirstmails.right = new FormAttachment(100, 0);
wIMAPFirstmails.setLayoutData(fdIMAPFirstmails);
// After get IMAP
wlAfterGetIMAP = new Label(wIMAPSettings, SWT.RIGHT);
wlAfterGetIMAP.setText(BaseMessages.getString(PKG, "JobGetPOP.AfterGetIMAP.Label"));
props.setLook(wlAfterGetIMAP);
fdlAfterGetIMAP = new FormData();
fdlAfterGetIMAP.left = new FormAttachment(0, 0);
fdlAfterGetIMAP.right = new FormAttachment(middle, -margin);
fdlAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
wlAfterGetIMAP.setLayoutData(fdlAfterGetIMAP);
wAfterGetIMAP = new CCombo(wIMAPSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAfterGetIMAP.setItems(MailConnectionMeta.afterGetIMAPDesc);
// +1: starts at -1
wAfterGetIMAP.select(0);
props.setLook(wAfterGetIMAP);
fdAfterGetIMAP = new FormData();
fdAfterGetIMAP.left = new FormAttachment(middle, 0);
fdAfterGetIMAP.top = new FormAttachment(wIMAPFirstmails, 2 * margin);
fdAfterGetIMAP.right = new FormAttachment(100, 0);
wAfterGetIMAP.setLayoutData(fdAfterGetIMAP);
wAfterGetIMAP.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
setAfterIMAPRetrived();
jobEntry.setChanged();
}
});
// MoveToFolder line
wlMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.MoveToFolder.Label"));
props.setLook(wlMoveToFolder);
fdlMoveToFolder = new FormData();
fdlMoveToFolder.left = new FormAttachment(0, 0);
fdlMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdlMoveToFolder.right = new FormAttachment(middle, -margin);
wlMoveToFolder.setLayoutData(fdlMoveToFolder);
// SelectMoveToFolder button
wSelectMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
wSelectMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectMoveToFolderConnection.Label"));
props.setLook(wSelectMoveToFolder);
fdSelectMoveToFolder = new FormData();
wSelectMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.SelectMoveToFolderConnection.Tooltip"));
fdSelectMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdSelectMoveToFolder.right = new FormAttachment(100, 0);
wSelectMoveToFolder.setLayoutData(fdSelectMoveToFolder);
// TestMoveToFolder button
wTestMoveToFolder = new Button(wIMAPSettings, SWT.PUSH);
wTestMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.TestMoveToFolderConnection.Label"));
props.setLook(wTestMoveToFolder);
fdTestMoveToFolder = new FormData();
wTestMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.TestMoveToFolderConnection.Tooltip"));
fdTestMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdTestMoveToFolder.right = new FormAttachment(wSelectMoveToFolder, -margin);
wTestMoveToFolder.setLayoutData(fdTestMoveToFolder);
wMoveToFolder = new TextVar(jobMeta, wIMAPSettings, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wMoveToFolder);
wMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.MoveToFolder.Tooltip"));
wMoveToFolder.addModifyListener(lsMod);
fdMoveToFolder = new FormData();
fdMoveToFolder.left = new FormAttachment(middle, 0);
fdMoveToFolder.top = new FormAttachment(wAfterGetIMAP, margin);
fdMoveToFolder.right = new FormAttachment(wTestMoveToFolder, -margin);
wMoveToFolder.setLayoutData(fdMoveToFolder);
// Create move to folder
wlcreateMoveToFolder = new Label(wIMAPSettings, SWT.RIGHT);
wlcreateMoveToFolder.setText(BaseMessages.getString(PKG, "JobGetPOP.createMoveToFolderMails.Label"));
props.setLook(wlcreateMoveToFolder);
fdlcreateMoveToFolder = new FormData();
fdlcreateMoveToFolder.left = new FormAttachment(0, 0);
fdlcreateMoveToFolder.top = new FormAttachment(wMoveToFolder, margin);
fdlcreateMoveToFolder.right = new FormAttachment(middle, -margin);
wlcreateMoveToFolder.setLayoutData(fdlcreateMoveToFolder);
wcreateMoveToFolder = new Button(wIMAPSettings, SWT.CHECK);
props.setLook(wcreateMoveToFolder);
fdcreateMoveToFolder = new FormData();
wcreateMoveToFolder.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.createMoveToFolderMails.Tooltip"));
fdcreateMoveToFolder.left = new FormAttachment(middle, 0);
fdcreateMoveToFolder.top = new FormAttachment(wMoveToFolder, margin);
fdcreateMoveToFolder.right = new FormAttachment(100, 0);
wcreateMoveToFolder.setLayoutData(fdcreateMoveToFolder);
fdIMAPSettings = new FormData();
fdIMAPSettings.left = new FormAttachment(0, margin);
fdIMAPSettings.top = new FormAttachment(wPOP3Settings, 2 * margin);
fdIMAPSettings.right = new FormAttachment(100, -margin);
wIMAPSettings.setLayoutData(fdIMAPSettings);
// ///////////////////////////////////////////////////////////
// / END OF IMAP SETTINGS GROUP
// ///////////////////////////////////////////////////////////
fdSettingsComp = new FormData();
fdSettingsComp.left = new FormAttachment(0, 0);
fdSettingsComp.top = new FormAttachment(wName, 0);
fdSettingsComp.right = new FormAttachment(100, 0);
fdSettingsComp.bottom = new FormAttachment(100, 0);
wSettingsComp.setLayoutData(fdSettingsComp);
wSettingsComp.layout();
wSettingsTab.setControl(wSettingsComp);
props.setLook(wSettingsComp);
// ///////////////////////////////////////////////////////////
// / END OF Pop TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF SEARCH TAB ///
// ////////////////////////
wSearchTab = new CTabItem(wTabFolder, SWT.NONE);
wSearchTab.setText(BaseMessages.getString(PKG, "JobGetPOP.Tab.Search.Label"));
wSearchComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wSearchComp);
FormLayout searchLayout = new FormLayout();
searchLayout.marginWidth = 3;
searchLayout.marginHeight = 3;
wSearchComp.setLayout(searchLayout);
// ////////////////////////
// START OF HEADER ROUP///
// /
wHeader = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wHeader);
wHeader.setText(BaseMessages.getString(PKG, "JobGetPOP.Header.Group.Label"));
FormLayout HeadergroupLayout = new FormLayout();
HeadergroupLayout.marginWidth = 10;
HeadergroupLayout.marginHeight = 10;
wHeader.setLayout(HeadergroupLayout);
wNegateSender = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSender);
fdNegateSender = new FormData();
wNegateSender.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateSender.Tooltip"));
fdNegateSender.top = new FormAttachment(0, margin);
fdNegateSender.right = new FormAttachment(100, -margin);
wNegateSender.setLayoutData(fdNegateSender);
// From line
wlSender = new Label(wHeader, SWT.RIGHT);
wlSender.setText(BaseMessages.getString(PKG, "JobGetPOP.wSender.Label"));
props.setLook(wlSender);
fdlSender = new FormData();
fdlSender.left = new FormAttachment(0, 0);
fdlSender.top = new FormAttachment(0, margin);
fdlSender.right = new FormAttachment(middle, -margin);
wlSender.setLayoutData(fdlSender);
wSender = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSender);
wSender.addModifyListener(lsMod);
fdSender = new FormData();
fdSender.left = new FormAttachment(middle, 0);
fdSender.top = new FormAttachment(0, margin);
fdSender.right = new FormAttachment(wNegateSender, -margin);
wSender.setLayoutData(fdSender);
wNegateReceipient = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateReceipient);
fdNegateReceipient = new FormData();
wNegateReceipient.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateReceipient.Tooltip"));
fdNegateReceipient.top = new FormAttachment(wSender, margin);
fdNegateReceipient.right = new FormAttachment(100, -margin);
wNegateReceipient.setLayoutData(fdNegateReceipient);
// Receipient line
wlReceipient = new Label(wHeader, SWT.RIGHT);
wlReceipient.setText(BaseMessages.getString(PKG, "JobGetPOP.Receipient.Label"));
props.setLook(wlReceipient);
fdlReceipient = new FormData();
fdlReceipient.left = new FormAttachment(0, 0);
fdlReceipient.top = new FormAttachment(wSender, margin);
fdlReceipient.right = new FormAttachment(middle, -margin);
wlReceipient.setLayoutData(fdlReceipient);
wReceipient = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wReceipient);
wReceipient.addModifyListener(lsMod);
fdReceipient = new FormData();
fdReceipient.left = new FormAttachment(middle, 0);
fdReceipient.top = new FormAttachment(wSender, margin);
fdReceipient.right = new FormAttachment(wNegateReceipient, -margin);
wReceipient.setLayoutData(fdReceipient);
wNegateSubject = new Button(wHeader, SWT.CHECK);
props.setLook(wNegateSubject);
fdNegateSubject = new FormData();
wNegateSubject.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateSubject.Tooltip"));
fdNegateSubject.top = new FormAttachment(wReceipient, margin);
fdNegateSubject.right = new FormAttachment(100, -margin);
wNegateSubject.setLayoutData(fdNegateSubject);
// Subject line
wlSubject = new Label(wHeader, SWT.RIGHT);
wlSubject.setText(BaseMessages.getString(PKG, "JobGetPOP.Subject.Label"));
props.setLook(wlSubject);
fdlSubject = new FormData();
fdlSubject.left = new FormAttachment(0, 0);
fdlSubject.top = new FormAttachment(wReceipient, margin);
fdlSubject.right = new FormAttachment(middle, -margin);
wlSubject.setLayoutData(fdlSubject);
wSubject = new TextVar(jobMeta, wHeader, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wSubject);
wSubject.addModifyListener(lsMod);
fdSubject = new FormData();
fdSubject.left = new FormAttachment(middle, 0);
fdSubject.top = new FormAttachment(wReceipient, margin);
fdSubject.right = new FormAttachment(wNegateSubject, -margin);
wSubject.setLayoutData(fdSubject);
fdHeader = new FormData();
fdHeader.left = new FormAttachment(0, margin);
fdHeader.top = new FormAttachment(wReceipient, 2 * margin);
fdHeader.right = new FormAttachment(100, -margin);
wHeader.setLayoutData(fdHeader);
// ///////////////////////////////////////////////////////////
// / END OF HEADER GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF CONTENT GROUP///
// /
wContent = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wContent);
wContent.setText(BaseMessages.getString(PKG, "JobGetPOP.Content.Group.Label"));
FormLayout ContentgroupLayout = new FormLayout();
ContentgroupLayout.marginWidth = 10;
ContentgroupLayout.marginHeight = 10;
wContent.setLayout(ContentgroupLayout);
wNegateBody = new Button(wContent, SWT.CHECK);
props.setLook(wNegateBody);
fdNegateBody = new FormData();
wNegateBody.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateBody.Tooltip"));
fdNegateBody.top = new FormAttachment(wHeader, margin);
fdNegateBody.right = new FormAttachment(100, -margin);
wNegateBody.setLayoutData(fdNegateBody);
// Body line
wlBody = new Label(wContent, SWT.RIGHT);
wlBody.setText(BaseMessages.getString(PKG, "JobGetPOP.Body.Label"));
props.setLook(wlBody);
fdlBody = new FormData();
fdlBody.left = new FormAttachment(0, 0);
fdlBody.top = new FormAttachment(wHeader, margin);
fdlBody.right = new FormAttachment(middle, -margin);
wlBody.setLayoutData(fdlBody);
wBody = new TextVar(jobMeta, wContent, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wBody);
wBody.addModifyListener(lsMod);
fdBody = new FormData();
fdBody.left = new FormAttachment(middle, 0);
fdBody.top = new FormAttachment(wHeader, margin);
fdBody.right = new FormAttachment(wNegateBody, -margin);
wBody.setLayoutData(fdBody);
fdContent = new FormData();
fdContent.left = new FormAttachment(0, margin);
fdContent.top = new FormAttachment(wHeader, margin);
fdContent.right = new FormAttachment(100, -margin);
wContent.setLayoutData(fdContent);
// ///////////////////////////////////////////////////////////
// / END OF CONTENT GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF RECEIVED DATE ROUP///
// /
wReceivedDate = new Group(wSearchComp, SWT.SHADOW_NONE);
props.setLook(wReceivedDate);
wReceivedDate.setText(BaseMessages.getString(PKG, "JobGetPOP.ReceivedDate.Group.Label"));
FormLayout ReceivedDategroupLayout = new FormLayout();
ReceivedDategroupLayout.marginWidth = 10;
ReceivedDategroupLayout.marginHeight = 10;
wReceivedDate.setLayout(ReceivedDategroupLayout);
wNegateReceivedDate = new Button(wReceivedDate, SWT.CHECK);
props.setLook(wNegateReceivedDate);
fdNegateReceivedDate = new FormData();
wNegateReceivedDate.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.NegateReceivedDate.Tooltip"));
fdNegateReceivedDate.top = new FormAttachment(wContent, margin);
fdNegateReceivedDate.right = new FormAttachment(100, -margin);
wNegateReceivedDate.setLayoutData(fdNegateReceivedDate);
// Received Date Condition
wlConditionOnReceivedDate = new Label(wReceivedDate, SWT.RIGHT);
wlConditionOnReceivedDate.setText(BaseMessages.getString(PKG, "JobGetPOP.ConditionOnReceivedDate.Label"));
props.setLook(wlConditionOnReceivedDate);
fdlConditionOnReceivedDate = new FormData();
fdlConditionOnReceivedDate.left = new FormAttachment(0, 0);
fdlConditionOnReceivedDate.right = new FormAttachment(middle, -margin);
fdlConditionOnReceivedDate.top = new FormAttachment(wContent, margin);
wlConditionOnReceivedDate.setLayoutData(fdlConditionOnReceivedDate);
wConditionOnReceivedDate = new CCombo(wReceivedDate, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wConditionOnReceivedDate.setItems(MailConnectionMeta.conditionDateDesc);
// +1: starts at -1
wConditionOnReceivedDate.select(0);
props.setLook(wConditionOnReceivedDate);
fdConditionOnReceivedDate = new FormData();
fdConditionOnReceivedDate.left = new FormAttachment(middle, 0);
fdConditionOnReceivedDate.top = new FormAttachment(wContent, margin);
fdConditionOnReceivedDate.right = new FormAttachment(wNegateReceivedDate, -margin);
wConditionOnReceivedDate.setLayoutData(fdConditionOnReceivedDate);
wConditionOnReceivedDate.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
conditionReceivedDate();
jobEntry.setChanged();
}
});
open = new Button(wReceivedDate, SWT.PUSH);
open.setImage(GUIResource.getInstance().getImageCalendar());
open.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OpenCalendar"));
FormData fdlButton = new FormData();
fdlButton.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlButton.right = new FormAttachment(100, 0);
open.setLayoutData(fdlButton);
open.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final Shell dialog = new Shell(shell, SWT.DIALOG_TRIM);
dialog.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectDate"));
dialog.setImage(GUIResource.getInstance().getImageSpoon());
dialog.setLayout(new GridLayout(3, false));
final DateTime calendar = new DateTime(dialog, SWT.CALENDAR);
final DateTime time = new DateTime(dialog, SWT.TIME | SWT.TIME);
new Label(dialog, SWT.NONE);
new Label(dialog, SWT.NONE);
Button ok = new Button(dialog, SWT.PUSH);
ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
ok.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
ok.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendar.getYear());
cal.set(Calendar.MONTH, calendar.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendar.getDay());
cal.set(Calendar.HOUR_OF_DAY, time.getHours());
cal.set(Calendar.MINUTE, time.getMinutes());
cal.set(Calendar.SECOND, time.getSeconds());
wReadFrom.setText(new SimpleDateFormat(JobEntryGetPOP.DATE_PATTERN).format(cal.getTime()));
dialog.close();
}
});
dialog.setDefaultButton(ok);
dialog.pack();
dialog.open();
}
});
wlReadFrom = new Label(wReceivedDate, SWT.RIGHT);
wlReadFrom.setText(BaseMessages.getString(PKG, "JobGetPOP.ReadFrom.Label"));
props.setLook(wlReadFrom);
fdlReadFrom = new FormData();
fdlReadFrom.left = new FormAttachment(0, 0);
fdlReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdlReadFrom.right = new FormAttachment(middle, -margin);
wlReadFrom.setLayoutData(fdlReadFrom);
wReadFrom = new TextVar(jobMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadFrom.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ReadFrom.Tooltip"));
props.setLook(wReadFrom);
wReadFrom.addModifyListener(lsMod);
fdReadFrom = new FormData();
fdReadFrom.left = new FormAttachment(middle, 0);
fdReadFrom.top = new FormAttachment(wConditionOnReceivedDate, margin);
fdReadFrom.right = new FormAttachment(open, -margin);
wReadFrom.setLayoutData(fdReadFrom);
opento = new Button(wReceivedDate, SWT.PUSH);
opento.setImage(GUIResource.getInstance().getImageCalendar());
opento.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.OpenCalendar"));
FormData fdlButtonto = new FormData();
fdlButtonto.top = new FormAttachment(wReadFrom, 2 * margin);
fdlButtonto.right = new FormAttachment(100, 0);
opento.setLayoutData(fdlButtonto);
opento.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final Shell dialogto = new Shell(shell, SWT.DIALOG_TRIM);
dialogto.setText(BaseMessages.getString(PKG, "JobGetPOP.SelectDate"));
dialogto.setImage(GUIResource.getInstance().getImageSpoon());
dialogto.setLayout(new GridLayout(3, false));
final DateTime calendarto = new DateTime(dialogto, SWT.CALENDAR | SWT.BORDER);
final DateTime timeto = new DateTime(dialogto, SWT.TIME | SWT.TIME);
new Label(dialogto, SWT.NONE);
new Label(dialogto, SWT.NONE);
Button okto = new Button(dialogto, SWT.PUSH);
okto.setText(BaseMessages.getString(PKG, "System.Button.OK"));
okto.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
okto.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, calendarto.getYear());
cal.set(Calendar.MONTH, calendarto.getMonth());
cal.set(Calendar.DAY_OF_MONTH, calendarto.getDay());
cal.set(Calendar.HOUR_OF_DAY, timeto.getHours());
cal.set(Calendar.MINUTE, timeto.getMinutes());
cal.set(Calendar.SECOND, timeto.getSeconds());
wReadTo.setText(new SimpleDateFormat(JobEntryGetPOP.DATE_PATTERN).format(cal.getTime()));
dialogto.close();
}
});
dialogto.setDefaultButton(okto);
dialogto.pack();
dialogto.open();
}
});
wlReadTo = new Label(wReceivedDate, SWT.RIGHT);
wlReadTo.setText(BaseMessages.getString(PKG, "JobGetPOP.ReadTo.Label"));
props.setLook(wlReadTo);
fdlReadTo = new FormData();
fdlReadTo.left = new FormAttachment(0, 0);
fdlReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdlReadTo.right = new FormAttachment(middle, -margin);
wlReadTo.setLayoutData(fdlReadTo);
wReadTo = new TextVar(jobMeta, wReceivedDate, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
wReadTo.setToolTipText(BaseMessages.getString(PKG, "JobGetPOP.ReadTo.Tooltip"));
props.setLook(wReadTo);
wReadTo.addModifyListener(lsMod);
fdReadTo = new FormData();
fdReadTo.left = new FormAttachment(middle, 0);
fdReadTo.top = new FormAttachment(wReadFrom, 2 * margin);
fdReadTo.right = new FormAttachment(opento, -margin);
wReadTo.setLayoutData(fdReadTo);
fdReceivedDate = new FormData();
fdReceivedDate.left = new FormAttachment(0, margin);
fdReceivedDate.top = new FormAttachment(wContent, margin);
fdReceivedDate.right = new FormAttachment(100, -margin);
wReceivedDate.setLayoutData(fdReceivedDate);
// ///////////////////////////////////////////////////////////
// / END OF RECEIVED DATE GROUP
// ///////////////////////////////////////////////////////////
fdSearchComp = new FormData();
fdSearchComp.left = new FormAttachment(0, 0);
fdSearchComp.top = new FormAttachment(wName, 0);
fdSearchComp.right = new FormAttachment(100, 0);
fdSearchComp.bottom = new FormAttachment(100, 0);
wSearchComp.setLayoutData(fdSearchComp);
wSearchComp.layout();
wSearchTab.setControl(wSearchComp);
props.setLook(wSearchComp);
// ////////////////////////////////
// / END OF SEARCH TAB
// ////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wTest.addListener(SWT.Selection, lsTest);
lsTestIMAPFolder = new Listener() {
public void handleEvent(Event e) {
checkFolder(jobMeta.environmentSubstitute(wIMAPFolder.getText()));
}
};
wTestIMAPFolder.addListener(SWT.Selection, lsTestIMAPFolder);
lsTestMoveToFolder = new Listener() {
public void handleEvent(Event e) {
checkFolder(jobMeta.environmentSubstitute(wMoveToFolder.getText()));
}
};
wTestMoveToFolder.addListener(SWT.Selection, lsTestMoveToFolder);
lsSelectFolder = new Listener() {
public void handleEvent(Event e) {
selectFolder(wIMAPFolder);
}
};
wSelectFolder.addListener(SWT.Selection, lsSelectFolder);
lsSelectMoveToFolder = new Listener() {
public void handleEvent(Event e) {
selectFolder(wMoveToFolder);
}
};
wSelectMoveToFolder.addListener(SWT.Selection, lsSelectMoveToFolder);
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setUserProxy();
chooseListMails();
activeAttachmentFolder();
refreshProtocol(false);
conditionReceivedDate();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobEntryGetPOPDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.eclipse.swt.events.SelectionListener in project xtext-eclipse by eclipse.
the class SelectionButtonDialogField method getSelectionButton.
// ------- ui creation
/**
* Returns the selection button widget. When called the first time, the
* widget will be created.
*
* @param group
* The parent composite when called the first time, or
* <code>null</code> after.
*/
public Button getSelectionButton(Composite group) {
if (fButton == null) {
assertCompositeNotNull(group);
fButton = new Button(group, fButtonStyle);
fButton.setFont(group.getFont());
fButton.setText(fLabelText);
fButton.setEnabled(isEnabled());
fButton.setSelection(fIsSelected);
fButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
doWidgetSelected(e);
}
@Override
public void widgetSelected(SelectionEvent e) {
doWidgetSelected(e);
}
});
}
return fButton;
}
use of org.eclipse.swt.events.SelectionListener in project xtext-eclipse by eclipse.
the class ProjectSelectionDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
Font font = parent.getFont();
composite.setFont(font);
createMessageArea(composite);
tableViewer = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
doSelectionChanged(((IStructuredSelection) event.getSelection()).toArray());
}
});
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
okPressed();
}
});
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
tableViewer.getTable().setLayoutData(data);
tableViewer.setContentProvider(new WorkbenchContentProvider());
tableViewer.setLabelProvider(new WorkbenchLabelProvider());
tableViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
tableViewer.getControl().setFont(font);
Button checkbox = new Button(composite, SWT.CHECK);
checkbox.setText(Messages.ProjectSelectionDialog_filter);
checkbox.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
checkbox.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
updateFilter(((Button) e.widget).getSelection());
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
updateFilter(((Button) e.widget).getSelection());
}
});
boolean doFilter = !dialogSettings.getBoolean(DIALOG_SETTINGS_SHOW_ALL) && !projectsWithSpecifics.isEmpty();
checkbox.setSelection(doFilter);
updateFilter(doFilter);
tableViewer.setInput(ResourcesPlugin.getWorkspace());
doSelectionChanged(new Object[0]);
Dialog.applyDialogFont(composite);
return composite;
}
use of org.eclipse.swt.events.SelectionListener in project xtext-eclipse by eclipse.
the class ResetPromptDialogSettingsField method createField.
protected ResetPromptDialogSettingsField createField(Composite parent, int colums) {
if (dontAskGroup == null) {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
dontAskGroup = new Group(parent, SWT.NONE);
dontAskGroup.setLayout(layout);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = colums;
dontAskGroup.setLayoutData(gridData);
dontAskGroup.setText(languageInfo.getShortName() + Messages.ResetPromptDialogSettingsField_0);
Label label = new Label(dontAskGroup, SWT.WRAP);
label.setText(Messages.ResetPromptDialogSettingsField_1);
label.setFont(parent.getFont());
GridData data = new GridData(GridData.FILL, GridData.CENTER, true, false);
data.widthHint = new PixelConverter(parent).convertHorizontalDLUsToPixels(40);
label.setLayoutData(data);
Button clearButton = new Button(dontAskGroup, SWT.PUSH);
// $NON-NLS-1$
clearButton.setText("&Clear");
GridData layoutData = new GridData(GridData.FILL, GridData.BEGINNING, false, false);
clearButton.setLayoutData(layoutData);
clearButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
unhideAllDialogs();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
unhideAllDialogs();
}
});
layoutData.widthHint = SWTUtil.getButtonWidthHint(clearButton);
}
return this;
}
Aggregations