java.lang.reflect.Method setvar = gcClass.getMethod("setVariable",
new Class[] { String.class, Object.class });
java.lang.reflect.Method run = gcClass.getMethod("run");
- Object gc = gccons.newInstance();
- setvar.invoke(gc, new Object[] { "Jalview", this });
- run.invoke(gc);
+ groovyConsole = gccons.newInstance();
+ setvar.invoke(groovyConsole, new Object[] { "Jalview", this });
+ run.invoke(groovyConsole);
+ /*
+ * and rebuild alignframe menus to enable 'Run Groovy'
+ */
+
+ AlignFrame[] alignFrames = getAlignFrames();
+ if (alignFrames != null)
+ {
+ for (AlignFrame af : alignFrames)
+ {
+ af.setGroovyEnabled(true);
+ }
+ }
} catch (Exception ex)
{
jalview.bin.Cache.log.error("Groovy Shell Creation failed.", ex);
*/
private java.util.concurrent.Semaphore block = new Semaphore(0);
+ /*
+ * groovy.ui.Console object - if Groovy jars are present and the
+ * user has activated the Groovy console. Use via reflection to
+ * avoid compile-time dependency on Groovy libraries.
+ */
+ private static Object groovyConsole;
+
/**
* add another dialog thread to the queue
*
Desktop.currentAlignFrame = currentAlignFrame;
}
+ public Object getGroovyConsole()
+ {
+ return groovyConsole;
+ }
+
}