Package org.mozilla.javascript

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(Iterator it = declaredBeans.iterator(); it.hasNext();) {
                declareBean((BSFDeclaredBean) it.next());
View Full Code Here


        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(Iterator it = declaredBeans.iterator(); it.hasNext();) {
              declareBean((BSFDeclaredBean) it.next());
View Full Code Here

                });
            Context.addContextListener(sdb);
            sdb.setScopeProvider(new ScopeProvider() {
                    public Scriptable getScope() {
                        Context ctxt = Context.enter();
                        ImporterTopLevel scope = new ImporterTopLevel(ctxt);
                        Scriptable jsArgs = Context.toObject(xsctxt, scope);
                        scope.put("XSCRIPTCONTEXT", scope, jsArgs);
                        Context.exit();
                        return scope;
                    }
                });
            return sdb;
View Full Code Here

                /* 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

       
    }
    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

        return getContext().newArray(scope, (int)size);
    }

    public JsScriptEngine() {
        Context context = getContext();
        scope = new ImporterTopLevel(context); // so that we can use importPackage()
        context.evaluateString(scope, printSource, "print", 1, null); // so that we can print on std out

    }
View Full Code Here

    public ButterflyScope(ButterflyModule module, Context context) throws Exception {
      _logger.trace("> new ButterflyScope for module: {}", module.getName());
     
        // first, get a juicy top level scope that contains all the ECMA
        // objects and some Java related utility methods that Rhino provides
        Scriptable scope = new ImporterTopLevel(context);
       
        // make the "ButteflyModule" object available to this scope
        defineClass(scope, ScriptableButterfly.class);

        // and set this scope as our prototype
View Full Code Here

        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

    public RhinoInterpreter() {
        // entering a context
        context = Context.enter();
        try {
            // init std object with an importer
            ImporterTopLevel importer = new ImporterTopLevel();
            globalObject = (ScriptableObject)context.initStandardObjects(importer);
            // import Java lang package & DOM Level 2 & SVG DOM packages
            NativeJavaPackage[] p= new NativeJavaPackage[TO_BE_IMPORTED.length];
            for (int i = 0; i < TO_BE_IMPORTED.length; i++) {
                p[i] = new NativeJavaPackage(TO_BE_IMPORTED[i]);
            }
            importer.importPackage(context, globalObject, p, null);
            context.setWrapHandler(new EventTargetWrapHandler(this));
        } finally {
            Context.exit();
        }
    }
View Full Code Here

        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

TOP

Related Classes of org.mozilla.javascript.ImporterTopLevel

Copyright © 2018 www.massapicom. 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.