merged
authorwenzelm
Thu, 26 Sep 2013 13:34:42 +0200
changeset 53915 0e2c4dff5d13
parent 53911 a268daff3e0f (current diff)
parent 53914 48072f049838 (diff)
child 53916 37c31a619eee
merged
src/Tools/jEdit/src/osx_adapter.scala
--- a/Admin/Release/build_library	Thu Sep 26 11:41:01 2013 +0200
+++ b/Admin/Release/build_library	Thu Sep 26 13:34:42 2013 +0200
@@ -61,7 +61,10 @@
 
 ## main
 
-export COPYFILE_DISABLE=true
+#GNU tar (notably on Mac OS X)
+if [ -x /usr/bin/gnutar ]; then
+  function tar() { /usr/bin/gnutar "$@"; }
+fi
 
 TMP="/var/tmp/isabelle-makedist$$"
 mkdir "$TMP" || fail "Cannot create directory: \"$TMP\""
--- a/Admin/java/build	Thu Sep 26 11:41:01 2013 +0200
+++ b/Admin/java/build	Thu Sep 26 13:34:42 2013 +0200
@@ -71,7 +71,10 @@
 
 # content
 
-export COPYFILE_DISABLE=true
+#GNU tar (notably on Mac OS X)
+if [ -x /usr/bin/gnutar ]; then
+  function tar() { /usr/bin/gnutar "$@"; }
+fi
 
 mkdir "$DIR/x86-linux" "$DIR/x86_64-linux" "$DIR/x86_64-darwin" "$DIR/x86-cygwin"
 
--- a/Admin/lib/Tools/makedist	Thu Sep 26 11:41:01 2013 +0200
+++ b/Admin/lib/Tools/makedist	Thu Sep 26 13:34:42 2013 +0200
@@ -199,7 +199,7 @@
 chmod -R g=o "$DISTNAME"
 
 echo "$DISTBASE/$DISTNAME.tar.gz"
-env COPYFILE_DISABLE=true tar -c -z -f "$DISTNAME.tar.gz" "$DISTNAME"
+tar -c -z -f "$DISTNAME.tar.gz" "$DISTNAME"
 [ "$?" = 0 ] || exit "$?"
 
 
--- a/Admin/lib/Tools/makedist_bundle	Thu Sep 26 11:41:01 2013 +0200
+++ b/Admin/lib/Tools/makedist_bundle	Thu Sep 26 13:34:42 2013 +0200
@@ -41,8 +41,6 @@
 
 ## main
 
-export COPYFILE_DISABLE=true
-
 TMP="/var/tmp/isabelle-makedist$$"
 mkdir "$TMP" || fail "Cannot create directory $TMP"
 
--- a/lib/scripts/getsettings	Thu Sep 26 11:41:01 2013 +0200
+++ b/lib/scripts/getsettings	Thu Sep 26 13:34:42 2013 +0200
@@ -11,6 +11,11 @@
 
 ISABELLE_SETTINGS_PRESENT=true
 
+#GNU tar (notably on Mac OS X)
+if [ -x /usr/bin/gnutar ]; then
+  function tar() { /usr/bin/gnutar "$@"; }
+fi
+
 #Cygwin vs. POSIX
 if [ "$OSTYPE" = cygwin ]
 then
--- a/src/Pure/Tools/main.scala	Thu Sep 26 11:41:01 2013 +0200
+++ b/src/Pure/Tools/main.scala	Thu Sep 26 13:34:42 2013 +0200
@@ -7,7 +7,7 @@
 package isabelle
 
 
-import java.lang.{System, ClassLoader}
+import java.lang.{System, Class, ClassLoader}
 import java.io.{File => JFile, BufferedReader, InputStreamReader}
 import java.nio.file.Files
 
@@ -116,7 +116,8 @@
           System.setProperty("scala.home",
             Isabelle_System.platform_path(Path.explode("$SCALA_HOME")))
 
-          val jedit = ClassLoader.getSystemClassLoader.loadClass("org.gjt.sp.jedit.jEdit")
+          val jedit =
+            Class.forName("org.gjt.sp.jedit.jEdit", true, ClassLoader.getSystemClassLoader)
           val jedit_main = jedit.getDeclaredMethod("main", classOf[Array[String]])
 
           () => jedit_main.invoke(null, jedit_options ++ jedit_settings ++ more_args)
--- a/src/Tools/jEdit/etc/options	Thu Sep 26 11:41:01 2013 +0200
+++ b/src/Tools/jEdit/etc/options	Thu Sep 26 13:34:42 2013 +0200
@@ -30,12 +30,6 @@
 public option jedit_symbols_search_limit : int = 50
   -- "maximum number of symbols in search result"
 
