/**
  * We know that there are problems with incremental soft wraps cache update at the moment. Hence,
  * we may implement full cache reconstruction when the problem is encountered in order to avoid
  * customer annoyance.
  *
  * <p>However, the problems still should be fixed, hence, we report them only if dedicated flag is
  * set.
  *
  * <p>Current method encapsulates the logic mentioned above.
  *
  * @param task command object that which execution may trigger incremental update of update soft
  *     wraps cache
  */
 @SuppressWarnings({"UseOfArchaicSystemPropertyAccessors"})
 private void executeSafely(SoftWrapAwareTask task) {
   try {
     task.run(true);
   } catch (Throwable e) {
     if (Boolean.getBoolean(DEBUG_PROPERTY_NAME)
         || ApplicationManager.getApplication().isUnitTestMode()) {
       String info = myEditor.dumpState();
       LOG.error(
           String.format("Unexpected exception occurred during performing '%s'", task), e, info);
     }
     myEditor.getFoldingModel().rebuild();
     myDataMapper.release();
     myApplianceManager.reset();
     myStorage.removeAll();
     myApplianceManager.recalculateIfNecessary();
     try {
       task.run(true);
     } catch (Throwable e1) {
       String info = myEditor.dumpState();
       LOG.error(
           String.format("Can't perform %s even with complete soft wraps cache re-parsing", task),
           e1,
           info);
       myEditor.getSettings().setUseSoftWraps(false);
       task.run(false);
     }
   }
 }
 @Override
 public int paint(
     @NotNull Graphics g, @NotNull SoftWrapDrawingType drawingType, int x, int y, int lineHeight) {
   if (!isSoftWrappingEnabled()) {
     return 0;
   }
   if (!myEditor.getSettings().isAllSoftWrapsShown()) {
     int visualLine = y / lineHeight;
     LogicalPosition position =
         myEditor.visualToLogicalPosition(new VisualPosition(visualLine, 0));
     if (position.line != myEditor.getCaretModel().getLogicalPosition().line) {
       return myPainter.getDrawingHorizontalOffset(g, drawingType, x, y, lineHeight);
     }
   }
   return doPaint(g, drawingType, x, y, lineHeight);
 }
 private boolean areSoftWrapsEnabledInEditor() {
   return myEditor.getSettings().isUseSoftWraps()
       && !myEditor.myUseNewRendering
       && (!(myEditor.getDocument() instanceof DocumentImpl)
           || !((DocumentImpl) myEditor.getDocument()).acceptsSlashR());
 }