public static void renameReference(@NotNull PsiElement namedElement, String newName, @NotNull PsiReference ref) {
    if (ref instanceof BindablePsiReference) {
      boolean fallback = true;
      if (!(ref instanceof FragmentaryPsiReference && ((FragmentaryPsiReference)ref).isFragmentOnlyRename())) {
        try {
          ref.bindToElement(namedElement);
          fallback = false;
        }
        catch (IncorrectOperationException ignored) {
        }
      }
      if (fallback) {//fall back to old scheme
        ref.handleElementRename(newName);
      }
    }
  }
public static void renameReference(@NotNull PsiElement namedElement, String newName, @NotNull PsiReference ref)