private void updateHtml() {
    if (!myFile.isValid() || myDocument == null || Disposer.isDisposed(this)) {
      return;
    }

    final Pair<String, String> htmlAndError = RestPythonPreviewProviderKt.toHtml(myDocument.getText(), myFile, myProject);
    if (htmlAndError == null) return;

    String html = htmlAndError.getFirst();
    if (html.isEmpty()) {
      html = NO_PREVIEW + htmlAndError.getSecond();
    }

    // EA-75860: The lines to the top may be processed slowly; Since we're in pooled thread, we can be disposed already.
    if (!myFile.isValid() || Disposer.isDisposed(this)) {
      return;
    }

    synchronized (REQUESTS_LOCK) {
      if (myLastRequest != null) {
        mySwingAlarm.cancelRequest(myLastRequest);
      }
      String finalHtml = html;
      myLastRequest = () -> {
        if (!finalHtml.equals(myLastRenderedHtml)) {
          myLastRenderedHtml = finalHtml;
          myPanel.setHtml(myLastRenderedHtml);
        }

        myPanel.render();
        synchronized (REQUESTS_LOCK) {
          myLastRequest = null;
        }
      };
      mySwingAlarm.addRequest(myLastRequest, RENDERING_DELAY_MS, ModalityState.stateForComponent(getComponent()));
    }
  }
private void updateHtml()