コード例 #1
0
    /*
     * @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);
    }
コード例 #2
0
ファイル: ImageManager.java プロジェクト: eclipse/mylyn.docs
 public void inputDocumentChanged(IDocument oldInput, IDocument newInput) {
   if (oldInput != null) {
     oldInput.removeDocumentListener(this);
   }
   if (newInput != null) {
     newInput.addDocumentListener(this);
   }
   inspect();
 }
コード例 #3
0
    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);
      }
    }
コード例 #4
0
  /**
   * 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;
  }
コード例 #5
0
 @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);
 }
コード例 #6
0
 @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);
   }
 }
コード例 #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);
   }
 }
コード例 #8
0
 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);
   }
 }
コード例 #9
0
ファイル: OutputViewer.java プロジェクト: akbertram/statet
  @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());
    }
  }
コード例 #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);
        }
      }
    }
コード例 #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);
        }
      }
コード例 #12
0
    /*
     * (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);
    }
コード例 #13
0
 /**
  * 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;
 }
コード例 #14
0
 public void deregisterListener() {
   IDocument doc = console.getDocument();
   doc.removeDocumentListener(this);
 }