@RequiresEdt
  private void apply(@NotNull CharSequence baseContent,
                     @NotNull MergeLineFragmentsWithImportMetadata fragmentsWithMetadata,
                     @NotNull List<? extends MergeConflictType> conflictTypes,
                     @Nullable FoldingModelSupport.Data foldingState,
                     @NotNull IgnorePolicy ignorePolicy) {
    if (isDisposed()) return;
    myFoldingModel.updateContext(myRequest, getFoldingModelSettings());
    clearDiffPresentation();
    resetChangeCounters();

    boolean success = setInitialOutputContent(baseContent);
    List<MergeLineFragment> fragments = fragmentsWithMetadata.getFragments();

    if (!success) {
      fragments = Collections.emptyList();
      conflictTypes = Collections.emptyList();
      myPanel
        .addNotification(DiffNotifications.createNotification(DiffBundle.message("error.cant.resolve.conflicts.in.a.read.only.file")));
    }

    myModel.setChanges(ContainerUtil.map(fragments, f -> new LineRange(f.getStartLine(ThreeSide.BASE),
                                                                       f.getEndLine(ThreeSide.BASE))));

    for (int index = 0; index < fragments.size(); index++) {
      MergeLineFragment fragment = fragments.get(index);
      MergeConflictType conflictType = conflictTypes.get(index);

      boolean isInImportRange = fragmentsWithMetadata.isIndexInImportRange(index);
      TextMergeChange change = new TextMergeChange(index, isInImportRange, fragment, conflictType, myTextMergeViewer);

      myAllMergeChanges.add(change);
      onChangeAdded(change);
    }

    myFoldingModel.install(foldingState, myRequest, getFoldingModelSettings());

    myInitialScrollHelper.onRediff();

    myContentPanel.repaintDividers();
    myStatusPanel.update();

    getEditor().setViewer(false);
    myLoadingPanel.stopLoading();
    myAcceptResolveAction.setEnabled(true);

    myInnerDiffWorker.onEverythingChanged();
    myInitialRediffFinished = true;
    myContentModified = false;
    myCurrentIgnorePolicy = ignorePolicy;
    myResolveImportConflicts = getTextSettings().isAutoResolveImportConflicts();

    // build initial statistics
    int autoResolvableChanges = ContainerUtil.count(getAllChanges(), c -> canResolveChangeAutomatically(c, ThreeSide.BASE));

    myAggregator = new MergeStatisticsAggregator(
      getAllChanges().size(),
      autoResolvableChanges,
      getConflictsCount()
    );

    if (myResolveImportConflicts) {
      myChangeReferenceProcessor =
        new ChangeReferenceProcessor(myProject, getEditor(), myPsiFiles,
                                     ContainerUtil.map(myMergeRequest.getContents(), content -> content.getDocument()));
      List<TextMergeChange> importChanges = ContainerUtil.filter(getChanges(), change -> change.isImportChange());
      if (importChanges.size() != fragmentsWithMetadata.getFragments().size()) {
        for (TextMergeChange importChange : importChanges) {
          markChangeResolved(importChange);
        }
      }
    }
    if (getTextSettings().isAutoApplyNonConflictedChanges()) {
      if (hasNonConflictedChanges(ThreeSide.BASE)) {
        applyNonConflictedChanges(ThreeSide.BASE);
      }
    }
  }
@RequiresEdt
  private void apply(@NotNull CharSequence baseContent,
                     @NotNull MergeLineFragmentsWithImportMetadata fragmentsWithMetadata,
                     @NotNull List<? extends MergeConflictType> conflictTypes,
                     @Nullable FoldingModelSupport.Data foldingState,
                     @NotNull IgnorePolicy ignorePolicy)