Package de.innovationgate.ext.org.mozilla.javascript

Examples of de.innovationgate.ext.org.mozilla.javascript.Function


        // Preserve thread locals
        ThreadLocalPreserver preserver = new ThreadLocalPreserver((RhinoContext) cx);
        preserver.preserve(RhinoExpressionEngine.TL_ACTIONDEFINITION, action);
        preserver.preserve(RhinoExpressionEngine.TL_SCRIPTNAME, "TMLScript-Object " + action.getModuleDatabase() + "/" + action.getModuleName());;
        try {
            Function func = runtime.getCompiledFunction(action.getCode(), (RhinoContext) cx, redirector);
            func.put(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, func, action);
            return func;
        }
        finally {
            preserver.restore();
        }
View Full Code Here


        VarArgParser.Arguments parsedArgs = _createObjectVarargs.parse(args);

        // Retrieve object definition, either as script or as Function object
        Object definition = parsedArgs.get("definition");
        Function func;
        if (definition instanceof Function) {
            func = (Function) args[0];
        }
        else {
            func = loadObjectDefinition(cx, thisObj, args, funObj);
        }

        // Construct the object
        Scriptable obj = func.construct(cx, thisObj, new Object[] {});
        Scriptable topLevelScope = ScriptableObject.getTopLevelScope(thisObj);

        // Put the action definition to the object, so it "knows" where it's
        // definition came from
        TMLAction action = (TMLAction) func.get(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, func);
        if (action != null) {
            obj.put(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, obj, action);
        }

        // Execute constructor
View Full Code Here

    public static Object runFunction(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) {
        try {
            RhinoExpressionEngineImpl runtime = WGAGlobal.fetchRuntime(cx);
            VarArgParser.Arguments parsedArgs = _runMasterFunctionVarargs.parse(args);
           
            Function function = (Function) parsedArgs.get("function");
            TMLContext context = (TMLContext) parsedArgs.get("context");
            if (context == null) {
                context = WGAGlobal.fetchInitialContext(Context.getCurrentContext());
            }
           
View Full Code Here

    public static Object runMethod(Context cx, Scriptable thisObj, java.lang.Object[] args, Function funObj) {
        try {
            RhinoExpressionEngineImpl runtime = WGAGlobal.fetchRuntime(cx);
            VarArgParser.Arguments parsedArgs = _runMasterMethodVarargs.parse(args);
           
            Function function = (Function) parsedArgs.get("function");
            Object returnValue = runtime.runAsMaster(function, null, parsedArgs.getOverflowArgs().toArray());
            if (returnValue != null) {
                return Context.javaToJS(returnValue, thisObj);
            }
            else {
View Full Code Here

        VarArgParser.Arguments parsedArgs = WGAGlobal._createObjectVarargs.parse(args);

        // Retrieve object definition, either as script or as Function object
        Object definition = parsedArgs.get("definition");
        Function func;
        if (definition instanceof Function) {
            func = (Function) args[0];
        }
        else {
            func = loadObjectDefinition(cx, design, args, funObj);
        }

        // Construct the object
        Scriptable obj = func.construct(cx, thisObj, new Object[] {});
        Scriptable topLevelScope = ScriptableObject.getTopLevelScope(thisObj);

        // Put the action definition to the object, so it "knows" where it's
        // definition came from
        TMLAction action = (TMLAction) func.get(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, func);
        if (action != null) {
            obj.put(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, obj, action);
        }

        // Execute constructor
View Full Code Here

        // Preserve thread locals
        ThreadLocalPreserver preserver = new ThreadLocalPreserver((RhinoContext) cx);
        preserver.preserve(RhinoExpressionEngine.TL_ACTIONDEFINITION, action);
        preserver.preserve(RhinoExpressionEngine.TL_SCRIPTNAME, "TMLScript-Object " + action.getModuleDatabase() + "/" + action.getModuleName());;
        try {
            Function func = runtime.getCompiledFunction(action.getCode(), (RhinoContext) cx, redirector);
            func.put(RhinoExpressionEngine.PARAM_ACTIONDEFINITION, func, action);
            return func;
        }
        finally {
            preserver.restore();
        }
View Full Code Here

TOP

Related Classes of de.innovationgate.ext.org.mozilla.javascript.Function

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.