public static void changeLineSeparators(@NotNull Project project,
                                          @NotNull VirtualFile virtualFile,
                                          @NotNull String newSeparator) {
    FileDocumentManager fileDocumentManager = FileDocumentManager.getInstance();
    Document document = fileDocumentManager.getCachedDocument(virtualFile);
    if (document != null) {
      fileDocumentManager.saveDocument(document);
    }

    String currentSeparator = LoadTextUtil.detectLineSeparator(virtualFile, false);
    final String commandText;
    if (StringUtil.isEmpty(currentSeparator)) {
      commandText = PlatformEditorBundle.message("command.name.changed.line.separators.to", LineSeparator.fromString(newSeparator));
    }
    else {
      commandText = PlatformEditorBundle.message("command.name.changed.line.separators.from.s.to.s",
                                                 LineSeparator.fromString(currentSeparator), LineSeparator.fromString(newSeparator));
    }

    WriteCommandAction.writeCommandAction(project).withName(commandText).run(() -> {
      try {
        LoadTextUtil.changeLineSeparators(project, virtualFile, newSeparator, virtualFile);
      }
      catch (IOException e) {
        LOG.info(e);
      }
    });
  }
public static void changeLineSeparators(@NotNull Project project,
                                          @NotNull VirtualFile virtualFile,
                                          @NotNull String newSeparator)