org.eclipse.xtend.expression.ExecutionContext Java Examples

The following examples show how to use org.eclipse.xtend.expression.ExecutionContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XtendXtext2EcorePostProcessor.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
@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);
		}
	}
}
 
Example #2
Source File: CompilationContext.java    From dsl-devkit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * 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();
}
 
Example #3
Source File: CompilationContext.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: CompilationContext.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns the execution context used by this compilation context.
 *
 * @return execution context
 */
public ExecutionContext getExecutionContext() {
  return context;
}