Eclipse CDT
7.0

org.eclipse.cdt.core.model
Class LanguageManager

java.lang.Object
  extended by org.eclipse.cdt.core.model.LanguageManager

public class LanguageManager
extends java.lang.Object


Constructor Summary
LanguageManager()
           
 
Method Summary
 java.util.ArrayList<java.lang.String> getAllContentTypes()
          Deprecated. use getRegisteredContentTypes() instead.
 java.util.Map<java.lang.String,ILanguageDescriptor[]> getContentTypeIdToLanguageDescriptionsMap()
           
 IContributedModelBuilder getContributedModelBuilderFor(ITranslationUnit tu)
           
 IContributedModelBuilder getContributedModelBuilderFor(org.eclipse.cdt.internal.core.model.TranslationUnit tu)
          Deprecated. use getContributedModelBuilderFor(ITranslationUnit), instead.
static LanguageManager getInstance()
           
 ILanguage getLanguage(IContentType contentType)
           
 ILanguage getLanguage(IContentType contentType, IProject project)
          Returns language binding to a particular content type for given project.
 ILanguage getLanguage(IContentType contentType, IProject project, org.eclipse.cdt.core.settings.model.ICConfigurationDescription configurationDescription)
          Returns language binding to a particular content type for given project.
 ILanguage getLanguage(java.lang.String id)
           
 org.eclipse.cdt.core.language.ProjectLanguageConfiguration getLanguageConfiguration(IProject project)
          Returns the language configuration for the given project.
 ILanguageDescriptor getLanguageDescriptor(java.lang.String id)
           
 ILanguageDescriptor[] getLanguageDescriptors()
           
 ILanguage getLanguageForContentTypeID(java.lang.String contentTypeID)
           
 ILanguage getLanguageForFile(IFile file, org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration)
          Returns an ILanguage representing the language to be used for the given file.
 ILanguage getLanguageForFile(IFile file, org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration, java.lang.String contentTypeId)
          Returns an ILanguage representing the language to be used for the given file.
 ILanguage getLanguageForFile(IPath pathToFile, IProject project, org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration)
          Returns an ILanguage representing the language to be used for the given file.
 ILanguage getLanguageForFile(IPath pathToFile, IProject project, org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration, java.lang.String contentTypeID)
          Returns an ILanguage representing the language to be used for the given file.
 ILanguage getLanguageForFile(java.lang.String fullPathToFile, IProject project, org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration)
          Returns an ILanguage representing the language to be used for the given file.
 java.util.Map<java.lang.String,org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory> getPDOMLinkageFactoryMappings()
          Returns mappings between IDs and IPDOMLinkageFactory.
 java.lang.String[] getRegisteredContentTypeIds()
          Returns all content types that are registered with CDT.
 ILanguage[] getRegisteredLanguages()
          Returns all of the languages registered with the Platform.
 org.eclipse.cdt.core.language.WorkspaceLanguageConfiguration getWorkspaceLanguageConfiguration()
          Returns the language configuration for the workspace.
 boolean isContributedContentType(java.lang.String contentTypeId)
           
 void notifyLanguageChangeListeners(ILanguageMappingChangeEvent event)
          Notifies all language mappings change listeners of a change in the mappings.
 void registerLanguageChangeListener(ILanguageMappingChangeListener listener)
          Adds a listener that will be notified of changes in language mappings.
 void storeLanguageMappingConfiguration(IFile file)
          Saves the language configuration for the given file to persistent storage and notifies all ILanguageMappingChangeListeners of changes.
 void storeLanguageMappingConfiguration(IProject project, IContentType[] affectedContentTypes)
          Saves the language configuration for the given project to persistent storage and notifies all ILanguageMappingChangeListeners of changes.
 void storeWorkspaceLanguageConfiguration(IContentType[] affectedContentTypes)
          Saves the workspace language configuration to persistent storage and notifies all ILanguageMappingChangeListeners of changes.
 void unregisterLanguageChangeListener(ILanguageMappingChangeListener listener)
          Removes a language mapping change listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LanguageManager

