/* * @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); }
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); } }
@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); } }
@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()); } }
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); } } }
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); }