1. swt中关闭shell时,取消操作
添加一个shellClosed事件
shell.addShellListener(new ShellAdapter() {
public void shellClosed(final ShellEvent e) {
MessageBox messageBox = new MessageBox(shell,
SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
messageBox.setText("确定");
messageBox.setMessage("你确定要退出吗?");
int rc = messageBox.open();
if (rc == SWT.CANCEL) {
e.doit = false;
}
}
});