public LanguageManager()
Method Detail

getInstance

public static LanguageManager getInstance()

getLanguageDescriptor

public ILanguageDescriptor getLanguageDescriptor(java.lang.String id)

getLanguageDescriptors

public ILanguageDescriptor[] getLanguageDescriptors()

getContentTypeIdToLanguageDescriptionsMap

public java.util.Map<java.lang.String,ILanguageDescriptor[]> getContentTypeIdToLanguageDescriptionsMap()

getLanguage

public ILanguage getLanguage(java.lang.String id)

getLanguage

public ILanguage getLanguage(IContentType contentType)

getLanguageForContentTypeID

public ILanguage getLanguageForContentTypeID(java.lang.String contentTypeID)

getAllContentTypes

@Deprecated
public java.util.ArrayList<java.lang.String> getAllContentTypes()
Deprecated. use getRegisteredContentTypes() instead.


getRegisteredContentTypeIds

public java.lang.String[] getRegisteredContentTypeIds()
Returns all content types that are registered with CDT.

Since:
3.1.1

isContributedContentType

public boolean isContributedContentType(java.lang.String contentTypeId)

getContributedModelBuilderFor

@Deprecated
public IContributedModelBuilder getContributedModelBuilderFor(org.eclipse.cdt.internal.core.model.TranslationUnit tu)
Deprecated. use getContributedModelBuilderFor(ITranslationUnit), instead.


getContributedModelBuilderFor

public IContributedModelBuilder getContributedModelBuilderFor(ITranslationUnit tu)
Since:
5.1

getPDOMLinkageFactoryMappings

public java.util.Map<java.lang.String,org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory> getPDOMLinkageFactoryMappings()
Returns mappings between IDs and IPDOMLinkageFactory. The IDs are defined in ILinkage.

Returns:
a map.
Since:
4.0

getRegisteredLanguages

public ILanguage[] getRegisteredLanguages()
Returns all of the languages registered with the Platform.

Returns:
all of the languages registered with the Platform.

getWorkspaceLanguageConfiguration

public org.eclipse.cdt.core.language.WorkspaceLanguageConfiguration getWorkspaceLanguageConfiguration()
                                                                                               throws CoreException
Returns the language configuration for the workspace.

Returns:
the language configuration for the workspace
Throws:
CoreException
Since:
4.0

storeWorkspaceLanguageConfiguration

public void storeWorkspaceLanguageConfiguration(IContentType[] affectedContentTypes)
                                         throws CoreException
Saves the workspace language configuration to persistent storage and notifies all ILanguageMappingChangeListeners of changes.

Parameters:
affectedContentTypes -
Throws:
CoreException
Since:
4.0

getLanguageConfiguration

public org.eclipse.cdt.core.language.ProjectLanguageConfiguration getLanguageConfiguration(IProject project)
                                                                                    throws CoreException
Returns the language configuration for the given project.

Parameters:
project -
Returns:
the language configuration for the given project
Throws:
CoreException
Since:
4.0

storeLanguageMappingConfiguration

public void storeLanguageMappingConfiguration(IProject project,
                                              IContentType[] affectedContentTypes)
                                       throws CoreException
Saves the language configuration for the given project to persistent storage and notifies all ILanguageMappingChangeListeners of changes.

Parameters:
project -
affectedContentTypes -
Throws:
CoreException
Since:
4.0

getLanguageForFile

public ILanguage getLanguageForFile(java.lang.String fullPathToFile,
                                    IProject project,
                                    org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration)
                             throws CoreException
Returns an ILanguage representing the language to be used for the given file.

Parameters:
fullPathToFile - the full path to the file for which the language is requested
project - the IProject that this file is in the context of. This field cannot be null.
configuration - the active build configuration, or null if build configurations are not relevant to determining the language.
Returns:
an ILanguage representing the language to be used for the given file
Throws:
CoreException
Since:
4.0

getLanguageForFile

public ILanguage getLanguageForFile(IPath pathToFile,
                                    IProject project,
                                    org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration)
                             throws CoreException
