Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse JDT
Release 3.5

org.eclipse.jdt.ui
Class SharedASTProvider

java.lang.Object
  extended by 
org.eclipse.jdt.ui.SharedASTProvider

public final class SharedASTProvider
extends Object

The SharedASTProvider provides access to the AST root used by the current active Java editor.

For performance reasons, not more than one AST should be kept in memory at a time. Therefore, clients must not keep any references to the shared AST or its nodes or bindings.

Clients can make the following assumptions about the AST:

  • the AST has a ITypeRoot as source: CompilationUnit.getTypeRoot() is not null.
  • the AST API level is API level 3 or higher
  • the AST has bindings resolved ( AST.hasResolvedBindings())
  • statement and bindings recovery are enabled
  • It is possible that in the future a higher API level is used, or that future options will be enabled.

    The returned AST is shared. It is marked as ASTNode.PROTECT and must not be modified. Clients are advised to use the non-modifying ASTRewrite to get update scripts.

    This class is not intended to be subclassed or instantiated by clients.

    Since:
    3.4
    Restriction:
    This class is not intended to be instantiated by clients.

    Nested Class Summary
    static class SharedASTProvider.WAIT_FLAG
              Wait flag class.
     
    Field Summary
    static  SharedASTProvider.WAIT_FLAG WAIT_ACTIVE_ONLY
              Wait flag indicating that a client requesting an AST only wants to wait for the shared AST of the active editor.
    static  SharedASTProvider.WAIT_FLAG WAIT_NO
              Wait flag indicating that a client requesting an AST only wants the already available shared AST.
    static  SharedASTProvider.WAIT_FLAG WAIT_YES
              Wait flag indicating that a client requesting an AST wants to wait until an AST is ready.
     
    Method Summary
    static  CompilationUnit getAST ( ITypeRoot element, SharedASTProvider.WAIT_FLAG waitFlag, IProgressMonitor progressMonitor)
              Returns a compilation unit AST for the given Java element.
     
    Methods inherited from class java.lang. Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    WAIT_YES

    public static final 
    SharedASTProvider.WAIT_FLAG 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

    public static final 
    SharedASTProvider.WAIT_FLAG 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

    public static final 
    SharedASTProvider.WAIT_FLAG 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 Detail

    getAST

    public static 
    CompilationUnit getAST(
    ITypeRoot element,
                                         
    SharedASTProvider.WAIT_FLAG waitFlag,
                                         
    IProgressMonitor progressMonitor)
    Returns a compilation unit AST for the given Java element. If the element is the input of the active Java editor, the AST is the shared AST.

    Clients are not allowed to modify the AST and must not keep any references.

    Parameters:
    element - the ITypeRoot, must not be null
    waitFlag - WAIT_YES, WAIT_NO or WAIT_ACTIVE_ONLY
    progressMonitor - the progress monitor or null
    Returns:
    the AST or null.
  • if WAIT_NO has been specified null is returned if the element is not input of the current Java editor or no AST is available
  • if WAIT_ACTIVE_ONLY has been specified null is returned if the element is not input of the current Java editor
  • if WAIT_YES has been specified either the shared AST is returned or a new AST is created.

  • Eclipse JDT
    Release 3.5

    Copyright (c) IBM Corp. and others 2000, 2008. All Rights Reserved.

     
     
      Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire