How to determine the absolute path to the Java source file file in the Eclipse plugin?

In my custom Eclipse plugin, I have the fully qualified class name of the Java class as String and you want to know its actual path to the file. In fact, I want to know the name of the source folder in which it is located.

A class can be from any of the Java projects in the workspace. The names of the source folders are arbitrary.

I am using Eclipse 3.6.

Thank!

+5
source share
2 answers

You will have to use the search engine API. See org.eclipse.jdt.core.search.SearchEngine.

, , , . org.eclipse.jdt.core.search.SearchPattern, ( ) (-, ).

, , IType s, API Java. IType.getResource().getLocation(), . getResource null, .

+2

JDT API, IResource Java. Resource API , .

+2

All Articles