void (@NotNull DocumentEvent event) { super.documentChanged(event); // optimisation: avoid documents piling up during batch processing if (isUncommited(event.getDocument()) && FileDocumentManagerImpl.areTooManyDocumentsInTheQueue(myUncommittedDocuments)) { if (myUnitTestMode) { myStopTrackingDocuments = true; try { //noinspection TestOnlyProblems LOG.error("Too many uncommitted documents for " + myProject + "(" +myUncommittedDocuments.size()+")"+ ":\n" + StringUtil.join(myUncommittedDocuments, "\n") + (myProject instanceof ProjectEx ? "\n\n Project creation trace: " + ((ProjectEx)myProject).getCreationTrace() : "")); } finally { //noinspection TestOnlyProblems clearUncommittedDocuments(); } } // must not commit during document save if (PomModelImpl.isAllowPsiModification() // it can happen that document(forUseInNonAWTThread=true) outside write action caused this && ApplicationManager.getApplication().isWriteAccessAllowed()) { // commit one document to avoid OOME for (Document document : myUncommittedDocuments) { if (document != event.getDocument()) { commitDocument(document); break; } } } } }