PsiClass (Project project, @NotNull Editor editor, @NotNull PsiFile file, boolean allowInterface) { int offset = editor.getCaretModel().getOffset(); PsiElement element = file.findElementAt(offset); do { element = PsiTreeUtil.getParentOfType(element, PsiClass.class); } while (element instanceof PsiTypeParameter); final PsiClass aClass = (PsiClass)element; if (aClass instanceof PsiSyntheticClass) return null; return aClass == null || !allowInterface && aClass.isInterface() ? null : aClass; }