PsiUnnamedClass (@NotNull PsiFile file) { if (file instanceof PsiJavaFile) { final PsiJavaFile javaFile = (PsiJavaFile)file; PsiClass[] classes = javaFile.getClasses(); if (classes.length == 1 && classes[0] instanceof PsiUnnamedClass) { return (PsiUnnamedClass)classes[0]; } } return null; }