boolean (@NotNull Document document) { document = getTopLevelDocument(document); if (getSynchronizer().isInSynchronization(document)) return true; return (!(document instanceof DocumentEx) || !((DocumentEx)document).isInEventsHandling()) && !isInUncommittedSet(document); }