private static String getStringToReplace(PsiElement element, String newName, boolean nonJava, final RenamePsiElementProcessorBase theProcessor) {
    if (element instanceof PsiMetaOwner psiMetaOwner) {
      final PsiMetaData metaData = psiMetaOwner.getMetaData();
      if (metaData != null) {
        return metaData.getName();
      }
    }

    if (theProcessor != null) {
      String result = theProcessor.getQualifiedNameAfterRename(element, newName, nonJava);
      if (result != null) {
        return result;
      }
    }

    if (element instanceof PsiNamedElement) {
      return newName;
    }
    else {
      LOG.error("Unknown element type : " + element);
      return null;
    }
  }
private static String getStringToReplace(PsiElement element, String newName, boolean nonJava, final RenamePsiElementProcessorBase theProcessor)