-option jedit_macos_application : bool = false
-  -- "some native Mac OS X application support (potential conflict with MacOSX plugin)"
-
-option jedit_macos_preferences : bool = false
-  -- "native Mac OS X preferences menu"
-
 public option jedit_timing_threshold : real = 0.1
   -- "default threshold for timing display"
 
--- a/src/Tools/jEdit/lib/Tools/jedit	Thu Sep 26 11:41:01 2013 +0200
+++ b/src/Tools/jEdit/lib/Tools/jedit	Thu Sep 26 13:34:42 2013 +0200
@@ -28,7 +28,6 @@
   "src/jedit_options.scala"
   "src/jedit_thy_load.scala"
   "src/monitor_dockable.scala"
-  "src/osx_adapter.scala"
   "src/output_dockable.scala"
   "src/plugin.scala"
   "src/pretty_text_area.scala"
--- a/src/Tools/jEdit/src/osx_adapter.scala	Thu Sep 26 11:41:01 2013 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/*  Title:      Tools/jEdit/src/osx_adapter.scala
-    Author:     Makarius
-
-Some native OS X support.
-*/
-
-package isabelle.jedit
-
-
-import isabelle._
-
-import java.lang.{Class, ClassNotFoundException, NoSuchMethodException}
-import java.lang.reflect.{InvocationHandler, Method, Proxy}
-
-
-object OSX_Adapter
-{
-  private lazy val application_class: Class[_] = Class.forName("com.apple.eawt.Application")
-  private lazy val application = application_class.getConstructor().newInstance()
-
-  def init
-  {
-    if (PIDE.options.bool("jedit_macos_application")) {
-      try {
-        set_handler("handleQuit")
-        set_handler("handleAbout")
-
-        if (PIDE.options.bool("jedit_macos_preferences")) {
-          application_class.getDeclaredMethod("setEnabledPreferencesMenu", classOf[Boolean]).
-            invoke(application, java.lang.Boolean.valueOf(true))
-          set_handler("handlePreferences")
-        }
-      }
-      catch {
-        case exn: ClassNotFoundException =>
-          java.lang.System.err.println(
-            "com.apple.eawt.Application unavailable -- cannot install native OS X handler")
-      }
-    }
-  }
-
-  private def set_handler(name: String)
-  {
-    val handler = PIDE.plugin.getClass.getDeclaredMethod(name)
-    val adapter = new OSX_Adapter(name, PIDE.plugin, handler)
-    try {
-      val application_listener_class: Class[_] =
-        Class.forName("com.apple.eawt.ApplicationListener")
-      val add_listener_method =
-        application_class.getDeclaredMethod("addApplicationListener", application_listener_class)
-
-      val osx_adapter_proxy =
-        Proxy.newProxyInstance(classOf[OSX_Adapter].getClassLoader,
-          Array(application_listener_class), adapter)
-      add_listener_method.invoke(application, osx_adapter_proxy)
-    }
-    catch {
-      case exn: ClassNotFoundException =>
-        java.lang.System.err.println(
-          "com.apple.eawt.Application unavailable -- cannot install native OS X handler")
-    }
-  }
-}
-
-class OSX_Adapter(proxy_signature: String, target_object: AnyRef, target_method: Method)
-  extends InvocationHandler
-{
-  override def invoke(proxy: Any, method: Method, args: Array[AnyRef]): AnyRef =
-  {
-    if (proxy_signature == method.getName && args.length == 1) {
-      val result = target_method.invoke(target_object)
-      val handled = result == null || result.toString == "true"
-
-      val event = args(0)
-      if (event != null) {
-        try {
-          val set_handled_method =
-            event.getClass.getDeclaredMethod("setHandled", classOf[java.lang.Boolean])
-          set_handled_method.invoke(event, java.lang.Boolean.valueOf(handled))
-        }
-        catch { case _: NoSuchMethodException => }
-      }
-    }
-    null
-  }
-}
-
--- a/src/Tools/jEdit/src/plugin.scala	Thu Sep 26 11:41:01 2013 +0200
+++ b/src/Tools/jEdit/src/plugin.scala	Thu Sep 26 13:34:42 2013 +0200
@@ -325,8 +325,6 @@
       PIDE.options.update(Options.init())
       PIDE.completion_history.load()
 
-      // FIXME if (Platform.is_macos) OSX_Adapter.init
-
       SyntaxUtilities.setStyleExtender(new Token_Markup.Style_Extender)
       if (ModeProvider.instance.isInstanceOf[ModeProvider])
         ModeProvider.instance = new Token_Markup.Mode_Provider(ModeProvider.instance)