Hi,
if you mean find the generated PatternGroup classes, then no, we have no such method. Actually, the generic pattern groups are created by calling this method in the registry (generated pattern groups have their matchers hardcoded).
The strange code is not a bug (it still does the correct thing), but rather a remaining fragment of caching pattern groups in a map and returning that when called multiple times. That approach was problematic since for a given FQN, we have the directly contained and the whole subtree to store.
I think you can safely remove the if-then-else structure, as this caching is not really needed, we can always put something like this back when required.
You can use the registry to get all patterns that are registered in the extension point registry (or if someone stealthily registered it). It does not use the target platform, so if you start a runtime Eclipse, in that the registry will contain patterns from the EMF-IncQuery projects included in the run configuration (I think that was what you said as well).
Finally, if you want to find pattern groups that are in the workspace, you can simply go through the Workspace and (1) look at each project and check for incquery nature, (2) look at the list of exported packages (3) in each non-util package there will be a single class that has the same name as an EIQ file.
I'll leave you all with that funny thought: what happens if you have a xymatch.eiq file with a xy named pattern inside?