@Override public boolean close(){
  if (lastOpenedTime != -1) {
    final long elapsedTimeOpen=System.currentTimeMillis() - lastOpenedTime;
    DialogSettingsHelper.recordDialogClosed(dialogSettingsKey,elapsedTimeOpen);
    lastOpenedTime=-1;
  }
  DialogSettingsHelper.persistShellGeometry(getShell(),dialogSettingsKey);
  hookDialogAboutToClose();
  return super.close();
}

@ Override public boolean close ( ) { if ( lastOpenedTime != - 1 ) { final long elapsedTimeOpen = System . currentTimeMillis ( ) - lastOpenedTime ; DialogSettingsHelper . recordDialogClosed ( dialogSettingsKey , elapsedTimeOpen ) ; lastOpenedTime = - 1 ; } DialogSettingsHelper . persistShellGeometry ( getShell ( ) , dialogSettingsKey ) ; hookDialogAboutToClose ( ) ; return super . close ( ) ; }
this base class overrides close ( ) to persist the dialog settings , record the elapsed open time for statistics , and to call a subclass hook .
