public static boolean isValidName(@Nullable final Project project,
                                    @NotNull final PsiElement psiElement,
                                    @Nullable final String newName) {
    if (StringUtil.isEmpty(newName)) {
      return false;
    }
    final Condition<String> inputValidator = RenameInputValidatorRegistry.getInputValidator(psiElement);
    if (inputValidator != null) {
      return inputValidator.value(newName);
    }
    if (psiElement instanceof PsiFile || psiElement instanceof PsiDirectory) {
      return newName.indexOf('\\') < 0 && newName.indexOf('/') < 0;
    }
    if (psiElement instanceof PomTargetPsiElement) {
      return !StringUtil.isEmptyOrSpaces(newName);
    }

    final PsiFile file = psiElement.getContainingFile();
    final Language elementLanguage = psiElement.getLanguage();

    final Language fileLanguage = file == null ? null : file.getLanguage();
    Language language = fileLanguage == null ? elementLanguage : fileLanguage.isKindOf(elementLanguage) ? fileLanguage : elementLanguage;

    return LanguageNamesValidation.isIdentifier(language, newName.trim(), project);
  }
public static boolean isValidName(@Nullable final Project project,
                                    @NotNull final PsiElement psiElement,
                                    @Nullable final String newName)