private static PsiCodeBlock findAnchorBlock(final Collection<? extends PsiReference> refs) {
      PsiCodeBlock result = null;
      for (PsiReference psiReference : refs) {
        final PsiElement element = psiReference.getElement();
        if (PsiUtil.isInsideJavadocComment(element)) continue;
        PsiCodeBlock block = PsiTreeUtil.getParentOfType(element, PsiCodeBlock.class);
        if (result == null || block == null) {
          result = block;
        }
        else {
          final PsiElement commonParent = PsiTreeUtil.findCommonParent(result, block);
          result = PsiTreeUtil.getParentOfType(commonParent, PsiCodeBlock.class, false);
          if (result == null) return null;
        }
      }
      return result;
    }
private static PsiCodeBlock findAnchorBlock(final Collection<? extends PsiReference> refs)