private static @NotNull Processor<VirtualFile> createChangeCharsetProcessor(@NotNull Project project) {
    return file -> {
      if (file.isDirectory()) {
        return true;
      }
      if (!(file instanceof VirtualFileSystemEntry)) return false;
      Document cachedDocument = FileDocumentManager.getInstance().getCachedDocument(file);
      if (cachedDocument == null) {
        if (file.isCharsetSet()) {
          file.setCharset(null, null, false);
        }
        return true;
      }
      ProgressManager.progress(IdeBundle.message("progress.text.reloading.files"), file.getPresentableUrl());
      TransactionGuard.submitTransaction(ApplicationManager.getApplication(), () -> clearAndReload(file, project));
      return true;
    };
  }
private static @NotNull Processor<VirtualFile> createChangeCharsetProcessor(@NotNull Project project)