@Override
  public void update() {
    ThreadingAssertions.assertEventDispatchThread();
    if (myEditor.isDisposed() || !isValid()) return;
    if (myEditor.myDocumentChangeInProgress) {
      throw new IllegalStateException("Custom fold region shouldn't be updated during document change");
    }
    int oldWidth = myWidthInPixels;
    int oldHeight = myHeightInPixels;
    GutterIconRenderer oldIconRenderer = myGutterIconRenderer;
    doUpdate();
    int changeFlags = 0;
    if (oldWidth != myWidthInPixels) changeFlags |= InlayModel.ChangeFlags.WIDTH_CHANGED;
    if (oldHeight != myHeightInPixels) changeFlags |= InlayModel.ChangeFlags.HEIGHT_CHANGED;
    if (!Objects.equals(oldIconRenderer, myGutterIconRenderer)) changeFlags |= InlayModel.ChangeFlags.GUTTER_ICON_PROVIDER_CHANGED;
    if (changeFlags != 0) {
      myEditor.getFoldingModel().onCustomFoldRegionPropertiesChange(this, changeFlags);
    }
    else {
      repaint();
    }
  }
@Override
  public void update()