private void commitTransaction(@NotNull PsiFile containingFileByTree, @Nullable Document document) {
    final PsiDocumentManagerBase manager = (PsiDocumentManagerBase)PsiDocumentManager.getInstance(myProject);
    final PsiToDocumentSynchronizer synchronizer = manager.getSynchronizer();

    boolean isFromCommit = manager.isCommitInProgress();
    boolean isPhysicalPsiChange = !isFromCommit && !synchronizer.isIgnorePsiEvents();
    if (isPhysicalPsiChange) {
      reparseParallelTrees(containingFileByTree, synchronizer);
    }

    boolean docSynced = false;
    if (document != null) {
      final int oldLength = containingFileByTree.getTextLength();
      docSynced = synchronizer.commitTransaction(document);
      if (docSynced) {
        sendAfterChildrenChangedEvent(containingFileByTree, oldLength);
      }
    }

    if (isPhysicalPsiChange && docSynced) {
      containingFileByTree.getViewProvider().contentsSynchronized();
    }

  }
private void commitTransaction(@NotNull PsiFile containingFileByTree, @Nullable Document document)