I have implemented a simple little DSL that generates classes from input files, by using the JvmModelInferrer approach. I am trying to figure out how I can invoke the parser and the code genarator within the code of a regular java project. So at some point in the main class of my non-Xtext project I can just create a file, pass it to the Xtext parser/codeGenerator for my DSL, and the result will be that class files are generated to a folder of my choice (within my java project). This case is not covered in the documentation, so any help would be much appreciated, Thanks!
UPDATE: My code so far looks like this:
private static IGenerator generator;
/**
* @param args
*/
public static void main(String[] args) {
// this line registers the EMF for our DSL
Injector injector = new HyRuleStandaloneSetup().createInjectorAndDoEMFRegistration();
ResourceSet rs = new ResourceSetImpl();
File file = new File(
"C:/Documents and Settings/chmamat2/runtime-EclipseXtext/hyrule.project/src/hyrule/project/main.hrule");
Resource resource = rs.getResource(URI.createURI(file.toURI().toString()), true);
//setup the generator
generator = injector.getInstance(IGenerator.class);
//setup the file system access
final EclipseResourceFileSystemAccess2 fsa = new EclipseResourceFileSystemAccess2();
generator.doGenerate(resource, fsa);