public SyntheticService getResult() { SyntheticService service = new SyntheticService(); service.name = fNameDialogField.getText(); service.className = fClassDialogField.getText(); return service; }
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Composite inner = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; layout.numColumns = 2; inner.setLayout(layout); fNameDialogField.doFillIntoGrid(inner, 2); fClassDialogField.doFillIntoGrid(inner, 2); LayoutUtil.setHorizontalGrabbing(fNameDialogField.getTextControl(null)); LayoutUtil.setWidthHint(fNameDialogField.getTextControl(null), convertWidthInCharsToPixels(45)); fNameDialogField.postSetFocusOnDialogField(parent.getDisplay()); applyDialogFont(composite); return composite; }
public ServiceInputDialog(Shell parent, SyntheticService s, List elements) { super(parent); this.service = s; String name = ""; String className = ""; if (service != null) { name = service.name != null ? service.name : ""; // $NON-NLS-N$ className = service.className != null ? service.className : ""; // $NON-NLS-N$ } fNameDialogField = new StringDialogField(); fNameDialogField.setLabelText("Service name"); fNameDialogField.setDialogFieldListener( new IDialogFieldListener() { @Override public void dialogFieldChanged(DialogField field) { // TODO: validate } }); fNameDialogField.setText(name); fClassDialogField = new StringDialogField(); fClassDialogField.setLabelText("Service class"); fClassDialogField.setText(className); fClassDialogField.setDialogFieldListener( new IDialogFieldListener() { @Override public void dialogFieldChanged(DialogField field) { // TODO: validate } }); }