示例#1
0
  private void updateDocumentProvider(IEditorInput input) {

    IProgressMonitor rememberedProgressMonitor = null;

    IDocumentProvider provider = getDocumentProvider();
    if (provider != null) {
      provider.removeElementStateListener(fElementStateListener);
      if (provider instanceof IDocumentProviderExtension2) {
        IDocumentProviderExtension2 extension = (IDocumentProviderExtension2) provider;
        rememberedProgressMonitor = extension.getProgressMonitor();
        extension.setProgressMonitor(null);
      }
    }

    setDocumentProvider(input);

    provider = getDocumentProvider();
    if (provider != null) {
      provider.addElementStateListener(fElementStateListener);
      if (provider instanceof IDocumentProviderExtension2) {
        IDocumentProviderExtension2 extension = (IDocumentProviderExtension2) provider;
        extension.setProgressMonitor(rememberedProgressMonitor);
      }
    }
  }
示例#2
0
  /**
   * Disposes of the connection with the document provider. Subclasses may extend.
   *
   * @since 3.0
   */
  protected void disposeDocumentProvider() {
    IDocumentProvider provider = getDocumentProvider();
    if (provider != null) {

      IEditorInput input = getEditorInput();
      if (input != null) provider.disconnect(input);

      if (fElementStateListener != null) {
        provider.removeElementStateListener(fElementStateListener);
        fElementStateListener = null;
      }
    }
    fImplicitDocumentProvider = null;
  }
  /*
   * @see org.eclipse.ui.texteditor.quickdiff.IQuickDiffReferenceProvider#dispose()
   */
  public void dispose() {
    IProgressMonitor monitor = fProgressMonitor;
    if (monitor != null) {
      monitor.setCanceled(true);
    }

    IDocumentProvider provider = fDocumentProvider;

    synchronized (fLock) {
      if (provider != null) provider.removeElementStateListener(this);
      fEditorInput = null;
      fDocumentProvider = null;
      fReference = null;
      fDocumentRead = false;
      fProgressMonitor = null;
      fEditor = null;
    }
  }