PsiClass (final Project project, final String mainClassName, final GlobalSearchScope scope) { if (project.isDefault() || (DumbService.isDumb(project) && FileBasedIndex.getInstance().getCurrentDumbModeAccessType() == null && !DumbService.getInstance(project).isAlternativeResolveEnabled())) { return null; } final PsiManager psiManager = PsiManager.getInstance(project); final String shortName = StringUtil.getShortName(mainClassName); final String packageName = StringUtil.getPackageName(mainClassName); final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(psiManager.getProject()); final PsiClass psiClass = psiFacade.findClass(StringUtil.getQualifiedName(packageName, shortName.replace('$', '.')), scope); return psiClass == null ? psiFacade.findClass(mainClassName, scope) : psiClass; }