private RestReferenceTarget findAnonimousTarget(PsiFile file, RestReferenceTarget[] targets) {
    String name = getReferenceText();
    RestReference[] references = PsiTreeUtil.getChildrenOfType(file, RestReference.class);
    int refIndex = 1;
    int i = 0;
    while (!references[i].equals(this)) {
      if (references[i].getReferenceText().equals(name))
        ++refIndex;
      ++i;
    }

    int targetIndex = 0;
    for (int j = 0; j != targets.length; ++j) {
      if (targets[j].getReferenceName().equals(name))
        ++targetIndex;
      if (targetIndex == refIndex)
        return targets[j];
    }
    return null;
  }
private RestReferenceTarget findAnonimousTarget(PsiFile file, RestReferenceTarget[] targets)