code: protected void onWindowClose() {
  
          boolean savePage = Window.confirm(
              Messages.get().key(Messages.GUI_EDITOR_SAVE_BEFORE_LEAVING_1, m_editableData.getSitePath()));
          if (savePage) {
              saveEditorContent();
          }
      }
docs: Execute on window close.<p>
  Will ask the user if the edited content should be saved.<p>