List<WebReference> (@NotNull PsiElement element) { List<WebReference> refs = new ArrayList<>(); element.accept(new PsiRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { for (PsiReference ref : element.getReferences()) { if (ref instanceof WebReference) { refs.add((WebReference)ref); } } super.visitElement(element); } }); return refs; }