use of org.eclipse.xtend.expression.ExecutionContext in project xtext-core by eclipse.
the class XtendXtext2EcorePostProcessor method process.
@Override
public void process(GeneratedMetamodel metamodel) {
Resource xtendFile = loadXtendFile(metamodel);
if (xtendFile != null) {
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);
}
}
}
Aggregations