Get Class Info from an IJavaElement or IFile [message #6514] |
Sat, 26 April 2003 18:31  |
Eclipse User |
|
|
|
Originally posted by: bruno.lopes.tagus.ist.utl.pt
I'm trying to make a plugin to help me make Jetspeed portlets and I'd
like to start by checking every file on a project, see if it extended a
class that I know is a portlet and then add it to jetspeed's xml registry.
Currently I'm stumped on how to get the Class that is implemented on a
file. So far i've tried with a CompilationUnit from
AST.parseCompilationUnit and with a IJavaElement created from
JavaCore.create, but haven't found the information I wanted.
Can anyone shine some light on this?
TIA
Bruno Lopes
|
|
|
|
Re: Get Class Info from an IJavaElement or IFile [message #9185 is a reply to message #6574] |
Tue, 29 April 2003 19:01  |
Eclipse User |
|
|
|
Originally posted by: bruno.lopes.tagus.ist.utl.pt
Jesper Kamstrup Linnet wrote:
> Bruno Lopes wrote:
>
>> I'm trying to make a plugin to help me make Jetspeed portlets and I'd
>> like to start by checking every file on a project, see if it extended
>> a class that I know is a portlet and then add it to jetspeed's xml
>> registry.
>> Currently I'm stumped on how to get the Class that is implemented on a
>> file. So far i've tried with a CompilationUnit from
>> AST.parseCompilationUnit and with a IJavaElement created from
>> JavaCore.create, but haven't found the information I wanted.
>> Can anyone shine some light on this?
>>
>> TIA
>>
>> Bruno Lopes
>>
>
> If you have an IType, you can ask for the name of its superclass with
> getSuperclassName() or interface names with getSuperInterfaceNames(). If
> you need to be able to traverse the type hierarchy, you should obtain
> the type hierarchy (ITypeHierarchy) with IType.newSupertypeHierarchy().
>
> The IType you can obtain using ICompilationUnit.getType (or one of the
> similar methods on ICompilationUnit).
>
> This is one way to do it. I don't know if it's the best.
>
> HTH,
>
> Jesper
>
Yap, that solved my conundrum quite nicely, thx for the help
Bruno Lopes
|
|
|
Powered by
FUDForum. Page generated in 0.02553 seconds