void (final @NotNull Supplier<String> contentProducer) { myAlarm.cancelAllRequests(); myAlarm.addRequest(() -> { if (isDisposed) return; Project project = myEditor.getProject(); if (project == null) return; PsiDocumentManager.getInstance(project).commitDocument(myParentEditor.getDocument()); ReadAction.nonBlocking(() -> { if (isDisposed) return null; return contentProducer.get(); }).finishOnUiThread(ModalityState.current(), newText -> { if (isDisposed) return; if (StringUtil.isEmpty(newText)) { hide(); } else if (!myEditor.getDocument().getText().equals(newText)) { DocumentUtil.writeInRunUndoTransparentAction(() -> myEditor.getDocument().setText(newText)); } }) .expireWith(myAlarm) .submit(AppExecutorUtil.getAppExecutorService()); }, 100); }