return addLabelledTextField(parent, label, textlimit, textlimit, indent);
}
protected Text addLabelledTextField(final Composite parent, final String label,
final int modelTextLimit, final int fieldTextLimit, final int indent) {
final PixelConverter pixelConverter = new PixelConverter(parent);
labelControl = new Label(parent, SWT.WRAP);
labelControl.setText(label);
labelControl.setLayoutData(new GridData());
final Text textBox = new Text(parent, SWT.BORDER | SWT.SINGLE);
textBox.setLayoutData(new GridData());
textBox.addModifyListener(new ModifyListener() {
@Override
public void modifyText(final ModifyEvent e) {
validateSettings();
}
});
final GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
if (modelTextLimit != 0) {
textBox.setTextLimit(modelTextLimit);
}
if (fieldTextLimit != 0) {
data.widthHint = pixelConverter
.convertWidthInCharsToPixels(fieldTextLimit + 1);
}
data.horizontalIndent = indent;
data.horizontalSpan = 2;