[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Rendering of CompilationUnit

Gregor,

See IOpenable.getBuffer() and IOpenable.save(...). The idea is that you
modify the ICompilation's buffer and save it to disk when you're done.

HTH,
Jerome

Gregor Frey wrote:
> 
> Hi,
> I'm seaking a way to render the content of a CompilationUnit from the
> org.eclipse.jdt.core.dom package. Is there a way to transform it in pretty
> source code?
> I got the CompilationUnit with the AST-parser, changed it a bit and wanted
> to write it back to the original IJavaElement. But I can not find a way to
> do that.
> Can anyone help?
> 
>         SourceType source = ... // coming from somewhere
>         ICompilationUnit iUnit = source.getCompilationUnit();
>         CompilationUnit unit = AST.parseCompilationUnit(iUnit, false);
>         ... // working on unit
>         // unit -> source
> 
> Thanks,
> Gregor