@Nullable
  private static TextRange relateRange(@NotNull PsiElement identifyingElement,
                                       @NotNull TextRange rangeInIdentifyingElement,
                                       @NotNull PsiElement declaringElement) {
    if (identifyingElement == declaringElement) {
      return rangeInIdentifyingElement;
    }
    else if (identifyingElement.getContainingFile() == declaringElement.getContainingFile()) {
      TextRange rangeInFile = rangeInIdentifyingElement.shiftRight(identifyingElement.getTextRange().getStartOffset());
      TextRange declaringElementRange = declaringElement.getTextRange();
      if (declaringElementRange.contains(rangeInFile)) {
        return rangeInFile.shiftLeft(declaringElementRange.getStartOffset());
      }
      else {
        return null;
      }
    }
    else {
      return null;
    }
  }
@Nullable
  private static TextRange relateRange(@NotNull PsiElement identifyingElement,
                                       @NotNull TextRange rangeInIdentifyingElement,
                                       @NotNull PsiElement declaringElement)