org.eclipse.cdt.core.dom
Class CDOM

java.lang.Object
  extended by org.eclipse.cdt.core.dom.CDOM
All Implemented Interfaces:
IASTServiceProvider

public class CDOM
extends java.lang.Object
implements IASTServiceProvider

Author:
jcamelon This class serves as the manager of the AST/DOM mechanisms for the CDT. It should be eventually added to CCorePlugin for startup.

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.cdt.core.dom.IASTServiceProvider
IASTServiceProvider.UnsupportedDialectException
 
Field Summary
static int PARSE_SAVED_RESOURCES
          Constant PARSE_SAVED_RESOURCES - Parse saved resources in the workspace
static int PARSE_WORKING_COPY_WHENEVER_POSSIBLE
          Constant PARSE_WORKING_COPY_WHENEVER_POSSIBLE - Parse working copy whenever possible for both header files and the file in question as a translation unit.
static int PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS
          Constant PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS - Parse working copy for translation unit, saved resources for all header files.
 
Method Summary
 IASTServiceProvider getASTService()
           
 org.eclipse.cdt.core.dom.ICodeReaderFactory getCodeReaderFactory(int key)
          This is the factory function that returns an ICodeReaderFactory instance based upon the key provided.
 org.eclipse.cdt.core.dom.ast.IASTCompletionNode getCompletionNode(org.eclipse.core.resources.IFile fileToParse, int offset, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
          Returns a parse tree that represents the content provided as parameters.
 org.eclipse.cdt.core.dom.ast.IASTCompletionNode getCompletionNode(org.eclipse.core.resources.IStorage fileToParse, org.eclipse.core.resources.IProject project, int offset, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
          Returns a parse tree that represents the content provided as parameters.
static CDOM getInstance()
          accessor for singleton instance
 org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse)
          Returns a parse tree that represents the content provided as parameters.
 org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse, boolean parseComments)
          Returns a parse tree that represents the content provided as parameters.
 org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
          Returns a parse tree that represents the content provided as parameters.
 org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, boolean parseComments)
          Returns a parse tree that represents the content provided as parameters.
 org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator, org.eclipse.cdt.core.dom.IParserConfiguration configuration)
          Returns a parse tree that represents the content provided as parameters.
 org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IStorage fileToParse, org.eclipse.core.resources.IProject project)
          Returns a parse tree that represents the content provided as parameters.
 org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IStorage fileToParse, org.eclipse.core.resources.IProject project, org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
          Returns a parse tree that represents the content provided as parameters.
 void setWorkingCopyProvider(org.eclipse.cdt.core.model.IWorkingCopyProvider workingCopyProvider)
          This method allows a UI component to register its IWorkingCopyProvider to the CDOM.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSE_SAVED_RESOURCES

public static final int PARSE_SAVED_RESOURCES
Constant PARSE_SAVED_RESOURCES - Parse saved resources in the workspace

See Also:
Constant Field Values

PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS

public static final int PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS
Constant PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS - Parse working copy for translation unit, saved resources for all header files.

See Also:
Constant Field Values

PARSE_WORKING_COPY_WHENEVER_POSSIBLE

public static final int PARSE_WORKING_COPY_WHENEVER_POSSIBLE
Constant PARSE_WORKING_COPY_WHENEVER_POSSIBLE - Parse working copy whenever possible for both header files and the file in question as a translation unit.

See Also:
Constant Field Values
Method Detail

getInstance

public static CDOM getInstance()
accessor for singleton instance

Returns:
instance

getASTService

public IASTServiceProvider getASTService()
Returns:
IASTServiceProvider, the mechanism for obtaining an AST

getCodeReaderFactory

public org.eclipse.cdt.core.dom.ICodeReaderFactory getCodeReaderFactory(int key)
This is the factory function that returns an ICodeReaderFactory instance based upon the key provided.

Parameters:
key - one of PARSE_SAVED_RESOURCES, PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS, PARSE_WORKING_COPY_WHENEVER_POSSIBLE
Returns:
an implementation that works according to the key specified or null for an invalid key

getTranslationUnit

public org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse)
                                                                    throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getTranslationUnit in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

getTranslationUnit

public org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse,
                                                                           org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
                                                                    throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getTranslationUnit in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
fileCreator - @see CDOM#getCodeReaderFactory(int)
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

getTranslationUnit

public org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse,
                                                                           org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator,
                                                                           org.eclipse.cdt.core.dom.IParserConfiguration configuration)
                                                                    throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getTranslationUnit in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
fileCreator - @see CDOM#getCodeReaderFactory(int)
configuration - parser configuration provided rather than discovered by service
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

getCompletionNode

public org.eclipse.cdt.core.dom.ast.IASTCompletionNode getCompletionNode(org.eclipse.core.resources.IFile fileToParse,
                                                                         int offset,
                                                                         org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
                                                                  throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getCompletionNode in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
offset - the offset at which you require completion at
fileCreator - @see CDOM#getCodeReaderFactory(int)
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

getCompletionNode

public org.eclipse.cdt.core.dom.ast.IASTCompletionNode getCompletionNode(org.eclipse.core.resources.IStorage fileToParse,
                                                                         org.eclipse.core.resources.IProject project,
                                                                         int offset,
                                                                         org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
                                                                  throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getCompletionNode in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
project - the project containing the scanner info
offset - the offset at which you require completion at
fileCreator - @see CDOM#getCodeReaderFactory(int)
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

setWorkingCopyProvider

public void setWorkingCopyProvider(org.eclipse.cdt.core.model.IWorkingCopyProvider workingCopyProvider)
This method allows a UI component to register its IWorkingCopyProvider to the CDOM.

Parameters:
workingCopyProvider - - UI components buffer manager

getTranslationUnit

public org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IStorage fileToParse,
                                                                           org.eclipse.core.resources.IProject project,
                                                                           org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator)
                                                                    throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getTranslationUnit in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
project - project handle to help us figure out build settings
fileCreator - @see CDOM#getCodeReaderFactory(int)
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

getTranslationUnit

public org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IStorage fileToParse,
                                                                           org.eclipse.core.resources.IProject project)
                                                                    throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getTranslationUnit in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
project - project handle to help us figure out build settings
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

getTranslationUnit

public org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse,
                                                                           boolean parseComments)
                                                                    throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getTranslationUnit in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
parseComments - parse commtents flag
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException

getTranslationUnit

public org.eclipse.cdt.core.dom.ast.IASTTranslationUnit getTranslationUnit(org.eclipse.core.resources.IFile fileToParse,
                                                                           org.eclipse.cdt.core.dom.ICodeReaderFactory fileCreator,
                                                                           boolean parseComments)
                                                                    throws IASTServiceProvider.UnsupportedDialectException
Description copied from interface: IASTServiceProvider
Returns a parse tree that represents the content provided as parameters.

Specified by:
getTranslationUnit in interface IASTServiceProvider
Parameters:
fileToParse - the file in question
fileCreator - @see CDOM#getCodeReaderFactory(int)
parseComments - parse commtents flag
Returns:
syntactical parse tree
Throws:
IASTServiceProvider.UnsupportedDialectException