tags:

views:

54

answers:

2

When I search for classes I can only find by fully qualified class name. How does eclipse find classes when I do Ctrl-Shift-O? This is for a eclipse plugin.

+1  A: 

Look at the fully qualified class names, filter by which ones match the unqualified class name you've given, and if there is more than one prompt the user to refine the choice. I've been out of the loop of Eclipse development for too long to remember if there's a library function for this but it's pretty simple to write yourself.

Mark Peters
+2  A: 

Note that Eclipse builds an index for all classes in projects (source folders and libraries), and the searches are against this index. The regular Java classloader does not have this kind of functionality (it only does lookup by full name).

Since you are doing this for an Eclipse plugin, have a look at the source for the search function in the Java tooling. There should be an API you can reuse.

Thilo