@Override public void documentChanged(DocumentEvent e) { if (fThread.isActive() || !fThread.isDirty() && fThread.isAlive()) { if (!fIsAllowedToModifyDocument && Thread.currentThread() == fThread) throw new UnsupportedOperationException("The reconciler thread is not allowed to modify the document"); //$NON-NLS-1$ aboutToBeReconciled(); } /* * The second OR condition handles the case when the document * gets changed while still inside initialProcess(). */ if (fThread.isActive() || fThread.isDirty() && fThread.isAlive()) fProgressMonitor.setCanceled(true); if (fIsIncrementalReconciler) createDirtyRegion(e); fThread.reset(); }
@Override public void documentChanged(DocumentEvent e) { if (fThread.isActive() || !fThread.isDirty() && fThread.isAlive()) { if (!fIsAllowedToModifyDocument && Thread.currentThread() == fThread) throw new UnsupportedOperationException("The reconciler thread is not allowed to modify the document"); //$NON-NLS-1$ aboutToBeReconciled(); } /* * The second OR condition handles the case when the document * gets changed while still inside initialProcess(). */ if (fThread.isActive() || fThread.isDirty() && fThread.isAlive()) fProgressMonitor.setCanceled(true); if (fIsIncrementalReconciler) createDirtyRegion(e); fThread.reset(); }
/** * Starts the reconciler to reconcile the queued dirty-regions. * Clients may extend this method. */ protected synchronized void startReconciling() { if (fThread == null) return; if (!fThread.isAlive()) { try { fThread.start(); } catch (IllegalThreadStateException e) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=40549 // This is the only instance where the thread is started; since // we checked that it is not alive, it must be dead already due // to a run-time exception or error. Exit. } } else { fThread.reset(); } }
@Override public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { if (oldInput == fDocument) { if (fDocument != null) fDocument.removeDocumentListener(this); if (fIsIncrementalReconciler) { synchronized (fDirtyRegionQueue) { fDirtyRegionQueue.purgeQueue(); } if (fDocument != null && fDocument.getLength() > 0 && fThread.isDirty() && fThread.isAlive()) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), ""); //$NON-NLS-1$ createDirtyRegion(e); fThread.reset(); fThread.suspendCallerWhileDirty(); } } fDocument= null; } }
/** * Starts the reconciler to reconcile the queued dirty-regions. * Clients may extend this method. */ protected synchronized void startReconciling() { if (fThread == null) return; if (!fThread.isAlive()) { try { fThread.start(); } catch (IllegalThreadStateException e) { // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=40549 // This is the only instance where the thread is started; since // we checked that it is not alive, it must be dead already due // to a run-time exception or error. Exit. } } else { fThread.reset(); } }
@Override public void inputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput) { if (oldInput == fDocument) { if (fDocument != null) fDocument.removeDocumentListener(this); if (fIsIncrementalReconciler) { synchronized (fDirtyRegionQueue) { fDirtyRegionQueue.purgeQueue(); } if (fDocument != null && fDocument.getLength() > 0 && fThread.isDirty() && fThread.isAlive()) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), ""); //$NON-NLS-1$ createDirtyRegion(e); fThread.reset(); fThread.suspendCallerWhileDirty(); } } fDocument= null; } }
/** * Forces the reconciler to reconcile the structure of the whole document. * Clients may extend this method. */ protected void forceReconciling() { if (fDocument != null) { if (!fThread.isDirty()&& fThread.isAlive()) aboutToBeReconciled(); if (fThread.isActive()) fProgressMonitor.setCanceled(true); if (fIsIncrementalReconciler) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), fDocument.get()); createDirtyRegion(e); } startReconciling(); } }
/** * Forces the reconciler to reconcile the structure of the whole document. * Clients may extend this method. */ protected void forceReconciling() { if (fDocument != null) { if (!fThread.isDirty()&& fThread.isAlive()) aboutToBeReconciled(); if (fThread.isActive()) fProgressMonitor.setCanceled(true); if (fIsIncrementalReconciler) { DocumentEvent e= new DocumentEvent(fDocument, 0, fDocument.getLength(), fDocument.get()); createDirtyRegion(e); } startReconciling(); } }