Package org.mozilla.javascript

Examples of org.mozilla.javascript.ContextAction


        type.error = null;
        if ("global".equals(prototype.getLowerCaseName())) {
            globalError = null;
        }

        contextFactory.call(new ContextAction() {
            public Object run(Context cx) {
                // loop through the prototype's code elements and evaluate them
                Iterator code = prototype.getCodeResources();
                while (code.hasNext()) {
                    evaluate(cx, type, (Resource) code.next());
View Full Code Here


     */
    public void injectCodeResource(String typename, final Resource code) {
        final TypeInfo type = (TypeInfo) prototypes.get(typename.toLowerCase());
        if (type == null || type.lastUpdate == -1)
            return;
        contextFactory.call(new ContextAction() {
            public Object run(Context cx) {
                evaluate(cx, type, code);
                return null;
            }
        });
View Full Code Here

     * @see org.directwebremoting.extend.Compressor#compressJavaScript(java.lang.String)
     */
    public String compressJavaScript(final String source) throws Exception
    {
        final Exception[] thrown = new Exception[1];
        String reply = (String) Main.shellContextFactory.call(new ContextAction()
        {
            public Object run(Context cx)
            {
                try
                {
View Full Code Here

            rhinoClassLoader = new RhinoClassLoader
                (documentURL, getClass().getClassLoader());
        } catch (SecurityException se) {
            rhinoClassLoader = null;
        }
        ContextAction initAction = new ContextAction() {
            public Object run(Context cx) {
                Scriptable scriptable = cx.initStandardObjects(null, false);
                defineGlobalWrapperClass(scriptable);
                globalObject = createGlobalObject(cx);
                ClassCache cache = ClassCache.get(globalObject);
View Full Code Here

     * value of the last expression evaluated in the script.
     */
    public Object evaluate(final Reader scriptReader, final String description)
        throws IOException {

        ContextAction evaluateAction = new ContextAction() {
            public Object run(Context cx) {
                try {
                    return cx.evaluateReader(globalObject,
                                             scriptReader,
                                             description,
View Full Code Here

     * @return if no exception is thrown during the call, should return the
     * value of the last expression evaluated in the script.
     */
    public Object evaluate(final String scriptStr) {

        ContextAction evalAction = new ContextAction() {
            public Object run(final Context cx) {
                Script script = null;
                Entry entry = null;
                Iterator it = compiledScripts.iterator();
                // between nlog(n) and log(n) because it is
View Full Code Here

     * the environment of the interpreter.
     * @param name the name of the script object to create
     * @param object the Java object
     */
    public void bindObject(final String name, final Object object) {
        contextFactory.call(new ContextAction() {
            public Object run(Context cx) {
                Object o = object;
                if (name.equals(BIND_NAME_WINDOW) && object instanceof Window) {
                    ((WindowWrapper) globalObject).window = (Window) object;
                    window = (Window) object;
View Full Code Here

    /**
     * To be used by <code>EventTargetWrapper</code>.
     */
    void callHandler(final Function handler, final Object arg) {
        contextFactory.call(new ContextAction() {
            public Object run(Context cx) {
                Object a = Context.toObject(arg, globalObject);
                Object[] args = { a };
                handler.call(cx, globalObject, globalObject, args);
                return null;
View Full Code Here

     * To be used by <code>WindowWrapper</code>.
     */
    void callMethod(final ScriptableObject obj,
                    final String methodName,
                    final ArgumentsBuilder ab) {
        contextFactory.call(new ContextAction() {
            public Object run(Context cx) {
                ScriptableObject.callMethod
                    (obj, methodName, ab.buildArguments());
                return null;
            }
View Full Code Here

    /**
     * To be used by <code>WindowWrapper</code>.
     */
    void callHandler(final Function handler, final Object[] args) {
        contextFactory.call(new ContextAction() {
            public Object run(Context cx) {
                handler.call(cx, globalObject, globalObject, args);
                return null;
            }
        });
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.ContextAction

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.