I'm developing an eclipse plugin and need to list of IMethods that belong to an IResource.
I see IType has a getMethods function but not sure how to go about converting an IResource to an IType
Help appreciated
Nicky
I'm developing an eclipse plugin and need to list of IMethods that belong to an IResource.
I see IType has a getMethods function but not sure how to go about converting an IResource to an IType
Help appreciated
Nicky
I don't have a full solution, but some ideas:
For the basic idea I suggest looking at the tutorial page of Lars Vogel, more specifically Section 4, where it creates a menu item to the Project Navigator, that converts a Java file to HTML.
First step, get the ICompilationUnit
from the IResource
:
ICompilationUnit icu = (ICompilationUnit) JavaCore.create(resource);
Next, use either getTypes()
or getType(String)
to get your IType
.
IResource represents a file (or folder, or project) in the workspace. They can be C++, javascript or even image files. As the other repliers said, the IResource itself isn't the Java file; you need the ICompilationUnit.