/*
     * @see
     * org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged
     * (org.eclipse.jface.text.IDocument, org.eclipse.jface.text.IDocument)
     */
    @Override
    public void inputDocumentAboutToBeChanged(final IDocument oldInput, final IDocument newInput) {
      if (oldInput == null) {
        return;
      }

      oldInput.removeDocumentListener(this);
    }
Example #2
0
 public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
   if (oldInput != null) {
     oldInput.removeDocumentListener(this);
   }
   if (newInput != null) {
     newInput.addDocumentListener(this);
   }
   inspect();
 }
    public void uninstall() {
      ISourceViewer sourceViewer = editor.getISourceViewer();
      if (sourceViewer != null) sourceViewer.removeTextInputListener(this);

      IDocumentProvider documentProvider = editor.getDocumentProvider();
      if (documentProvider != null) {
        IDocument document = documentProvider.getDocument(editor.getEditorInput());
        if (document != null) document.removeDocumentListener(this);
      }
    }
  /**
   * Stops listening changes in one document and starts listening another one.
   *
   * @param oldDoc may be null (if not null, this class will stop listening changes in it).
   * @param newDoc the document that should be listened from now on.
   */
  protected synchronized void reconnect(IDocument oldDoc, IDocument newDoc) {
    Assert.isTrue(disconnectionLevel == 0);

    if (oldDoc != null) {
      oldDoc.removeDocumentListener(this);
    }

    newDoc.addDocumentListener(this);
    this.doc = newDoc;
  }
 @Override
 public void disconnect(IDocument document) {
   if (document instanceof DisassemblyDocument) {
     final IBreakpointManager bpMgr = DebugPlugin.getDefault().getBreakpointManager();
     bpMgr.removeBreakpointListener(this);
     document.removeDocumentListener(this);
     fCatchup = null;
   }
   super.disconnect(document);
 }
 @Override
 public void disconnect(IDocument document) {
   if (this.document != document)
     throw new RuntimeException("Can't disconnect from different document.");
   for (final ColorAnnotation ca : annotations) {
     document.removePosition(ca.getPosition());
   }
   if (--openConnections == 0) {
     document.removeDocumentListener(documentListener);
   }
 }
Example #7
0
 @Override
 public void disconnect(IDocument document) {
   if (this.document != document)
     throw new RuntimeException(CANT_DISCONNECT_FROM_DIFFERENT_DOCUMENT_);
   for (final ColorAnnotation ca : annotations) {
     document.removePosition(ca.getPosition());
   }
   if (--openConnections == 0) {
     document.removeDocumentListener(documentListener);
   }
 }
 public void disconnect(IDocument document) {
   if (this.document != document) {
     throw new IllegalArgumentException(
         "Can't disconnect from different document."); //$NON-NLS-1$
   }
   for (final CoverageAnnotation ca : annotations) {
     document.removePosition(ca.getPosition());
   }
   if (--openConnections == 0) {
     CoverageTools.removeJavaCoverageListener(coverageListener);
     document.removeDocumentListener(documentListener);
   }
 }
Example #9
0
  @Override
  public void setDocument(final IDocument document) {
    final IDocument oldDocument = getDocument();
    if (oldDocument != null) {
      oldDocument.removeDocumentListener(getDocumentListener());
    }

    super.setDocument(document);

    if (document != null) {
      document.addDocumentListener(getDocumentListener());
    }
  }
Example #10
0
    public void uninstall() {
      final ISourceViewer sourceViewer = erlangEditor.getViewer();
      if (sourceViewer != null) {
        sourceViewer.removeTextInputListener(this);
      }

      final IDocumentProvider documentProvider = erlangEditor.getDocumentProvider();
      if (documentProvider != null) {
        final IDocument document = documentProvider.getDocument(erlangEditor.getEditorInput());
        if (document != null) {
          document.removeDocumentListener(this);
        }
      }
    }
Example #11
0
      public void verifyText(VerifyEvent e) {
        IDocument document = getDocumentProvider().getDocument(getEditorInput());
        final boolean[] documentChanged = new boolean[1];
        IDocumentListener listener =
            new IDocumentListener() {
              public void documentAboutToBeChanged(DocumentEvent event) {}

              public void documentChanged(DocumentEvent event) {
                documentChanged[0] = true;
              }
            };
        try {
          if (document != null) document.addDocumentListener(listener);
          if (!validateEditorInputState() || documentChanged[0]) e.doit = false;
        } finally {
          if (document != null) document.removeDocumentListener(listener);
        }
      }
    /*
     * (non-Javadoc)
     * @see
     * org.eclipse.jface.text.ITextInputListener#inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument,
     * org.eclipse.jface.text.IDocument)
     */
    public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) {
      if (oldInput == null) return;

      oldInput.removeDocumentListener(this);
    }
 /**
  * Stop listening to changes (so that we're able to change the document in this class without
  * having any loops back into the function that will change it)
  */
 protected synchronized void startDisconnected() {
   if (disconnectionLevel == 0) {
     doc.removeDocumentListener(this);
   }
   disconnectionLevel += 1;
 }
 public void deregisterListener() {
   IDocument doc = console.getDocument();
   doc.removeDocumentListener(this);
 }