WebReference (Collection<? extends PsiReference> references) { for (PsiReference reference : references) { if (reference instanceof WebReference) { return (WebReference)reference; } else if (reference instanceof PsiDynaReference) { final WebReference webReference = lookForWebReference(((PsiDynaReference<?>)reference).getReferences()); if (webReference != null) { return webReference; } } } return null; }