Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-core-dev] Programmatically getting the ICompilationUnit object for a .java file


Eclipse Questions-2 wrote:
> 
>    I have ICompilationUnit object for the implementation, i.e., A. How do
> I get the ICompilationUnit for B programmatically. 
>   A and B are in seperate packages.
>  

You can get the types (ITypes) contained in the ICompilationUnit using
getTypes(). From there, you can create a typehierarchy and navigate to the
supertype (see ITypeHierarchy). On the obtained supertype (again an IType
instance), you can do getCompilationUnit().

That should work.
-- 
View this message in context: http://www.nabble.com/Programmatically-getting-the-ICompilationUnit-object-for-a-.java-file-tf4442028.html#a12674012
Sent from the Eclipse JDT - core mailing list archive at Nabble.com.



Back to the top