当前位置: 首页>>代码示例>>Java>>正文


Java Scriptable.setParentScope方法代码示例

本文整理汇总了Java中org.mozilla.javascript.Scriptable.setParentScope方法的典型用法代码示例。如果您正苦于以下问题:Java Scriptable.setParentScope方法的具体用法?Java Scriptable.setParentScope怎么用?Java Scriptable.setParentScope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.mozilla.javascript.Scriptable的用法示例。


在下文中一共展示了Scriptable.setParentScope方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import org.mozilla.javascript.Scriptable; //导入方法依赖的package包/类
@Override
public boolean execute(Context javascriptContext, Scriptable scope) throws EngineException {
	if (isEnabled()) {
		if (super.execute(javascriptContext, scope)) {
			for (FunctionStatement function : getFunctions()) {
				if (function.getName().equals(functionName)) {
					Scriptable curScope = javascriptContext.initStandardObjects();
					curScope.setParentScope(scope);
					boolean ret = function.execute(javascriptContext, curScope);
					Object returnedValue = function.getReturnedValue();
					if (returnedValue != null) {
						ReturnStatement.returnLoop(this.parent, returnedValue);
					}
					return ret;
				}
			}
		}
	}
	return false;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:21,代码来源:CallFunctionStatement.java

示例2: addCandidate

import org.mozilla.javascript.Scriptable; //导入方法依赖的package包/类
private void addCandidate(Context js_context, JSONArray result) {
	if (candidate != null) {
		if (js_filter != null) {
			try {
				Scriptable scope = js_context.initStandardObjects(null, true);
				scope.put("category", scope, candidate.getString(0));
				scope.put("time", scope, candidate.getString(1));
				scope.put("level", scope, candidate.getString(2));
				scope.put("thread", scope, candidate.getString(3));
				scope.put("message", scope, candidate.getString(4));
				StringBuffer extra = new StringBuffer();
				for (int i = 5; i < candidate.length(); i++) {
					String sub_extra = candidate.getString(i);
					extra.append(sub_extra).append(' ');
					delim_extra.reset(sub_extra);
					if (delim_extra.matches() && delim_extra.groupCount() == 2) {
						scope.put(delim_extra.group(1), scope, delim_extra.group(2));
					}
				}
				if (extra.length() > 0) {
					scope.put("extra", scope, extra.substring(0, extra.length() - 1));
				}
				scope.setParentScope(js_utils);
				if (Context.toBoolean(js_filter.exec(js_context, scope))) {
					result.put(candidate);
				}
			} catch (Exception e) {
				// TODO: handle exception
			}
		} else {
			result.put(candidate);
		}
		candidate = null;
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:36,代码来源:LogManager.java

示例3: invokeNextStep

import org.mozilla.javascript.Scriptable; //导入方法依赖的package包/类
protected void invokeNextStep(Step step, Context javascriptContext, Scriptable scope) throws EngineException {
	Step stepToInvoke = getStepCopyToInvoke(step);
   	if (stepToInvoke != null) {
   		// Stack scope
   		// Note: variable must be declared with the 'var' keyword
   		Scriptable curScope = javascriptContext.initStandardObjects();
  			curScope.setParentScope(scope);
  			invokeStep(stepToInvoke, javascriptContext, curScope);
   	}
	currentChildStep++;
	
	performSynchronisation();
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:14,代码来源:StepWithExpressions.java

示例4: run

import org.mozilla.javascript.Scriptable; //导入方法依赖的package包/类
public void run() {
    Context context = factory.enterContext();
    try {
        // Run each script in its own scope, to keep global variables
        // defined in each script separate
        Scriptable threadScope = context.newObject(globalScope);
        threadScope.setPrototype(globalScope);
        threadScope.setParentScope(null);
        script.exec(context, threadScope);
    } catch (Exception ee) {
        ee.printStackTrace();
    } finally {
        Context.exit();
    }
}
 
开发者ID:middle2tw,项目名称:whackpad,代码行数:16,代码来源:Bug421071Test.java


注:本文中的org.mozilla.javascript.Scriptable.setParentScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。