Ido
Ido

Reputation: 255

Plugin: how to get all the types available in my eclipse Workspace?

I'm writing an eclipse plugin, and I want to get all the types that are available in my workspace,
like when pressing Ctrl+Shift+T,
but in a list or array.

How can I do it?

Upvotes: 3

Views: 406

Answers (1)

Rich Seller
Rich Seller

Reputation: 84038

The relevant code is referenced from the org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog (which the OpenTypeSelectionDialog triggered by ctrl-shift-T inherits from).

If you inspect the fillContentProvider() method you'll see it the org.eclipse.jdt.core.search.SearchEngine, which is passed a TypeSearchRequestor and TypeItemsFilter to match the required types.

If you look at the Javadoc for SearchEngine.searchAllTypeNames() and/or debug its execution, you should have a pretty clear idea how to obtain the workspace types into a requestor, and process them accordingly.

Upvotes: 1

Related Questions