コード例 #1
0
  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);
      }
    }
  }
コード例 #2
0
  /** @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();
  }