@Override
  protected @NotNull OperationStatus ensureFilesWritable(@NotNull Collection<? extends VirtualFile> originalFiles, Collection<? extends VirtualFile> files) {
    List<FileInfo> fileInfos = files.stream()
      .filter(vf-> vf != null && !vf.isWritable() && vf.isInLocalFileSystem())
      .map(vf -> new FileInfo(vf, myProject))
      .toList();

    // if all files are already writable
    if (fileInfos.isEmpty()) {
      return createResultStatus(originalFiles, files);
    }

    if (ApplicationManager.getApplication().isUnitTestMode()) {
      if (myClearReadOnlyInTests) {
        processFiles(new ArrayList<>(fileInfos), null);
      }
      return createResultStatus(originalFiles, files);
    }

    // This event count hack is necessary to allow actions that called this stuff could still get data from their data contexts.
    // Otherwise data manager stuff will fire up an assertion saying that event count has been changed (due to modal dialog show-up)
    // The hack itself is safe since we guarantee that focus will return to the same component had it before modal dialog have been shown.
    final int savedEventCount = IdeEventQueue.getInstance().getEventCount();
    if (myState.SHOW_DIALOG && !ApplicationManager.getApplication().isHeadlessEnvironment()) {
      List<PresentableFileInfo> presentableFileInfos = ActionUtil.underModalProgress(
        myProject,
        FileTypesBundle.message("progress.title.resolving.filetype"),
        () -> createPresentableFileInfos(fileInfos)
      );
      new ReadOnlyStatusDialog(myProject, presentableFileInfos).show();
    }
    else {
      processFiles(new ArrayList<>(fileInfos), null); // the collection passed is modified
    }
    IdeEventQueue.getInstance().setEventCount(savedEventCount);
    return createResultStatus(originalFiles, files);
  }
@Override
  protected @NotNull OperationStatus ensureFilesWritable(@NotNull Collection<? extends VirtualFile> originalFiles, Collection<? extends VirtualFile> files)