Collection<StructureViewTreeElement> () { final List<StructureViewTreeElement> emptyResult = Collections.emptyList(); final PsiMethod element = getElement(); if (element == null || element instanceof SyntheticElement || element instanceof LightElement) return emptyResult; final PsiFile psiFile = element.getContainingFile(); if (psiFile == null || psiFile instanceof PsiCompiledElement) return emptyResult; final ArrayList<StructureViewTreeElement> result = new ArrayList<>(); element.accept(new JavaRecursiveElementWalkingVisitor(){ @Override public void visitClass(@NotNull PsiClass aClass) { if (!(aClass instanceof PsiAnonymousClass) && !(aClass instanceof PsiTypeParameter)) { result.add(new JavaClassTreeElement(aClass, isInherited())); } } }); return result; }