@NotNull
  private static DocumentContent createContent(@Nullable Project project,
                                               @NotNull Editor editor,
                                               @Nullable FileType type,
                                               @Nullable DiffContent selectedContent,
                                               @NotNull AnActionEvent e) {
    DocumentContent content = null;
    if (selectedContent instanceof DocumentContent) {
      Document contentDocument = ((DocumentContent)selectedContent).getDocument();
      Document editorDocument = editor.getDocument();
      if (contentDocument.equals(editorDocument)) {
        content = (DocumentContent)selectedContent;
      }
    }

    if (content == null) {
      content = DiffContentFactory.getInstance().create(project, editor.getDocument(), type);
    }

    SelectionModel selectionModel = editor.getSelectionModel();
    if (selectionModel.hasSelection() && !EditorUtil.contextMenuInvokedOutsideOfSelection(e)) {
      TextRange range = new TextRange(selectionModel.getSelectionStart(), selectionModel.getSelectionEnd());
      content = DiffContentFactory.getInstance().createFragment(project, content, range);
    }

    if (editor.isViewer()) content.putUserData(DiffUserDataKeys.FORCE_READ_ONLY, true);

    return content;
  }
@NotNull
  private static DocumentContent createContent(@Nullable Project project,
                                               @NotNull Editor editor,
                                               @Nullable FileType type,
                                               @Nullable DiffContent selectedContent,
                                               @NotNull AnActionEvent e)