Class CoreASTProvider
java.lang.Object
org.eclipse.jdt.core.manipulation.CoreASTProvider
The
CoreASTProvider provides access to the AST root used by
the current active Java editor.
The CoreASTProvider contains all methods/functionality that are
not dependent on the UI, from org.eclipse.jdt.internal.ui.javaeditor.ASTProvider
for the purpose of reuse by non-UI bundles.
This class is not intended to be subclassed or instantiated by clients.
- Since:
- 1.10
- Restriction:
- This class is not intended to be instantiated by clients.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final CoreASTProvider.WAIT_FLAGWait flag indicating that a client requesting an AST only wants to wait for the shared AST of the active editor.static final CoreASTProvider.WAIT_FLAGWait flag indicating that a client requesting an AST only wants the already available shared AST.static final CoreASTProvider.WAIT_FLAGWait flag indicating that a client requesting an AST wants to wait until an AST is ready. -
Method Summary
Modifier and TypeMethodDescriptionvoidaboutToBeReconciled(ITypeRoot javaElement) Informs that reconciling for the given element is about to be started.voidaboutToBeReconciled(ITypeRoot javaElement, Runnable finishReconciling) Informs that reconciling for the given element is about to be started.voidcache(CompilationUnit ast, ITypeRoot javaElement) Caches the given compilation unit AST for the given Java element.voidClear the reconciliation state.voidDisposes the cached AST.getAST(ITypeRoot input, CoreASTProvider.WAIT_FLAG waitFlag, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Returns a shared compilation unit AST for the given Java element.static CoreASTProviderstatic Stringbooleanvoidreconciled(CompilationUnit ast, ITypeRoot javaElement, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Update internal structures after reconcile.voidsetActiveJavaElement(ITypeRoot activeJavaElement) Set the active java element that is currently active.Returns a string for the given Java element used for debugging.voidNotify all waiting threads that the AST has changed.
-
Field Details
-
DEBUG_PREFIX
- See Also:
-
WAIT_YES
Wait flag indicating that a client requesting an AST wants to wait until an AST is ready.An AST will be created by this AST provider if the shared AST is not for the given Java element.
-
WAIT_ACTIVE_ONLY
Wait flag indicating that a client requesting an AST only wants to wait for the shared AST of the active editor.No AST will be created by the AST provider.
-
WAIT_NO
Wait flag indicating that a client requesting an AST only wants the already available shared AST.No AST will be created by the AST provider.
-
-
Method Details
-
getAST
public CompilationUnit getAST(ITypeRoot input, CoreASTProvider.WAIT_FLAG waitFlag, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Returns a shared compilation unit AST for the given Java element.Clients are not allowed to modify the AST and must synchronize all access to its nodes.
- Parameters:
input- the Java element, must not benullwaitFlag- org.eclipse.jdt.ui.SharedASTProvider#WAIT_YES, org.eclipse.jdt.ui.SharedASTProvider#WAIT_NO or org.eclipse.jdt.ui.SharedASTProvider#WAIT_ACTIVE_ONLYprogressMonitor- the progress monitor ornull- Returns:
- the AST or
nullif the AST is not available
-
aboutToBeReconciled
Informs that reconciling for the given element is about to be started.- Parameters:
javaElement- the Java element See org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#aboutToBeReconciled()
-
aboutToBeReconciled
Informs that reconciling for the given element is about to be started.- Parameters:
javaElement- the Java elementfinishReconciling- Runnable to be run. see org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#aboutToBeReconciled(JavaReconciler)- Since:
- 1.16
-
reconciled
public void reconciled(CompilationUnit ast, ITypeRoot javaElement, org.eclipse.core.runtime.IProgressMonitor progressMonitor) Update internal structures after reconcile.- Parameters:
ast- the compilation unit AST ornullif the working copy was consistent or reconciliation has been cancelledjavaElement- the Java element for which the AST was builtprogressMonitor- the progress monitor See org.eclipse.jdt.internal.ui.text.java.IJavaReconcilingListener#reconciled(CompilationUnit, boolean, IProgressMonitor)
-
cache
Caches the given compilation unit AST for the given Java element.- Parameters:
ast- the astjavaElement- the java element
-
disposeAST
public void disposeAST()Disposes the cached AST. -
toString
Returns a string for the given Java element used for debugging.- Parameters:
javaElement- the compilation unit AST- Returns:
- a string used for debugging
-
getThreadName
- Returns:
- The name of the current thread if not null. Otherwise this returns the string representation of the current thread.
-
getInstance
- Returns:
- The singleton instance of this class.
-
isReconciling
public boolean isReconciling()- Returns:
- Whether the current java element is being reconciled.
-
getReconcilingJavaElement
- Returns:
- The java element currently being reconciled.
-
getActiveJavaElement
- Returns:
- The active java element.
-
setActiveJavaElement
Set the active java element that is currently active.- Parameters:
activeJavaElement- the java element.
-
getCachedAST
- Returns:
- The compilation unit's cached AST.
-
waitLockNotifyAll
public void waitLockNotifyAll()Notify all waiting threads that the AST has changed. -
clearReconciliation
public void clearReconciliation()Clear the reconciliation state.
-