- /*
- * The following code performs the GroovyScriptEngine invocation using
- * reflection, and is equivalent to this fragment from the embedding
- * groovy documentation on the groovy site: <code> import
- * groovy.lang.Binding; import groovy.util.GroovyScriptEngine;
- *
- * String[] roots = new String[] { "/my/groovy/script/path" };
- * GroovyScriptEngine gse = new GroovyScriptEngine(roots); Binding binding
- * = new Binding(); binding.setVariable("input", "world");
- * gse.run("hello.groovy", binding); </code>
- */
- Class[] bspec;
- Object[] binding;
- int blen = ((jalviewContext[0] == null) ? 0 : 1)
- + ((jalviewContext[1] == null) ? 0 : 1);
- String cnames[] = new String[]
- { "Jalview", "currentAlFrame" };
- bspec = new Class[blen * 2];
- binding = new Object[blen * 2];
- blen = 0;
- ClassLoader cl = null;
- Map vbinding = new Hashtable();
- for (int jc = 0; jc < jalviewContext.length; jc++)
+ Map<String, Object> vbinding = new HashMap<>();
+ vbinding.put("Jalview", this);
+ if (af != null)