boolean (@NotNull Document document) { DocumentChangeTransaction documentChangeTransaction = removeTransaction(document); if(documentChangeTransaction == null) return false; PsiFile changeScope = documentChangeTransaction.myChangeScope; try { mySyncDocument = document; PsiTreeChangeEventImpl fakeEvent = new PsiTreeChangeEventImpl(changeScope.getManager()); fakeEvent.setParent(changeScope); fakeEvent.setFile(changeScope); checkPsiModificationAllowed(fakeEvent); doSync(fakeEvent, (document1, event) -> doCommitTransaction(document1, documentChangeTransaction)); if (PomModelImpl.shouldFirePhysicalPsiEvents(changeScope)) { myBus.syncPublisher(PsiDocumentTransactionListener.TOPIC).transactionCompleted(document, changeScope); } } catch (Throwable e) { myPsiDocumentManager.forceReload(changeScope.getViewProvider().getVirtualFile(), changeScope.getViewProvider()); //noinspection ConstantConditions ExceptionUtil.rethrowAllAsUnchecked(e); } finally { mySyncDocument = null; } return true; }