1
votes

I need get all the methods from a java project on Eclipse, so I wanna use IType#getMethods() to do this. But, for this, in my code, I need to use the IJavaProject#findType() to instanciate an IType class. This way, I am having trouble to know which parameter pass to the IJavaProject#findType() to specify that I want get methods. How can I do this? The code follow below.

public void getAllMethods(ExecutionEvent event) throws CoreException{

TreeSelection selection = (TreeSelection)HandlerUtil.getCurrentSelection(event);
IJavaElement je = (IJavaElement)selection.getFirstElement();
IJavaProject jproj = je.getJavaProject();
IProject p = (IProject)jproj.getResource();
IJavaProject javaProject = JavaCore.create(p);

IType itype = javaProject.findType(""); //which parameter to pass here?
IMethod[] allMethods = itype.getMethods();

for(int i=0; i<allMethods.length;i++)
        System.out.println(allMethods[i].getElementName());
}
1

1 Answers

0
votes

Basically, you can pass the fully qualified name of the class. For this and the other overloading signatures, see the documentation here