Java源码示例:org.eclipse.xtend.expression.ExecutionContext

示例1
@Override
public void process(GeneratedMetamodel metamodel) {
	Resource xtendFile = loadXtendFile(metamodel);
	if (xtendFile != null) {
		logger.warn("You are using an old xtend(1)-based IXtext2EcorePostProcessor. This features is deprecated and will be dropped in a future release of Xtext.");
		ExecutionContext ctx = getExecutionContext(metamodel);
		ctx = ctx.cloneWithResource(xtendFile);
		ResourceLoader currentThreadResourceLoader = null;
		try {
			currentThreadResourceLoader = getCurrentThreadResourceLoader();
			setCurrentThreadResourceLoader(getResourceLoader(metamodel));
			final Object[] params = new Object[] { metamodel };
			Extension extension = ctx.getExtension("process", params);
			if (extension != null) {
				extension.evaluate(params, ctx);
			}
		}
		catch (EvaluationException e) {
			logger.error("Error encountered processing metamodel " + metamodel.getName() + " with "
					+ xtendFile.getFullyQualifiedName(), e);
		}
		finally {
			setCurrentThreadResourceLoader(currentThreadResourceLoader);
		}
	}
}
 
示例2
/**
 * Creates a new compilation context for the given Xtend context, implicit variable name, and context type.
 *
 * @param context
 *          xtend context to wrap
 * @param implicitVar
 *          name of the Java variable to bind "this" to
 * @param contextType
 *          type of the Java variable to bind "this" to
 */
public CompilationContext(final ExecutionContext context, final GenModelUtilX genModelUtil, final String implicitVar, final Type contextType) {
  this.context = context;
  this.genModelUtil = genModelUtil;
  this.implicitVariable = implicitVar;
  this.implicitContextType = contextType != null ? contextType : context.getObjectType();
}
 
示例3
/**
 * Creates a new compilation context for the given Xtend context.
 *
 * @param context
 *          xtend context to wrap
 */
public CompilationContext(final ExecutionContext context, final GenModelUtilX genModelUtil) {
  this.context = context;
  this.genModelUtil = genModelUtil;
}
 
示例4
/**
 * Returns the execution context used by this compilation context.
 *
 * @return execution context
 */
public ExecutionContext getExecutionContext() {
  return context;
}