I'm generating a plugin in Eclipse. My plugin generates source code in an open Editor so I would like to format the whole code (with JDT), just as if I pressed Ctrl+Shift+F.
I have found some information about different class such ICompilationUnit, CodeFormatter... but I don't have it clear because I have to take the code of the editor formatter and then I have to write in over the editor again.