shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
MessageBox messagebox = new MessageBox(shell, SWT.ICON_QUESTION
| SWT.YES | SWT.NO);
messagebox.setText("messageBox范例");
messagebox.setMessage("您确定要退出吗?") ;
int message = messagebox.open();
e.doit = message == SWT.YES;
}
});