Package org.eclipse.cdt.core.model
Class LanguageManager
- java.lang.Object
-
- org.eclipse.cdt.core.model.LanguageManager
-
public class LanguageManager extends Object
- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
-
Constructor Summary
Constructors Constructor Description LanguageManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ArrayList<String>
getAllContentTypes()
Deprecated.use getRegisteredContentTypes() instead.Map<String,ILanguageDescriptor[]>
getContentTypeIdToLanguageDescriptionsMap()
IContributedModelBuilder
getContributedModelBuilderFor(ITranslationUnit tu)
IContributedModelBuilder
getContributedModelBuilderFor(org.eclipse.cdt.internal.core.model.TranslationUnit tu)
Deprecated.usegetContributedModelBuilderFor(ITranslationUnit)
, instead.static LanguageManager
getInstance()
ILanguage
getLanguage(String id)
ILanguage
getLanguage(org.eclipse.core.runtime.content.IContentType contentType)
ILanguage
getLanguage(org.eclipse.core.runtime.content.IContentType contentType, org.eclipse.core.resources.IProject project)
Returns language binding to a particular content type for given project.ILanguage
getLanguage(org.eclipse.core.runtime.content.IContentType contentType, org.eclipse.core.resources.IProject project, ICConfigurationDescription configurationDescription)
Returns language binding to a particular content type for given project.ProjectLanguageConfiguration
getLanguageConfiguration(org.eclipse.core.resources.IProject project)
Returns the language configuration for the given project.ILanguageDescriptor
getLanguageDescriptor(String id)
ILanguageDescriptor[]
getLanguageDescriptors()
ILanguage
getLanguageForContentTypeID(String contentTypeID)
ILanguage
getLanguageForFile(String fullPathToFile, org.eclipse.core.resources.IProject project, ICConfigurationDescription configuration)
Returns an ILanguage representing the language to be used for the given file.ILanguage
getLanguageForFile(org.eclipse.core.resources.IFile file, ICConfigurationDescription configuration)
Returns an ILanguage representing the language to be used for the given file.ILanguage
getLanguageForFile(org.eclipse.core.resources.IFile file, ICConfigurationDescription configuration, String contentTypeId)
Returns an ILanguage representing the language to be used for the given file.ILanguage
getLanguageForFile(org.eclipse.core.runtime.IPath pathToFile, org.eclipse.core.resources.IProject project, ICConfigurationDescription configuration)
Returns an ILanguage representing the language to be used for the given file.ILanguage
getLanguageForFile(org.eclipse.core.runtime.IPath pathToFile, org.eclipse.core.resources.IProject project, ICConfigurationDescription configuration, String contentTypeID)
Returns an ILanguage representing the language to be used for the given file.Map<String,org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory>
getPDOMLinkageFactoryMappings()
Returns mappings between IDs and IPDOMLinkageFactory.String[]
getRegisteredContentTypeIds()
Returns all content types that are registered with CDT.ILanguage[]
getRegisteredLanguages()
Returns all of the languages registered with thePlatform
.WorkspaceLanguageConfiguration
getWorkspaceLanguageConfiguration()
Returns the language configuration for the workspace.boolean
isContributedContentType(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(org.eclipse.core.resources.IFile file)
Saves the language configuration for the given file to persistent storage and notifies allILanguageMappingChangeListeners
of changes.void
storeLanguageMappingConfiguration(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.content.IContentType[] affectedContentTypes)
Saves the language configuration for the given project to persistent storage and notifies allILanguageMappingChangeListeners
of changes.void
storeWorkspaceLanguageConfiguration(org.eclipse.core.runtime.content.IContentType[] affectedContentTypes)
Saves the workspace language configuration to persistent storage and notifies allILanguageMappingChangeListeners
of changes.void
unregisterLanguageChangeListener(ILanguageMappingChangeListener listener)
Removes a language mapping change listener.
-
-
-
Method Detail
-
getInstance
public static LanguageManager getInstance()
-
getLanguageDescriptor
public ILanguageDescriptor getLanguageDescriptor(String id)
-
getLanguageDescriptors
public ILanguageDescriptor[] getLanguageDescriptors()
-
getContentTypeIdToLanguageDescriptionsMap
public Map<String,ILanguageDescriptor[]> getContentTypeIdToLanguageDescriptionsMap()
-
getLanguage
public ILanguage getLanguage(org.eclipse.core.runtime.content.IContentType contentType)
-
getAllContentTypes
@Deprecated public ArrayList<String> getAllContentTypes()
Deprecated.use getRegisteredContentTypes() instead.
-
getRegisteredContentTypeIds
public String[] getRegisteredContentTypeIds()
Returns all content types that are registered with CDT.- Since:
- 3.1.1
-
isContributedContentType
public boolean isContributedContentType(String contentTypeId)
-
getContributedModelBuilderFor
@Deprecated public IContributedModelBuilder getContributedModelBuilderFor(org.eclipse.cdt.internal.core.model.TranslationUnit tu)
Deprecated.usegetContributedModelBuilderFor(ITranslationUnit)
, instead.- Restriction:
- This method is not intended to be referenced by clients.
-
getContributedModelBuilderFor
public IContributedModelBuilder getContributedModelBuilderFor(ITranslationUnit tu)
- Since:
- 5.1
-
getPDOMLinkageFactoryMappings
public Map<String,org.eclipse.cdt.internal.core.pdom.dom.IPDOMLinkageFactory> getPDOMLinkageFactoryMappings()
Returns mappings between IDs and IPDOMLinkageFactory. The IDs are defined inILinkage
.- Returns:
- a map.
- Since:
- 4.0
-
getRegisteredLanguages
public ILanguage[] getRegisteredLanguages()
Returns all of the languages registered with thePlatform
.- Returns:
- all of the languages registered with the
Platform
.
-
getWorkspaceLanguageConfiguration
public WorkspaceLanguageConfiguration getWorkspaceLanguageConfiguration() throws org.eclipse.core.runtime.CoreException
Returns the language configuration for the workspace.- Returns:
- the language configuration for the workspace
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
storeWorkspaceLanguageConfiguration
public void storeWorkspaceLanguageConfiguration(org.eclipse.core.runtime.content.IContentType[] affectedContentTypes) throws org.eclipse.core.runtime.CoreException
Saves the workspace language configuration to persistent storage and notifies allILanguageMappingChangeListeners
of changes.- Parameters:
affectedContentTypes
-- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getLanguageConfiguration
public ProjectLanguageConfiguration getLanguageConfiguration(org.eclipse.core.resources.IProject project) throws org.eclipse.core.runtime.CoreException
Returns the language configuration for the given project.- Parameters:
project
-- Returns:
- the language configuration for the given project
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
storeLanguageMappingConfiguration
public void storeLanguageMappingConfiguration(org.eclipse.core.resources.IProject project, org.eclipse.core.runtime.content.IContentType[] affectedContentTypes) throws org.eclipse.core.runtime.CoreException
Saves the language configuration for the given project to persistent storage and notifies allILanguageMappingChangeListeners
of changes.- Parameters:
project
-affectedContentTypes
-- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getLanguageForFile
public ILanguage getLanguageForFile(String fullPathToFile, org.eclipse.core.resources.IProject project, ICConfigurationDescription configuration) throws org.eclipse.core.runtime.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 requestedproject
- the IProject that this file is in the context of. This field cannot be null.configuration
- the active build configuration, ornull
if build configurations are not relevant to determining the language.- Returns:
- an ILanguage representing the language to be used for the given file
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getLanguageForFile
public ILanguage getLanguageForFile(org.eclipse.core.runtime.IPath pathToFile, org.eclipse.core.resources.IProject project, ICConfigurationDescription configuration) throws org.eclipse.core.runtime.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, ornull
if build configurations are not relevant to determining the language.- Returns:
- an ILanguage representing the language to be used for the given file
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getLanguageForFile
public ILanguage getLanguageForFile(org.eclipse.core.runtime.IPath pathToFile, org.eclipse.core.resources.IProject project, ICConfigurationDescription configuration, String contentTypeID) throws org.eclipse.core.runtime.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, ornull
if build configurations are not relevant to determining the language.contentTypeID
- id of the content type, may benull
.- Returns:
- an ILanguage representing the language to be used for the given file
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getLanguageForFile
public ILanguage getLanguageForFile(org.eclipse.core.resources.IFile file, ICConfigurationDescription configuration) throws org.eclipse.core.runtime.CoreException
Returns an ILanguage representing the language to be used for the given file.- Parameters:
file
- the file for which the language is requestedconfiguration
- the active build configuration, ornull
if build configurations are not relevant to determining the language.- Returns:
- an ILanguage representing the language to be used for the given file
- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getLanguageForFile
public ILanguage getLanguageForFile(org.eclipse.core.resources.IFile file, ICConfigurationDescription configuration, String contentTypeId) throws org.eclipse.core.runtime.CoreException
Returns an ILanguage representing the language to be used for the given file.- Parameters:
file
- the file for which the language is requestedconfiguration
- the active build configuration, ornull
if build configurations are not relevant to determining the language.contentTypeId
- id of the content type, may benull
.- Returns:
- an ILanguage representing the language to be used for the given file
- Throws:
org.eclipse.core.runtime.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(org.eclipse.core.resources.IFile file) throws org.eclipse.core.runtime.CoreException
Saves the language configuration for the given file to persistent storage and notifies allILanguageMappingChangeListeners
of changes.- Parameters:
file
-- Throws:
org.eclipse.core.runtime.CoreException
- Since:
- 4.0
-
getLanguage
public ILanguage getLanguage(org.eclipse.core.runtime.content.IContentType contentType, org.eclipse.core.resources.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 fileproject
- C/C++ workspace project- Returns:
- CDT language object
- Since:
- 5.4
-
getLanguage
public ILanguage getLanguage(org.eclipse.core.runtime.content.IContentType contentType, org.eclipse.core.resources.IProject project, 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 fileproject
- C/C++ workspace projectconfigurationDescription
- build configuration ornull
- Returns:
- CDT language object
- Since:
- 5.4
-
-