Class filenameIndexClass = Class.forName("com.intellij.psi.search.FilenameIndex");
Method getFilesByName = filenameIndexClass.getMethod("getFilesByName", Project.class,
String.class, GlobalSearchScope.class);
Class projectScopeClass = Class.forName("com.intellij.psi.search.ProjectScope");
Method getProjectScope = projectScopeClass.getMethod("getProjectScope", Project.class);
GlobalSearchScope scope = (GlobalSearchScope) getProjectScope.invoke(null, project);
psiFiles = (PsiFile[]) getFilesByName.invoke(null, project, filePath, scope);
} else {
Class psiManagerClass = Class.forName("com.intellij.psi.PsiManager");
Method getInstance = psiManagerClass.getMethod("getInstance", Project.class);
Object inst = getInstance.invoke(null, project);