Class 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 Detail

      • LanguageManager

        public LanguageManager()
    • Method Detail

      • getLanguage

        public ILanguage getLanguage​(org.eclipse.core.runtime.content.IContentType contentType)
      • getLanguageForContentTypeID

        public ILanguage getLanguageForContentTypeID​(String contentTypeID)
      • 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)
      • getPDOMLinkageFactoryMappings

        public Map<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 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 all ILanguageMappingChangeListeners 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 all ILanguageMappingChangeListeners 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 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:
        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, 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:
        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, 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:
        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 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:
        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 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:
        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 all ILanguageMappingChangeListeners 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 file
        project - 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 file
        project - C/C++ workspace project
        configurationDescription - build configuration or null
        Returns:
        CDT language object
        Since:
        5.4