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 2018/07/31 09:02:23 UTC

[2/3] groovy git commit: GROOVY-8718: GroovyConsole MacOS fix required for JDK9+

GROOVY-8718: GroovyConsole MacOS fix required for JDK9+


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/04432d6b
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/04432d6b
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/04432d6b

Branch: refs/heads/GROOVY_2_5_X
Commit: 04432d6b08ef5dbf0a55b9d253d3e2e8c3b2b9cf
Parents: ca357e2
Author: Paul King <pa...@asert.com.au>
Authored: Sun Jul 29 04:37:37 2018 +1000
Committer: Paul King <pa...@asert.com.au>
Committed: Tue Jul 31 19:01:54 2018 +1000

----------------------------------------------------------------------
 .../main/groovy/groovy/ui/view/MacOSXMenuBar.groovy    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/04432d6b/subprojects/groovy-console/src/main/groovy/groovy/ui/view/MacOSXMenuBar.groovy
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/src/main/groovy/groovy/ui/view/MacOSXMenuBar.groovy b/subprojects/groovy-console/src/main/groovy/groovy/ui/view/MacOSXMenuBar.groovy
index 1124b47..f77973c 100644
--- a/subprojects/groovy-console/src/main/groovy/groovy/ui/view/MacOSXMenuBar.groovy
+++ b/subprojects/groovy-console/src/main/groovy/groovy/ui/view/MacOSXMenuBar.groovy
@@ -18,10 +18,21 @@
  */
 package groovy.ui.view
 
+import org.codehaus.groovy.vmplugin.VMPluginFactory
+
 def handler = false
+def jdk9plus = VMPluginFactory.getPlugin().getVersion() > 8
+// TODO Desktop handlers are supposed to work cross platform, should we do version check at a higher layer
+// TODO there is also an open files handler, should we also be using that?
 if (!handler) {
     try {
-        handler = build("""
+        handler = build(jdk9plus ? """
+def handler = Desktop.getDesktop()
+handler.setAboutHandler(controller.&showAbout)
+handler.setQuitHandler(controller.&exit)
+handler.setPreferencesHandler(controller.&preferences)
+handler
+""" : """
 package groovy.ui
 
 import com.apple.mrj.*