Search code examples
javaeclipsepluginsworkspace

How can an Eclipse plugin access the project directory?


Is there a way to get the directory of a project in Eclipse? We are writing a plugin that will allow the user to select files, and then run some processes on those files. I would ideally like to be able to get all the files with a certain extension, but that is not necessary.


Solution

  • sure:

    ResourcesPlugin.getWorkspace().getRoot().getProjects()
    

    will get you a list of all the projects in the workspace. you can easily iterate to find the one you want. At that point, you can look for certain files by extensions, etc.