Package org.mozilla.javascript

Examples of org.mozilla.javascript.Scriptable


      contents = options + "\n\n" + contents;

      scope.put("contents", scope, contents);
      context.evaluateString(scope, "results = JSLINT(contents, null);", "JSLint", 1, null);
     
      Scriptable lint = (Scriptable) scope.get("JSLINT", scope);
      NativeArray errors = (NativeArray) lint.get("errors", null);
      clearMarkers(file);
      for (int i = 0; i < errors.getLength(); i++) {
        NativeObject error = (NativeObject) errors.get(i, null);
        if(error == null) continue;
        Double lineNo = ((Double) error.get("line", null)) - 2;
View Full Code Here


    }

    initContext();

    String contents = "";
    Scriptable options = null;
    Map<String, Object> prefs = new HashMap<String, Object>();
    try {
      contents = getFileContents(file.getContents());
      prefs = getPreferences();
     
      options = context.newObject(scope);
     
      scope.put("contents", scope, contents);
     
      for(String key : prefs.keySet()) {
        options.put(key, options, prefs.get(key));
      }
     
      scope.put("opts", scope, options);
     
      context.evaluateString(scope, "result = js_beautify(contents, opts);",
View Full Code Here

      "/html/lib/treeTTL.js",
      "/html/lib/emitter.js");
           
    try {
      Context cx = ContextFactory.getGlobal().enterContext();
      Scriptable scope = cx.initStandardObjects();
      Object wrappedOut = Context.javaToJS(System.out, scope);
      ScriptableObject.putProperty(scope, "out", wrappedOut);

      Object result = null;
     
View Full Code Here

      "/html/lib/treeTTL.js",
      "/html/lib/emitter.js");
           
    try {
      Context cx = ContextFactory.getGlobal().enterContext();
      Scriptable scope = cx.initStandardObjects();
      Object wrappedOut = Context.javaToJS(System.out, scope);
      ScriptableObject.putProperty(scope, "out", wrappedOut);

      Object result = null;
     
View Full Code Here

        "/html/lib/treeTTL.js",
        "/html/lib/emitter.js");
             
      try {
        Context cx = ContextFactory.getGlobal().enterContext();
        Scriptable scope = cx.initStandardObjects();
        Object wrappedOut = Context.javaToJS(System.out, scope);
        ScriptableObject.putProperty(scope, "out", wrappedOut);

        Object result = null;
       
View Full Code Here

        "/html/lib/treeTTL.js",
        "/html/lib/emitter.js");
             
      try {
        Context cx = ContextFactory.getGlobal().enterContext();
        Scriptable scope = cx.initStandardObjects();
        Object wrappedOut = Context.javaToJS(System.out, scope);
        ScriptableObject.putProperty(scope, "out", wrappedOut);

        Object result = null;
       
View Full Code Here

     */
    public Object jsFunction_load( String filename )
        throws Exception {
        org.mozilla.javascript.Context cx =
            org.mozilla.javascript.Context.getCurrentContext();
        Scriptable scope = getParentScope();
        Script script = interpreter.compileScript( cx,
                                                   environment,
                                                   filename );
        return script.exec( cx, scope );
    }   
View Full Code Here

    Map<String, Parameter<?>> getParameterInfo() {
        Object metadataObj = scope.get("metadata", scope);
        Map<String, Object> jsParams = null;

        if (metadataObj instanceof Scriptable) {
            Scriptable metadata = (Scriptable) metadataObj;
            Object nativeParamsObj = metadata.get("inputs", metadata);
            if (nativeParamsObj instanceof Scriptable)
                jsParams = jsObjectToMap((Scriptable)nativeParamsObj);
        }
       
        if (jsParams == null) {
View Full Code Here

    Map<String, Parameter<?>> getResultInfo() {
        Object metadataObj = scope.get("metadata", scope);
        Map<String, Object> jsParams = null;

        if (metadataObj instanceof Scriptable) {
            Scriptable metadata = (Scriptable) metadataObj;
            Object nativeParamsObj = metadata.get("outputs", metadata);
            if (nativeParamsObj instanceof Scriptable)
                jsParams = jsObjectToMap((Scriptable)nativeParamsObj);
        }
       
        if (jsParams == null) {
View Full Code Here

        return gtParams;
    }

    private static Scriptable mapToJsObject(Map<String,Object> map, Scriptable scope) {
        Context cx = Context.enter();
        Scriptable obj = cx.newObject(scope);
        try {
            for (Map.Entry<String,Object> entry : map.entrySet()) {
                ScriptableObject.putProperty(
                    obj,
                    entry.getKey(),
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.Scriptable

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.