title: Eclipse JDT AST: How to write generated AST to java file?
body: <p>I am currently working with eclipse AST to generate source code. Other than in most examples, I am generating the source code from scratch and in a stand-alone application, as opposed to an eclipse plug-in.</p>
  
  <p>When read in from an ASTParser, you can activate modifications by calling <code>recordModifications()</code>, but this doesn't work when the AST is created from scratch, e.g. by calling <code>newCompilationUnit()</code>. </p>
  
  <p>Consequently, writing the source to file via a <code>Document</code> and <code>TextEdit</code> is not possible - there is an exception saying that modification recording hasn't been enabled.<br>
  Any experiences in generating AST from scratch and writing to file?
  Thanks!</p>