Package org.eclipse.cdt.core.language
Class ProjectLanguageConfiguration
java.lang.Object
org.eclipse.cdt.core.language.ProjectLanguageConfiguration
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
ConstructorDescriptionCreates a newProjectLanguageConfiguration
with no language mappings defined. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Returns a copy of all the per-configuration content type mappings stored in this configuration.Returns a copy of all the per-file content type mappings stored in this configuration.getLanguageForContentType
(ICConfigurationDescription configuration, String contentTypeId) Returns the language id that is mapped to the given content type when the given configuration is active.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.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
This method is used internally by CDT and should not be used outside of the CDT framework.void
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.
-
Constructor Details
-
ProjectLanguageConfiguration
public ProjectLanguageConfiguration()Creates a newProjectLanguageConfiguration
with no language mappings defined.
-
-
Method Details
-
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
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
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
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
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
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
This method is used internally by CDT and should not be used outside of the CDT framework. -
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
This method is used internally by CDT and should not be used outside of the CDT framework.- Parameters:
file
-
-
setFileMappings
This method is used internally by CDT and should not be used outside of the CDT framework.- Parameters:
mappings
-
-