/** @param dirtyRegion */
  protected void process(DirtyRegion dirtyRegion) {
    if (!isInstalled() || isInRewriteSession() || dirtyRegion == null || getDocument() == null)
      return;

    super.process(dirtyRegion);

    ITypedRegion[] partitions = computePartitioning(dirtyRegion);

    // call the validator strategy once for each effected partition
    DirtyRegion dirty = null;
    for (int i = 0; i < partitions.length; i++) {
      dirty = createDirtyRegion(partitions[i], DirtyRegion.INSERT);

      // [source]validator (extension) for this partition
      if (getValidatorStrategy() != null) {
        getValidatorStrategy().reconcile(partitions[i], dirty);
      }
    }

    /* if there is a folding strategy then reconcile it for the
     * entire dirty region.
     * NOTE: the folding strategy does not care about the sub regions.
     */
    if (getFoldingStrategy() != null) {
      getFoldingStrategy().reconcile(dirtyRegion, null);
    }
  }
  protected void setEntireDocumentDirty(IDocument document) {
    super.setEntireDocumentDirty(document);

    // make the entire document dirty
    // this also happens on a "save as"
    if (document != null && isInstalled() && fLastPartitions != null && document.getLength() == 0) {
      /**
       * https://bugs.eclipse.org/bugs/show_bug.cgi?id=199053
       *
       * <p>Process the strategies for the last known-good partitions.
       */
      for (int i = 0; i < fLastPartitions.length; i++) {
        ValidatorStrategy validatorStrategy = getValidatorStrategy();
        if (validatorStrategy != null) {
          validatorStrategy.reconcile(
              fLastPartitions[i], createDirtyRegion(fLastPartitions[i], DirtyRegion.REMOVE));
        }
      }
      IReconcilingStrategy spellingStrategy = getSpellcheckStrategy();
      if (spellingStrategy != null) {
        spellingStrategy.reconcile(new Region(0, document.getLength()));
      }

      // if there is a folding strategy then reconcile it
      if (getFoldingStrategy() != null) {
        getFoldingStrategy().reconcile(new Region(0, document.getLength()));
      }
    }
  }
  protected void endProcessing() {
    super.endProcessing();
    ValidatorStrategy validatorStrategy = getValidatorStrategy();
    if (validatorStrategy != null) {
      validatorStrategy.endProcessing();
    }
    /* single spell-check for everything to ensure that SpellingProblem offsets are correct */
    IReconcilingStrategy spellingStrategy = getSpellcheckStrategy();
    IDocument document = getDocument();
    if (spellingStrategy != null && document != null) {
      spellingStrategy.reconcile(new Region(0, document.getLength()));
    }

    IReconcilingStrategy semanticHighlightingStrategy = getSemanticHighlightingStrategy();
    if (semanticHighlightingStrategy != null && document != null) {
      semanticHighlightingStrategy.reconcile(new Region(0, document.getLength()));
    }

    if ((getTextViewer() instanceof ISourceViewer)) {
      ISourceViewer sourceViewer = (ISourceViewer) getTextViewer();
      IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
      for (int i = 0; i < fReconcileListeners.length; i++) {
        fReconcileListeners[i].reconciled(
            document, annotationModel, false, new NullProgressMonitor());
      }
    }
  }
  /** @see org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#uninstall() */
  public void uninstall() {
    if (isInstalled()) {

      IReconcilingStrategy validatorStrategy = getValidatorStrategy();

      if (validatorStrategy != null) {
        if (validatorStrategy instanceof IReleasable) ((IReleasable) validatorStrategy).release();
      }

      if (fSpellcheckStrategy != null) {
        fSpellcheckStrategy.setDocument(null);
        fSpellcheckStrategy = null;
      }

      fReconcileListeners = new ISourceReconcilingListener[0];

      if (getDocument() instanceof IStructuredDocument) {
        RegionParser parser = ((IStructuredDocument) getDocument()).getParser();
        if (parser instanceof StructuredDocumentRegionParser) {
          ((StructuredDocumentRegionParser) parser)
              .removeStructuredDocumentRegionHandler(fResetHandler);
        }
      }
    }
    super.uninstall();
  }
  public void setDocument(IDocument doc) {
    if (getDocument() instanceof IStructuredDocument) {
      RegionParser parser = ((IStructuredDocument) getDocument()).getParser();
      if (parser instanceof StructuredDocumentRegionParser) {
        ((StructuredDocumentRegionParser) parser)
            .removeStructuredDocumentRegionHandler(fResetHandler);
      }
    }

    super.setDocument(doc);

    IReconcilingStrategy validatorStrategy = getValidatorStrategy();
    if (validatorStrategy != null) {
      validatorStrategy.setDocument(doc);
    }
    if (fSemanticHighlightingStrategy != null) {
      fSemanticHighlightingStrategy.setDocument(doc);
    }

    fSpellcheckStrategy = null;
    if (fFoldingStrategy != null) {
      fFoldingStrategy.uninstall();
    }
    fFoldingStrategy = null;

    if (getDocument() instanceof IStructuredDocument) {
      RegionParser parser = ((IStructuredDocument) doc).getParser();
      if (parser instanceof StructuredDocumentRegionParser) {
        ((StructuredDocumentRegionParser) parser).addStructuredDocumentRegionHandler(fResetHandler);
      }
    }
  }
  /**
   * @see
   *     org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#install(org.eclipse.jface.text.ITextViewer)
   */
  public void install(ITextViewer textViewer) {
    super.install(textViewer);

    // determine if validation is enabled
    this.fValidationEnabled =
        SSEUIPlugin.getInstance()
            .getPreferenceStore()
            .getBoolean(CommonEditorPreferenceNames.EVALUATE_TEMPORARY_PROBLEMS);
  }
 protected void beginProcessing() {
   super.beginProcessing();
   ValidatorStrategy validatorStrategy = getValidatorStrategy();
   if (validatorStrategy != null) {
     validatorStrategy.beginProcessing();
   }
   if ((getTextViewer() instanceof ISourceViewer)) {
     for (int i = 0; i < fReconcileListeners.length; i++) {
       fReconcileListeners[i].aboutToBeReconciled();
     }
   }
 }
  public void setDocument(IDocument doc) {
    super.setDocument(doc);

    IReconcilingStrategy validatorStrategy = getValidatorStrategy();
    if (validatorStrategy != null) {
      validatorStrategy.setDocument(doc);
    }
    if (fSemanticHighlightingStrategy != null) {
      fSemanticHighlightingStrategy.setDocument(doc);
    }

    fSpellcheckStrategy = null;
    if (fFoldingStrategy != null) {
      fFoldingStrategy.uninstall();
    }
    fFoldingStrategy = null;
  }
  /** @see org.eclipse.wst.sse.ui.internal.reconcile.DirtyRegionProcessor#uninstall() */
  public void uninstall() {
    if (isInstalled()) {

      IReconcilingStrategy validatorStrategy = getValidatorStrategy();

      if (validatorStrategy != null) {
        if (validatorStrategy instanceof IReleasable) ((IReleasable) validatorStrategy).release();
      }

      if (fSpellcheckStrategy != null) {
        fSpellcheckStrategy.setDocument(null);
        fSpellcheckStrategy = null;
      }

      fReconcileListeners = new ISourceReconcilingListener[0];
    }
    super.uninstall();
  }
 public void forceReconciling() {
   super.forceReconciling();
 }