@Contract("null, _ -> null")
  private static PsiElement substituteElementToRename(@Nullable PsiElement element, @Nullable Editor editor) {
    if (element == null) return null;
    RenamePsiElementProcessor processor = RenamePsiElementProcessor.forElement(element);
    PsiElement substituted = processor.substituteElementToRename(element, editor);
    if (substituted == null || !PsiElementRenameHandler.canRename(element.getProject(), editor, substituted)) return null;
    return substituted;
  }
@Contract("null, _ -> null")
  private static PsiElement substituteElementToRename(@Nullable PsiElement element, @Nullable Editor editor)