Returns an ILanguage representing the language to be used for the given file.

Parameters:
pathToFile - the path to the file for which the language is requested. The path can be either workspace or project relative.
project - the project that this file should be parsed in context of. This field is optional and may be set to null. If the project is null then this method tries to determine the project context via workspace APIs.
configuration - the active build configuration, or null if build configurations are not relevant to determining the language.
Returns:
an ILanguage representing the language to be used for the given file
Throws:
CoreException
Since:
4.0

getLanguageForFile

public ILanguage getLanguageForFile(IPath pathToFile,
                                    IProject project,
                                    org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration,
                                    java.lang.String contentTypeID)
                             throws CoreException
Returns an ILanguage representing the language to be used for the given file.

Parameters:
pathToFile - the path to the file for which the language is requested. The path can be either workspace or project relative.
project - the project that this file should be parsed in context of. This field is optional and may be set to null. If the project is null then this method tries to determine the project context via workspace APIs.
configuration - the active build configuration, or null if build configurations are not relevant to determining the language.
contentTypeID - id of the content type, may be null.
Returns:
an ILanguage representing the language to be used for the given file
Throws:
CoreException
Since:
4.0

getLanguageForFile

public ILanguage getLanguageForFile(IFile file,
                                    org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration)
                             throws CoreException
Returns an ILanguage representing the language to be used for the given file.

Parameters:
file - the file for which the language is requested
configuration - the active build configuration, or null if build configurations are not relevant to determining the language.
Returns:
an ILanguage representing the language to be used for the given file
Throws:
CoreException
Since:
4.0

getLanguageForFile

public ILanguage getLanguageForFile(IFile file,
                                    org.eclipse.cdt.core.settings.model.ICConfigurationDescription configuration,
                                    java.lang.String contentTypeId)
                             throws CoreException
Returns an ILanguage representing the language to be used for the given file.

Parameters:
file - the file for which the language is requested
configuration - the active build configuration, or null if build configurations are not relevant to determining the language.
contentTypeId - id of the content type, may be null.
Returns:
an ILanguage representing the language to be used for the given file
Throws:
CoreException
Since:
4.0

registerLanguageChangeListener

public void registerLanguageChangeListener(ILanguageMappingChangeListener listener)
Adds a listener that will be notified of changes in language mappings.

Parameters:
listener - the ILanguageMappingChangeListener to add

unregisterLanguageChangeListener

public void unregisterLanguageChangeListener(ILanguageMappingChangeListener listener)
Removes a language mapping change listener.

Parameters:
listener - the ILanguageMappingChangeListener to remove.

notifyLanguageChangeListeners

public void notifyLanguageChangeListeners(ILanguageMappingChangeEvent event)
Notifies all language mappings change listeners of a change in the mappings.

Parameters:
event - the ILanguageMappingsChange event to be broadcast.

storeLanguageMappingConfiguration

public void storeLanguageMappingConfiguration(IFile file)
                                       throws CoreException
Saves the language configuration for the given file to persistent storage and notifies all ILanguageMappingChangeListeners of changes.

Parameters:
file -
Throws:
CoreException
Since:
4.0

getLanguage

public ILanguage getLanguage(IContentType contentType,
                             IProject project)
Returns language binding to a particular content type for given project. This method will check project settings, workspace settings and default bindings (in that order)

Parameters:
contentType - content type of the file
project - C/C++ workspace project
Returns:
CDT language object
Since:
5.4

getLanguage

public ILanguage getLanguage(IContentType contentType,
                             IProject project,
                             org.eclipse.cdt.core.settings.model.ICConfigurationDescription configurationDescription)
Returns language binding to a particular content type for given project. This method will check project settings, workspace settings and default bindings (in that order)

Parameters:
contentType - content type of the file
project - C/C++ workspace project
configurationDescription - build configuration or null
Returns:
CDT language object
Since:
5.4

Eclipse CDT
7.0

Copyright (c) IBM Corp. and others 2004, 2012. All Rights Reserved.