Package org.eclipse.cdt.core.language
Class ProjectLanguageConfiguration
- java.lang.Object
-
- org.eclipse.cdt.core.language.ProjectLanguageConfiguration
-
public class ProjectLanguageConfiguration extends Object
Provides programmatic access to language mappings for a project.EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same. Please do not use this API without consulting with the CDT team.
- Since:
- 4.0
- Restriction:
- This class is not intended to be subclassed by clients.
- Restriction:
- This class is not intended to be instantiated by clients.
-
-
Constructor Summary
Constructors Constructor Description ProjectLanguageConfiguration()
Creates a newProjectLanguageConfiguration
with no language mappings defined.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addContentTypeMapping(ICConfigurationDescription configuration, String contentType, String language)
Sets the language for a content type.void
addFileMapping(ICConfigurationDescription configuration, String filePath, String language)
Sets the language for a file.void
addFileMapping(ICConfigurationDescription configuration, org.eclipse.core.resources.IFile file, String language)
Sets the language for a file.Map<String,Map<String,String>>
getContentTypeMappings()
Returns a copy of all the per-configuration content type mappings stored in this configuration.Map<String,Map<String,String>>
getFileMappings()
Returns a copy of all the per-file content type mappings stored in this configuration.String
getLanguageForContentType(ICConfigurationDescription configuration, String contentTypeId)
Returns the language id that is mapped to the given content type when the given configuration is active.String
getLanguageForFile(ICConfigurationDescription configuration, String path)
Returns the language id that is mapped to the file located at the given path when the given configuration is active.String
getLanguageForFile(ICConfigurationDescription configuration, org.eclipse.core.resources.IFile file)
Returns the language id that is mapped to the given file when the given configuration is active.void
removeAllFileMappings(String filePath)
Removes all language mappings for the given file.void
removeAllFileMappings(org.eclipse.core.resources.IFile file)
Removes all language mappings for the given file.void
removeContentTypeMapping(ICConfigurationDescription configuration, String contentType)
Removes the given content type mapping (if it exists).void
removeFileMapping(ICConfigurationDescription configuration, String filePath)
Removes the given file mapping (if it exists).void
removeFileMapping(ICConfigurationDescription configuration, org.eclipse.core.resources.IFile file)
Removes the given file mapping (if it exists).void
setContentTypeMappings(Map<String,Map<String,String>> mappings)
This method is used internally by CDT and should not be used outside of the CDT framework.void
setFileMappings(Map<String,Map<String,String>> mappings)
This method is used internally by CDT and should not be used outside of the CDT framework.void
setFileMappings(org.eclipse.core.resources.IFile file, Map<String,String> mappings)
This method is used internally by CDT and should not be used outside of the CDT framework.
-
-
-
Method Detail
-
getLanguageForContentType
public String getLanguageForContentType(ICConfigurationDescription configuration, String contentTypeId)
Returns the language id that is mapped to the given content type when the given configuration is active. Ifconfiguration
isnull
, the configuration-agnostic mapping is returned.- Returns:
- the language id that is mapped to the given content type.
-
getLanguageForFile
public String getLanguageForFile(ICConfigurationDescription configuration, org.eclipse.core.resources.IFile file)
Returns the language id that is mapped to the given file when the given configuration is active. Ifconfiguration
isnull
, the configuration-agnostic mapping is returned.- Returns:
- the language id that is mapped to the given file
-
getLanguageForFile
public String getLanguageForFile(ICConfigurationDescription configuration, String path)
Returns the language id that is mapped to the file located at the given path when the given configuration is active. Ifconfiguration
isnull
, the configuration-agnostic mapping is returned.- Parameters:
path
-- Returns:
- the language id that is mapped to the file located at the given path
-
addContentTypeMapping
public void addContentTypeMapping(ICConfigurationDescription configuration, String contentType, String language)
Sets the language for a content type. Ifconfiguration
is notnull
, the language mapping will only apply when that configuration is active. Otherwise, the mapping will apply for all configurations.- Parameters:
contentType
-language
-
-
removeContentTypeMapping
public void removeContentTypeMapping(ICConfigurationDescription configuration, String contentType)
Removes the given content type mapping (if it exists). Ifconfiguration
isnull
, the configuration-agnostic mapping is removed. Otherwise, the configuration-specific mapping is removed.- Parameters:
contentType
-
-
addFileMapping
public void addFileMapping(ICConfigurationDescription configuration, org.eclipse.core.resources.IFile file, String language)
Sets the language for a file. Ifconfiguration
is notnull
, the language mapping will only apply when that configuration is active. Otherwise, the mapping will apply for all configurations.- Parameters:
file
-language
-
-
addFileMapping
public void addFileMapping(ICConfigurationDescription configuration, String filePath, String language)
Sets the language for a file. Ifconfiguration
is notnull
, the language mapping will only apply when that configuration is active. Otherwise, the mapping will apply for all configurations.- Parameters:
filePath
-language
-
-
removeFileMapping
public void removeFileMapping(ICConfigurationDescription configuration, org.eclipse.core.resources.IFile file)
Removes the given file mapping (if it exists). Ifconfiguration
isnull
, the configuration-agnostic mapping is removed. Otherwise, the configuration-specific mapping is removed.- Parameters:
file
-
-
removeFileMapping
public void removeFileMapping(ICConfigurationDescription configuration, String filePath)
Removes the given file mapping (if it exists). Ifconfiguration
isnull
, the configuration-agnostic mapping is removed. Otherwise, the configuration-specific mapping is removed.- Parameters:
filePath
-
-
removeAllFileMappings
public void removeAllFileMappings(String filePath)
Removes all language mappings for the given file.- Parameters:
filePath
-
-
removeAllFileMappings
public void removeAllFileMappings(org.eclipse.core.resources.IFile file)
Removes all language mappings for the given file.- Parameters:
file
-
-
getContentTypeMappings
public Map<String,Map<String,String>> getContentTypeMappings()
Returns a copy of all the per-configuration content type mappings stored in this configuration. This method is used internally by CDT and should not be used outside of the CDT framework.- Returns:
- a copy of all the per-configuration content type mappings
-
setContentTypeMappings
public void setContentTypeMappings(Map<String,Map<String,String>> mappings)
This method is used internally by CDT and should not be used outside of the CDT framework.
-
getFileMappings
public Map<String,Map<String,String>> getFileMappings()
Returns a copy of all the per-file content type mappings stored in this configuration. This method is used internally by CDT and should not be used outside of the CDT framework.- Returns:
- a copy of all the per-file content type mappings
-
setFileMappings
public void setFileMappings(org.eclipse.core.resources.IFile file, Map<String,String> mappings)
This method is used internally by CDT and should not be used outside of the CDT framework.- Parameters:
file
-
-
-