You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/03/29 10:50:21 UTC

[groovy] branch GROOVY_2_5_X updated: GROOVY-9483: Fix 'Save changes?' dialog quitting on cancel with Java 11 on OSX

This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new 023a340  GROOVY-9483: Fix 'Save changes?' dialog quitting on cancel with Java 11 on OSX
023a340 is described below

commit 023a3409c092957696a37de84bf453377a4a2aff
Author: timyates <ti...@gmail.com>
AuthorDate: Fri Mar 27 19:07:39 2020 +0000

    GROOVY-9483: Fix 'Save changes?' dialog quitting on cancel with Java 11 on OSX
    
    If the user quits the Groovy console with unsaved changes, it asks if
    they want to 'Save changes?'
    
    Under Java 11, this still quits if they click 'Cancel'
    
    Looks like we need to cancel the quit event if cancel was pressed
---
 .../groovy-console/src/main/groovy/groovy/ui/Console.groovy | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
index e3a9e96..de69adb 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/Console.groovy
@@ -733,13 +733,17 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo
     }
 
     void exitDesktop(EventObject evt = null, quitResponse = null) {
-        exit(evt)
-        quitResponse.performQuit()
+        if (exit(evt)) {
+            quitResponse.performQuit()
+        } else {
+            quitResponse.cancelQuit()
+        }
     }
 
-    void exit(EventObject evt = null) {
+    boolean exit(EventObject evt = null) {
         if (askToInterruptScript()) {
-            if (askToSaveFile()) {
+            def exit = askToSaveFile()
+            if (exit) {
                 if (frame instanceof Window) {
                     frame.hide()
                     frame.dispose()
@@ -752,6 +756,7 @@ class Console implements CaretListener, HyperlinkListener, ComponentListener, Fo
                     systemErrorInterceptor.stop()
                 }
             }
+            return exit
         }
     }