private List<Template> getMatchingTemplates(String fullClassName, String query, String contextTypeId) {
System.out.println("getMatchingMethods {" + fullClassName + "}.{" + query + "}");
List<Template> result = new ArrayList<Template>();
IJavaProject javaProject = JavaCore.create(editor.getProject());
try {
IParent parent;
// Look for classes
parent = javaProject.findType(fullClassName);
if (parent != null) {
return getAllMethodsTemplates((IType)parent, query, contextTypeId);
}
// Look for package fragments
parent = getPackageFragment(javaProject, fullClassName);
if (parent == null) {
return result;
}
for (IJavaElement child: parent.getChildren()) {
if (child instanceof IPackageFragment) {
result.add(getTemplate(contextTypeId, (IPackageFragment)child));
} else if (child instanceof ICompilationUnit) { // Java class
result.add(getTemplate(contextTypeId, (ICompilationUnit)child));
}