Class LanguageSettingsBaseProvider

java.lang.Object
org.eclipse.cdt.core.AbstractExecutableExtensionBase
org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider
All Implemented Interfaces:
ILanguageSettingsProvider
Direct Known Subclasses:
LanguageSettingsSerializableProvider

public class LanguageSettingsBaseProvider extends AbstractExecutableExtensionBase implements ILanguageSettingsProvider
LanguageSettingsBaseProvider is a basic implementation of ILanguageSettingsProvider for the extensions defined by org.eclipse.cdt.core.LanguageSettingsProvider extension point. This implementation supports "static" list of entries for languages specified in the extension point.
Since:
5.4
  • Field Details

    • languageScope

      protected List<String> languageScope
      Language scope, i.e. list of languages the entries will be provided for.
    • properties

      protected Map<String,String> properties
      Provider-specific properties
  • Constructor Details

    • LanguageSettingsBaseProvider

      public LanguageSettingsBaseProvider()
      Default constructor.
    • LanguageSettingsBaseProvider

      public LanguageSettingsBaseProvider(String id, String name)
      Constructor. Creates an "empty" non-configured provider.
      Parameters:
      id - - id of the provider.
      name - - name of the provider to be presented to a user.
    • LanguageSettingsBaseProvider

      public LanguageSettingsBaseProvider(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries)
      Constructor.
      Parameters:
      id - - id of the provider.
      name - - name of the provider to be presented to a user.
      languages - - list of languages the entries provided for. languages can be null, in this case the entries are provided for any language.
      entries - - the list of language settings entries this provider provides. If null is passed, the provider creates an empty list.
    • LanguageSettingsBaseProvider

      public LanguageSettingsBaseProvider(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries, Map<String,String> properties)
      Constructor.
      Parameters:
      id - - id of the provider.
      name - - name of the provider to be presented to a user.
      languages - - list of languages the entries provided for. languages can be null, in this case the entries are provided for any language.
      entries - - the list of language settings entries this provider provides. If null is passed, the provider creates an empty list.
      properties - - custom properties as the means to customize providers.
  • Method Details

    • configureProvider

      public void configureProvider(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries, Map<String,String> properties)
      A method to configure the provider. The initialization of provider from the extension point is done in 2 steps. First, the class is created as an executable extension using the default provider. Then this method is used to configure the provider.

      It is not allowed to reconfigure the provider.
      Parameters:
      id - - id of the provider.
      name - - name of the provider to be presented to a user.
      languages - - list of languages the entries provided for. languages can be null, in this case the entries are provided for any language.
      entries - - the list of language settings entries this provider provides. If null is passed, the provider creates an empty list.
      properties - - custom properties as the means to customize providers.
      Throws:
      UnsupportedOperationException - if an attempt to reconfigure provider is made.
    • getProperty

      public String getProperty(String key)
      LanguageSettingsBaseProvider keeps the list of key-value pairs so extenders of this class can customize the provider. The properties of LanguageSettingsBaseProvider come from the extension in plugin.xml although the extenders can provide their own method.

      Please note that empty string value is treated as "default" value and the same as null and the same as missing property, which allows equals(Object) evaluate the property as equal while comparing providers.
      Parameters:
      key - - property to check the value.
      Returns:
      value of the property. If the property is missing returns empty string.
    • getPropertyBool

      public boolean getPropertyBool(String key)
      Convenience method to get boolean property.
      Parameters:
      key - - property to check the value.
      Returns:
      boolean value of the property. If the property is missing or cannot be interpreted as boolean returns false.
      See Also:
    • getSettingEntries

      public List<ICLanguageSettingEntry> getSettingEntries(ICConfigurationDescription cfgDescription, org.eclipse.core.resources.IResource rc, String languageId)
      Returns the list of setting entries for the given configuration description, resource and language.

      Note to implementers - this method should not be used to do any long running operations such as extensive calculations or reading files. If you need to do so, the recommended way is to do the calculations outside of this function call - in advance and on appropriate event. For example, Build Output Parser prepares the list and stores it in internal cache while parsing output. ILanguageSettingsProvider.getSettingEntries(ICConfigurationDescription, IResource, String) will return cached entries when asked. You can also implement ICListenerAgent interface to get registered and listen to arbitrary events.
      Specified by:
      getSettingEntries in interface ILanguageSettingsProvider
      Parameters:
      languageId - - language id. If null, then entries defined for the language scope are returned. See getLanguageScope()
      cfgDescription - - configuration description.
      rc - - resource such as file or folder. If null, the default entries for all resources are returned.
      Returns:
      unmodifiable list of setting entries or null if no settings defined. the list is internally pooled and guaranteed to be the same object for equal lists.
    • getLanguageScope

      public List<String> getLanguageScope()
      Returns:
      the unmodifiable list of languages this provider provides for. If null, the provider provides for any language.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      Returns:
      true if the objects are equal, false otherwise.
      See Also: