GenModel genModel = (GenModel) resource.getContents().get(0);
genModel.setForceOverwrite(true);
genModel.setCanGenerate(true);
genModel.reconcile();
Generator generator = new Generator();
generator.getAdapterFactoryDescriptorRegistry().addDescriptor(GenModelPackage.eNS_URI,
new GeneratorAdapterFactory.Descriptor() {
public GeneratorAdapterFactory createAdapterFactory() {
return new GenModelGeneratorAdapterFactory() {
@Override
public Adapter createGenClassAdapter() {
return new GenClassGeneratorAdapter(this) {
@Override
protected OutputStream createOutputStream(URI workspacePath) throws Exception {
return new LineFilterOutputStream(getURIConverter().createOutputStream(workspacePath),
" * $Id" + "$");
}
@Override
protected URI toURI(String pathName) {
return URI.createFileURI(uri);
}
};
}
@Override
public Adapter createGenPackageAdapter() {
return new GenPackageGeneratorAdapter(this) {
@Override
protected URI toURI(String pathName) {
return URI.createFileURI(uri);
}
@Override
protected OutputStream createOutputStream(URI workspacePath) throws Exception {
return new LineFilterOutputStream(getURIConverter().createOutputStream(workspacePath),
" * $Id" + "$");
}
};
}
};
}
});
generator.setInput(genModel);
Diagnostic diagnostic = generator.generate(genModel, GenBaseGeneratorAdapter.MODEL_PROJECT_TYPE,
new BasicMonitor());
if (diagnostic.getSeverity() != Diagnostic.OK)
System.err.println(diagnostic);
} catch (Throwable t) {