VirtualFile (String internalClassName) { String packageName = StringUtil.getPackageName(internalClassName, '/').replace('/', '.'); String className = StringUtil.getShortName(internalClassName, '/'); PsiPackage aPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName); if (aPackage == null) { PsiClass psiClass = JavaPsiFacade.getInstance(myProject) .findClass(StringUtil.getQualifiedName(packageName, className), GlobalSearchScope.allScope(myProject)); if (psiClass != null) { PsiModifierListOwner compiledClass = PsiUtil.preferCompiledElement(psiClass); if (compiledClass instanceof ClsClassImpl) { return compiledClass.getContainingFile().getVirtualFile(); } } return null; } String classFileName = className + ".class"; for (PsiDirectory directory : aPackage.getDirectories()) { VirtualFile file = directory.getVirtualFile().findChild(classFileName); if (file != null && !ClassDataIndexer.isFileExcluded(file)) { return file; } } return null; }