Search code examples
javaeclipseeclipse-pdeeclipse-plugin

Get IResources methods in eclipse development?


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


Solution

  • 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.