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 Details

    • ProjectLanguageConfiguration

      public ProjectLanguageConfiguration()
      Creates a new ProjectLanguageConfiguration 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. If configuration is null, 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. If configuration is null, 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. If configuration is null, 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. If configuration is not null, 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). If configuration is null, 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. If configuration is not null, 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. If configuration is not null, 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). If configuration is null, 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). If configuration is null, 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 -
    • setFileMappings

      public 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.
      Parameters:
      mappings -