如何在关闭eclipse(e4)rcp应用程序之前显示确认弹出窗口

时间:2015-03-12 06:36:42

标签: rcp e4

这是我用来在关闭之前调用弹出窗口的代码,

@PostContextCreate         void postContextCreate()         {

}
@Execute
public void execute(final Shell shell,  MWindow window) {
    IWindowCloseHandler handler = new IWindowCloseHandler() {
        @Override
        public boolean close(MWindow window) {
            return MessageDialog.openConfirm(shell, "Close",
                    "You will loose data. Really close?");
        }
    };
    window.getContext().set(IWindowCloseHandler.class, handler);
}

0 个答案:

没有答案
相关问题