/* The ImporterTopLevel ensures that importClass and
importPackage statements work in Javascript scripts
Make the XScriptContext available as a global variable
to the script
*/
ImporterTopLevel scope = new ImporterTopLevel(ctxt);
Scriptable jsCtxt = Context.toObject(
ScriptContext.createContext(
m_xModel, m_xInvocContext, m_xContext,
m_xMultiComponentFactory), scope);
scope.put("XSCRIPTCONTEXT", scope, jsCtxt);
Scriptable jsArgs = Context.toObject(params, scope);
scope.put("ARGUMENTS", scope, jsArgs);
result = ctxt.evaluateString(scope,
source, "<stdin>", 1, null);
result = ctxt.toString(result);
return result;