In my custom Eclipse plugin, I have the fully qualified class name of a Java class as a String, and want to know its actual file path. In fact, I want to know the name of the source folder it resides in.
The class could be from any of the Java projects in the Workspace. The source folder names are arbitrary.
I use Eclipse 3.6.
Thanks!
You will have to use the search engine API. See
org.eclipse.jdt.core.search.SearchEngine.You can see that there are various static functions you can call, each with their own options. You will need to create an appropriate
org.eclipse.jdt.core.search.SearchPatternand then pass it to the search engine along with a scope (the workspace) and a requestor (something that gathers all of the results).Typically, you will get a bunch of stuff back, like
ITypes, which are the public API for accessing types in the Java model. You can callIType.getResource().getLocation()to get the filesystem location of any type. The getResource method may return null, so you need to check for that.