Examples of evaluateString()


Examples of org.mozilla.javascript.Context.evaluateString()

        final PrintWriter pw = new PrintWriter(sw, true);
        ScriptableObject.putProperty(scope, "out", Context.javaToJS(pw, scope));
        final int lineNumber = 1;
        final Object securityDomain = null;
        try {
            rhinoContext.evaluateString(
                scope,
                jsCode,
                getClass().getSimpleName(),
                    lineNumber,
                    securityDomain);
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

      else if (sel.equals("System.err"))
        out = System.err;
      Object simStatus = app.find(myUi, "simStatus");
      try {
        ScriptableObject scope = cx.initStandardObjects();
        cx.evaluateString(scope, script, "<cmd>", 1, null);
        if (similarity != null) similarity.destroy();
        similarity = new CustomSimilarity(cx, scope, out);
        app.setCustomSimilarity(similarity);
        app.setString(simStatus, "text", "OK");
        app.setColor(simStatus, "foreground", Color.green);
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

                  .append("lessToCss('")
                  .append(escape(less))
                  .append("');")
                  .toString();

         Object result = context.evaluateString(scope, script, this.getClass().getSimpleName(), 1, null);

         if (result != null) {
            return result.toString();
         }
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

        final StringWriter sw = new StringWriter();
        final PrintWriter pw = new PrintWriter(sw, true);
        ScriptableObject.putProperty(scope, "out", Context.javaToJS(pw, scope));
        final int lineNumber = 1;
        final Object securityDomain = null;
        rhinoContext.evaluateString(scope, jsCode, getClass().getSimpleName(),
                lineNumber, securityDomain);

        // check script output
        pw.flush();
        final String result = sw.toString().trim();
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

      // now evaluate the condition using JavaScript
      Context cx = Context.enter();
      try {
          Scriptable scope = cx.initStandardObjects(null);
          Object cxResultObject =
            cx.evaluateString(scope, cond
          /*** conditionString ***/
          , "<cmd>", 1, null);
          resultStr = Context.toString(cxResultObject);

          if (resultStr.equals("false")) {
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

        try {
            Scriptable compileScope = context.newObject(globalScope);
            compileScope.setParentScope(globalScope);
            compileScope.put("coffeeScriptSource", compileScope, coffeeScriptSource);
            try {
                return (String)context.evaluateString(compileScope, String.format("CoffeeScript.compile(coffeeScriptSource, %s);", options.toJavaScript()),
                        "JCoffeeScriptCompiler", 0, null);
            } catch (JavaScriptException e) {
                throw new CoffeeScriptCompileException(e);
            }
        } finally {
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

        for (Map.Entry<String, Object> entry : args.entrySet()) {
            ScriptableObject.putProperty(scope, entry.getKey(),
                    Context.javaToJS(entry.getValue(), scope));
        }
        try {
            return cx.evaluateString(scope, script, filename, 1, null);
        } catch (Error e) {
            throw new ScriptException(e.getMessage());
        } catch (RhinoException e) {
            if (e instanceof WrappedException) {
                Throwable cause = e.getCause();
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

                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;
            }
            catch (JavaScriptException jse) {
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

      // now evaluate the condition using JavaScript
      Context cx = Context.enter();
      try {
          Scriptable scope = cx.initStandardObjects(null);
          Object cxResultObject =
            cx.evaluateString(scope, getCondition()
          /*** conditionString ***/
          , "<cmd>", 1, null);
          resultStr = Context.toString(cxResultObject);

          if (resultStr.equals("false")) {
View Full Code Here

Examples of org.mozilla.javascript.Context.evaluateString()

        Context cx = Context.enter();
        try
        {

            Scriptable scope = cx.initStandardObjects(null);
            Object result = cx.evaluateString(scope, script, "<cmd>", 1, null);

            resultStr = Context.toString(result);
            vars.put(varName, resultStr);

        }
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.