protected void uninstallOccurrencesFinder() {
    fMarkOccurrenceAnnotations = false;

    if (fOccurrencesFinderJob != null) {
      fOccurrencesFinderJob.cancel();
      fOccurrencesFinderJob = null;
    }

    if (fOccurrencesFinderJobCanceler != null) {
      fOccurrencesFinderJobCanceler.uninstall();
      fOccurrencesFinderJobCanceler = null;
    }

    if (fPostSelectionListenerWithAST != null) {
      SelectionListenerWithASTManager.getDefault()
          .removeListener(editor, fPostSelectionListenerWithAST);
      fPostSelectionListenerWithAST = null;
    }

    removeOccurrenceAnnotations();
  }
  protected void installOccurrencesFinder(boolean forceUpdate) {
    fMarkOccurrenceAnnotations = true;

    fPostSelectionListenerWithAST =
        new ISelectionListenerWithAST() {
          public void selectionChanged(
              IEditorPart part, ITextSelection selection, Program astRoot) {
            updateOccurrenceAnnotations(selection, astRoot);
          }
        };
    SelectionListenerWithASTManager.getDefault().addListener(editor, fPostSelectionListenerWithAST);
    if (forceUpdate && editor.getSelectionProvider() != null) {
      fForcedMarkOccurrencesSelection = editor.getSelectionProvider().getSelection();
      IModelElement source = editor.getSourceModule();
      if (source != null) {
        try {
          final Program ast =
              SharedASTProvider.getAST(
                  (ISourceModule) source, SharedASTProvider.WAIT_NO, editor.getProgressMonitor());
          updateOccurrenceAnnotations((ITextSelection) fForcedMarkOccurrencesSelection, ast);
        } catch (Exception e) {
          IdeLog.logError(
              PHPEditorPlugin.getDefault(),
              "Error installing the PHP occurrences finder",
              e); //$NON-NLS-1$
        }
      }
    }

    if (fOccurrencesFinderJobCanceler == null) {
      fOccurrencesFinderJobCanceler = new OccurrencesFinderJobCanceler();
      fOccurrencesFinderJobCanceler.install();
    }

    // TODO Do we need some way to hook into reconciling to force an update? Won't typing changed
    // the "selection"
    // anyhow?
  }