private static IJavaElement[] getFocusedElementsAndTypes(SearchPattern pattern, IJavaElement focusElement, ObjectVector superTypes) throws JavaModelException {
if (pattern instanceof MethodPattern) {
// For method pattern, it needs to walk along the focus type super hierarchy
// and add jars/projects of all the encountered types.
IType type = (IType) pattern.focus.getAncestor(IJavaElement.TYPE);
MethodPattern methodPattern = (MethodPattern) pattern;
String selector = new String(methodPattern.selector);
int parameterCount = methodPattern.parameterCount;
ITypeHierarchy superHierarchy = type.newSupertypeHierarchy(null);
IType[] allTypes = superHierarchy.getAllSupertypes(type);
int length = allTypes.length;