@Nullable
  public static Function<String, @DialogMessage String> getInputErrorValidator(PsiElement element) {
    List<RenameInputValidatorEx> validators = new ArrayList<>();
    for (RenameInputValidator validator : RenameInputValidator.EP_NAME.getExtensionList()) {
      if (validator instanceof RenameInputValidatorEx && validator.getPattern().accepts(element, new ProcessingContext())) {
        validators.add((RenameInputValidatorEx)validator);
      }
    }

    if (validators.isEmpty()) return null;
    Project project = element.getProject();
    return newName -> validators.stream().map(v -> v.getErrorMessage(newName, project)).filter(Objects::nonNull).findFirst().orElse(null);
  }
@Nullable
  public static Function<String, @DialogMessage String> getInputErrorValidator(PsiElement element)