static @Nullable String detectClassName(@NotNull Project project, @NotNull String fileText) {
    final PsiClass[] classes = getPastedClasses(project, fileText);
    if (classes.length < 1) return null;
    for (PsiClass aClass : classes) {
      if (aClass.hasModifierProperty(PsiModifier.PUBLIC)) {
        return aClass.getName();
      }
    }
    PsiClass detectedClass = classes[0];
    if (detectedClass instanceof PsiImplicitClass) return null;
    return detectedClass.getName();
  }
static @Nullable String detectClassName(@NotNull Project project, @NotNull String fileText)