Hi, it is right that the extension facade hides this but a look into its code shows that something like this can done:
import org.eclipse.internal.xtend.xtend.ast.Extension;
import org.eclipse.xtend.expression.ExecutionContext;
import org.eclipse.xtend.expression.ExecutionContextImpl;
import org.eclipse.xtend.expression.Resource;
import org.eclipse.xtend.expression.TypeSystemImpl;
import org.eclipse.xtend.type.impl.java.JavaBeansMetaModel;
public class Main {
public static void main(String[] args) {
ExecutionContext executionContext = createExecutionContext("template::test");
((ExecutionContextImpl)executionContext).registerMetaModel(new JavaBeansMetaModel());
for (Extension e : executionContext.getAllExtensions()) {
System.out.println(e);
}
}
private static ExecutionContext createExecutionContext(final String... extensions) {
ExecutionContext executionContext = new ExecutionContextImpl(new TypeSystemImpl());
executionContext = executionContext.cloneWithResource(new Resource() {
public String getFullyQualifiedName() {
return null;
}
public void setFullyQualifiedName(final String fqn) {
}
public String[] getImportedNamespaces() {
return null;
}
public String[] getImportedExtensions() {
return extensions;
}
});
return executionContext;
}
}
This prints all extensions in the given extension file.
This might solve your problem although i do not understand your usecase.
Regards
Christian
[Updated on: Thu, 08 July 2010 06:21] by Moderator