private void afterChangedUpdate() {
    if (isFinished()) return;
    LOG.assertTrue(getTemplate() != null, presentTemplate(myPrevTemplate));
    if (myDocumentChanged) {
      if (myDocumentChangesTerminateTemplate || getSegments().isInvalid()) {
        cancelTemplate();
      }
      else {
        calcResults(true);
      }
      myDocumentChanged = false;
    }
  }
private void afterChangedUpdate()