2
這是我的對話框類:InputDialog是用另一個View的按鈕打開的。該對話框包含單個文本輸入。JFace對話框處理提交的數據(OKPressed)
public class InputDialog extends Dialog{
public InputDialog(Shell parentShell) {
super(parentShell);
// TODO Auto-generated constructor stub
}
@Override
protected Control createDialogArea(Composite parent) {
parent.setLayout(new GridLayout(1, false));
Text txtName = new Text(parent, SWT.NONE);
return super.createDialogArea(parent);
}
@Override
protected void okPressed() {
// TODO Auto-generated method stub
super.okPressed();
}
}
而且我這是怎麼打開的對話框:
buttAdd.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
// TODO Auto-generated method stub
InputDialog dialog = new InputDialog(new Shell());
dialog.open();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
});
我如何處理/讀取返回或提交的值的從對話?