void (final @NotNull SequentialTask task) { UIUtil.invokeAndWaitIfNeeded(() -> { Document document = myDocument.get(); if (document != null) { myDocumentModificationStampBefore = document.getModificationStamp(); } task.prepare(); }); }