Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Get Class Info from an IJavaElement or IFile
Get Class Info from an IJavaElement or IFile [message #6514] Sat, 26 April 2003 18:31 Go to next message
Eclipse UserFriend
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 #6574 is a reply to message #6514] Sun, 27 April 2003 11:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: linnet.nospam.users.sourceforge.net

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
Re: Get Class Info from an IJavaElement or IFile [message #9185 is a reply to message #6574] Tue, 29 April 2003 19:01 Go to previous message
Eclipse UserFriend
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
Previous Topic:rebuild all button on tool bar
Next Topic:"Create a new Junit Test Case" dialog -- nothing happens, pls help
Goto Forum:
  


Current Time: Sat Jun 07 11:32:43 EDT 2025

Powered by FUDForum. Page generated in 0.02553 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top