[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: Getting an ICompilationUnit from a CompilationUnit?
|
> I believe this will work even when the method in question is defined
> in another compilation unit (.java file). True?
i don't think so
i think your code finds the declaration only if it's inside the same CU node as the invocation.
> I now need to create a CompilationUnitChange for the changes I want
> to make to the method's definition. How can I do that?
you can get the ICompilationUnit by doing what we do in
Binding2JavaModel.findCompilationUnit
(you'll need to feed it with methodBinding.getDeclaringClass())
and then, you can create your CompilationUnitChange
btw. use ASTRewrite - it's easier than creating the edits yourself
hth
a.
-----------
eclipse.org
-----------