@Override public void install(ITextViewer textViewer) { Assert.isNotNull(textViewer); fViewer= textViewer; synchronized (this) { if (fThread != null) return; fThread= new BackgroundThread(getClass().getName()); } fDirtyRegionQueue= new DirtyRegionQueue(); fListener= new Listener(); fViewer.addTextInputListener(fListener); // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=67046 // if the reconciler gets installed on a viewer that already has a document // (e.g. when reusing editors), we force the listener to register // itself as document listener, because there will be no input change // on the viewer. // In order to do that, we simulate an input change. IDocument document= textViewer.getDocument(); if (document != null) { fListener.inputDocumentAboutToBeChanged(fDocument, document); fListener.inputDocumentChanged(fDocument, document); } }
@Override public void install(ITextViewer textViewer) { Assert.isNotNull(textViewer); fViewer= textViewer; synchronized (this) { if (fThread != null) return; fThread= new BackgroundThread(getClass().getName()); } fDirtyRegionQueue= new DirtyRegionQueue(); fListener= new Listener(); fViewer.addTextInputListener(fListener); // see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=67046 // if the reconciler gets installed on a viewer that already has a document // (e.g. when reusing editors), we force the listener to register // itself as document listener, because there will be no input change // on the viewer. // In order to do that, we simulate an input change. IDocument document= textViewer.getDocument(); if (document != null) { fListener.inputDocumentAboutToBeChanged(fDocument, document); fListener.inputDocumentChanged(fDocument, document); } }
@Override public void uninstall() { if (fListener != null) { fViewer.removeTextInputListener(fListener); if (fDocument != null) { fListener.inputDocumentAboutToBeChanged(fDocument, null); fListener.inputDocumentChanged(fDocument, null); } fListener= null; synchronized (this) { // http://dev.eclipse.org/bugs/show_bug.cgi?id=19135 BackgroundThread bt= fThread; fThread= null; bt.cancel(); } } }
@Override public void uninstall() { if (fListener != null) { fViewer.removeTextInputListener(fListener); if (fDocument != null) { fListener.inputDocumentAboutToBeChanged(fDocument, null); fListener.inputDocumentChanged(fDocument, null); } fListener= null; synchronized (this) { // http://dev.eclipse.org/bugs/show_bug.cgi?id=19135 BackgroundThread bt= fThread; fThread= null; bt.cancel(); } } }