private boolean askToSave ( ) { if ( mainFrame . isProjectChanged ( ) ) { int response = JOptionPane . showConfirmDialog ( mainFrame , L10N . getLocalString ( "dlg.save_current_changes" , "The current project has been changed, Save current changes?" ) , L10N . getLocalString ( "dlg.save_changes" , "Save Changes?" ) , JOptionPane . YES_NO_CANCEL_OPTION , JOptionPane . WARNING_MESSAGE ) ; if ( response == JOptionPane . YES_OPTION ) { if ( mainFrame . getSaveFile ( ) != null ) { save ( ) ; } else { saveAs ( ) ; } } else if ( response == JOptionPane . CANCEL_OPTION ) { return true ; // IF no, do nothing. } } return false ; }
Returns true if cancelled