Examples of ImporterTopLevel


Examples of org.mozilla.javascript.ImporterTopLevel

        super.initialize(mgr, lang, declaredBeans);

        // Initialize context and global scope object
        try {
            Context cx = Context.enter();
            global = new ImporterTopLevel(cx);
            Scriptable bsf = Context.toObject(new BSFFunctions(mgr, this), global);
            global.put("bsf", global, bsf);

            for(
                @SuppressWarnings("unchecked")
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

        Context cx = Context.enter();
        cx.setOptimizationLevel(-1);

        try {

            ScriptableObject scope = new ImporterTopLevel(cx);

            // evaluate stencil set and beautifier
            cx.evaluateString(scope, stencilsetScript, "<cmd>", 1, null);
            cx.evaluateString(scope, beautifierScript, "<cmd>", 1, null);

            // run beautifier on stencil set
            String result = (String) ScriptableObject.callMethod(scope, "beautify", new Object[] { scope.get("set", scope) });

            System.out.println(result.toString());

        } finally {
            Context.exit();
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

        try {
            if (cl != null) {
     // TODO: broken with the way the tuscany launcher now uses class loaders
     //           cx.setApplicationClassLoader(cl);
            }
            this.scriptScope = new ImporterTopLevel(cx, true);
            Script compiledScript = cx.compileString(scriptCode, fileName, 1, null);
            compiledScript.exec(cx, scriptScope);
            addContexts(scriptScope, context);

        } finally {
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

                /* 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;
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

       
    }
    private Scriptable getScope(XScriptContext xsctxt )
    {
        Context ctxt = Context.enter();
        ImporterTopLevel scope = new ImporterTopLevel(ctxt);

        Scriptable jsCtxt = Context.toObject(xsctxt, scope);
        scope.put("XSCRIPTCONTEXT", scope, jsCtxt);

        Scriptable jsArgs = Context.toObject(
           new Object[0], scope);
        scope.put("ARGUMENTS", scope, jsArgs);

        Context.exit();
        return scope;
    }
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

    }

    public void initialize() throws Exception {
        Context context = Context.enter();
        try {
            global = new ImporterTopLevel(context);
            global.put("page", global, Context.toObject(this, global));
            global.put("logger", global, Context.toObject(getLogger(), global));
            global.put("xspAttr", global, Context.toObject(new AttributesImpl(), global));

            context.setOptimizationLevel(-1);
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

                /* 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;
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

                /* 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;
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

       
    }
    private Scriptable getScope(XScriptContext xsctxt )
    {
        Context ctxt = Context.enter();
        ImporterTopLevel scope = new ImporterTopLevel(ctxt);

        Scriptable jsCtxt = Context.toObject(xsctxt, scope);
        scope.put("XSCRIPTCONTEXT", scope, jsCtxt);

        Scriptable jsArgs = Context.toObject(
           new Object[0], scope);
        scope.put("ARGUMENTS", scope, jsArgs);

        Context.exit();
        return scope;
    }
View Full Code Here

Examples of org.mozilla.javascript.ImporterTopLevel

    private ImporterTopLevel scope;
    private JsFunctionLoad scriptExecutor;

    public GalenJsExecutor() {
        this.context = Context.enter();
        this.scope = new ImporterTopLevel(context);
       
        this.scriptExecutor = new JsFunctionLoad();
        scope.defineProperty("load", scriptExecutor, ScriptableObject.DONTENUM);
        importAllMajorClasses();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.