void () { myUpdateAlarm.cancelAllRequests(); myUpdateAlarm.addRequest(() -> { if (myProject.isDisposed()) return; PsiDocumentManagerBase documentManager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject); documentManager.cancelAndRunWhenAllCommitted("ExtractMethodPreview", this::updateImmediately); }, 300); }