[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: Rendering of CompilationUnit
|
Hi Jerome,
okay, I have to change the IBuffer of the ICompilationUnit. But how can I
render the CompilationUnit of the org.eclipse.jdt.core.dom package
(nothing to do with the ICompilationUnit) into that buffer?
Gregor
Jerome Lanneluc wrote:
> 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