allow debug messages to be output before jscallback execution
authorjprocter <Jim Procter>
Mon, 17 Jan 2011 14:27:06 +0000 (14:27 +0000)
committerjprocter <Jim Procter>
Mon, 17 Jan 2011 14:27:06 +0000 (14:27 +0000)
src/jalview/javascript/JSFunctionExec.java

index 9674926..64e8a0e 100644 (file)
@@ -96,6 +96,15 @@ public class JSFunctionExec implements Runnable
   public void executeJavascriptFunction(final boolean async,
           final String _listener, Object[] arguments) throws Exception
   {
+
+    executeJavascriptFunction(async, _listener, arguments, null);
+
+  }
+
+  public void executeJavascriptFunction(final boolean async,
+          final String _listener, Object[] arguments, final String dbgMsg)
+          throws Exception
+  {
     final Object[] objects = new Object[arguments != null ? arguments.length
             : 0];
     if (arguments != null)
@@ -112,13 +121,17 @@ public class JSFunctionExec implements Runnable
           JSObject scriptObject = null;
           try
           {
-            scriptObject = JSObject.getWindow(jvlite.applet);
+            scriptObject = JSObject.getWindow(jvlite);
           } catch (Exception ex)
           {
           }
           ;
           if (scriptObject != null)
           {
+            if (jvlite.debug && dbgMsg != null)
+            {
+              System.err.println(dbgMsg);
+            }
             scriptObject.call(_listener, objects);
           }
         } catch (Exception jex)