简体   繁体   中英

Eclipse IFile (get java class methods)

I am developing an Eclipse plugin in which I need to retrieve the method's names or simply the classes from any kind of Java Project in Eclipse. The idea is to create a single object to access to every part of the project (IProject extension).

For instance:

public class MyProjectClass extends IProject{
   ...
   /* get all the java classes from the given project */
   public List<IProject> getJavaClasses(IProject p){}
   /* get all the methods from the given class */
   public List<?> getMethodsNames(AnyClass c){}
   ...
}

I have achieve to get every IFile from any IProject up to now. I need help with the next step.

Is it possible? Do I need to make a parser to get the methods? Must be something like creating the Eclipse's Outline view (where there are a description of every method of the selected class).

I believe JDT is what you are looking for. Please keep in mind JDT may require to have proper Java poject nature on your projects. The code snippet has an example how to get methods from a project/compilation unit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM