void (@NotNull PsiTreeChangeEvent event) { if (!toProcessPsiEvent()) return; PsiFile psiFile = event.getFile(); if (!(psiFile instanceof PsiFileEx) || !((PsiFileEx)psiFile).isContentsLoaded()) return; Document document = myPsiDocumentManager.getCachedDocument(psiFile); if (document != null && myPsiDocumentManager.isUncommited(document)) { throw new IllegalStateException("Attempt to modify PSI for non-committed Document!"); } }