private void recalculateSoftWraps(@NotNull IncrementalCacheUpdateEvent event) {
    if (myInProgress) {
      LOG.error("Detected race condition at soft wraps recalculation", new Throwable(),
                AttachmentFactory.createContext(myEditor.dumpState() + "\n" + event));
    }
    myInProgress = true;
    try {
      myEventBeingProcessed = event;
      notifyListenersOnCacheUpdateStart(event);
      int endOffsetUpperEstimate = getEndOffsetUpperEstimate(event);
      if (myVisibleAreaWidth == QUICK_DUMMY_WRAPPING) {
        doRecalculateSoftWrapsRoughly(event);
      }
      else {
        new SoftWrapEngine(myEditor, myPainter, myStorage, myDataMapper, event, myVisibleAreaWidth,
                           myCustomIndentUsedLastTime ? myCustomIndentValueUsedLastTime : -1).generate();
      }
      if (LOG.isDebugEnabled()) {
        LOG.debug("Soft wrap recalculation done: " + event + ". " + (event.getActualEndOffset() - event.getStartOffset()) + " characters processed");
      }
      if (event.getActualEndOffset() > endOffsetUpperEstimate) {
        LOG.error("Unexpected error at soft wrap recalculation", new Attachment("softWrapModel.txt", myEditor.getSoftWrapModel().toString()));
      }
      notifyListenersOnCacheUpdateEnd(event);
      myEventBeingProcessed = null;
    }
    finally {
      myInProgress = false;
    }

    Project project = myEditor.getProject();
    VirtualFile file = myEditor.getVirtualFile();
    if (project != null && file != null && myEditor.getUserData(EditorImpl.FORCED_SOFT_WRAPS) != null) {
      if (myStorage.isEmpty()) {
        myEditor.putUserData(EditorImpl.SOFT_WRAPS_EXIST, null);
      }
      else if (myEditor.getUserData(EditorImpl.SOFT_WRAPS_EXIST) == null) {
        myEditor.putUserData(EditorImpl.SOFT_WRAPS_EXIST, Boolean.TRUE);
        EditorNotifications.getInstance(project).updateNotifications(file);
      }
    }
  }
private void recalculateSoftWraps(@NotNull IncrementalCacheUpdateEvent event)