/** * Informs that reconciling for the given element is about to be started. * * @param javaElement the Java element * @see org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#aboutToBeReconciled() */ void aboutToBeReconciled(ITypeRoot javaElement) { if (javaElement == null) return; if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "about to reconcile: " + toString(javaElement)); //$NON-NLS-1$ //$NON-NLS-2$ synchronized (fReconcileLock) { fReconcilingJavaElement= javaElement; fIsReconciling= true; } cache(null, javaElement); }
/** * Informs that reconciling for the given element is about to be started. * * @param javaElement the Java element * @see org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#aboutToBeReconciled() */ void aboutToBeReconciled(IJavaElement javaElement) { if (javaElement == null) return; if (DEBUG) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "about to reconcile: " + toString(javaElement)); //$NON-NLS-1$ //$NON-NLS-2$ synchronized (fReconcileLock) { fIsReconciling= true; fReconcilingJavaElement= javaElement; } cache(null, javaElement); }
/** * Disposes the cached AST. */ private synchronized void disposeAST() { if (fAST == null) return; if (DEBUG) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "disposing AST: " + toString(fAST) + " for: " + toString(fActiveJavaElement)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ fAST= null; cache(null, null); }
void reconciled(CompilationUnit ast, IJavaElement javaElement, IProgressMonitor progressMonitor) { if (DEBUG) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "reconciled: " + toString(javaElement) + ", AST: " + toString(ast)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ synchronized (fReconcileLock) { fIsReconciling= progressMonitor != null && progressMonitor.isCanceled(); if (javaElement == null || !javaElement.equals(fReconcilingJavaElement)) { if (DEBUG) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + " ignoring AST of out-dated editor"); //$NON-NLS-1$ //$NON-NLS-2$ // Signal - threads might wait for wrong element synchronized (fWaitLock) { fWaitLock.notifyAll(); } return; } cache(ast, javaElement); } }
/** * Disposes the cached AST. */ private synchronized void disposeAST() { if (fAST == null) return; if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "disposing AST: " + toString(fAST) + " for: " + toString(fActiveJavaElement)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ fAST= null; cache(null, null); }
private void activeJavaEditorChanged(IWorkbenchPart editor) { IJavaElement javaElement= null; if (editor instanceof JavaEditor) javaElement= ((JavaEditor)editor).getInputJavaElement(); synchronized (this) { fActiveEditor= editor; fActiveJavaElement= javaElement; cache(null, javaElement); } if (DEBUG) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "active editor is: " + toString(javaElement)); //$NON-NLS-1$ //$NON-NLS-2$ synchronized (fReconcileLock) { if (fIsReconciling && (fReconcilingJavaElement == null || !fReconcilingJavaElement.equals(javaElement))) { fIsReconciling= false; fReconcilingJavaElement= null; } else if (javaElement == null) { fIsReconciling= false; fReconcilingJavaElement= null; } } }
void activeJavaEditorChanged(IWorkbenchPart editor) { ITypeRoot javaElement= null; if (editor instanceof JavaEditor) javaElement= ((JavaEditor)editor).getInputJavaElement(); synchronized (this) { fActiveEditor= editor; fActiveJavaElement= javaElement; cache(null, javaElement); } if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "active editor is: " + toString(javaElement)); //$NON-NLS-1$ //$NON-NLS-2$ synchronized (fReconcileLock) { if (fIsReconciling && (fReconcilingJavaElement == null || !fReconcilingJavaElement.equals(javaElement))) { fIsReconciling= false; fReconcilingJavaElement= null; } else if (javaElement == null) { fIsReconciling= false; fReconcilingJavaElement= null; } } }
/** * Update internal structures after reconcile. * * @param ast the compilation unit AST or <code>null</code> if the working copy was consistent * or reconciliation has been cancelled * @param javaElement the Java element for which the AST was built * @param progressMonitor the progress monitor * @see org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#reconciled(CompilationUnit, * boolean, IProgressMonitor) */ void reconciled(CompilationUnit ast, ITypeRoot javaElement, IProgressMonitor progressMonitor) { if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + "reconciled: " + toString(javaElement) + ", AST: " + toString(ast)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ synchronized (fReconcileLock) { fIsReconciling= false; if (javaElement == null || !javaElement.equals(fReconcilingJavaElement)) { if (JavaPlugin.DEBUG_AST_PROVIDER) System.out.println(getThreadName() + " - " + DEBUG_PREFIX + " ignoring AST of out-dated editor"); //$NON-NLS-1$ //$NON-NLS-2$ // Signal - threads might wait for wrong element synchronized (fWaitLock) { fWaitLock.notifyAll(); } return; } cache(ast, javaElement); } }