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
LanguageSettingsBaseProvideris a basic implementation ofILanguageSettingsProviderfor the extensions defined byorg.eclipse.cdt.core.LanguageSettingsProviderextension point. This implementation supports "static" list of entries for languages specified in the extension point.- Since:
- 5.4
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>languageScopeLanguage scope, i.e.protected Map<String,String>propertiesProvider-specific properties
-
Constructor Summary
Constructors Constructor Description LanguageSettingsBaseProvider()Default constructor.LanguageSettingsBaseProvider(String id, String name)Constructor.LanguageSettingsBaseProvider(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries)Constructor.LanguageSettingsBaseProvider(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries, Map<String,String> properties)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigureProvider(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries, Map<String,String> properties)A method to configure the provider.booleanequals(Object obj)List<String>getLanguageScope()StringgetProperty(String key)LanguageSettingsBaseProviderkeeps the list of key-value pairs so extenders of this class can customize the provider.booleangetPropertyBool(String key)Convenience method to get boolean property.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.inthashCode()-
Methods inherited from class org.eclipse.cdt.core.AbstractExecutableExtensionBase
getId, getName, setId, setName, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider
getId, getName
-
-
-
-
Constructor Detail
-
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 theentriesprovided for.languagescan benull, in this case theentriesare provided for any language.entries- - the list of language settings entries this provider provides. Ifnullis 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 theentriesprovided for.languagescan benull, in this case theentriesare provided for any language.entries- - the list of language settings entries this provider provides. Ifnullis passed, the provider creates an empty list.properties- - custom properties as the means to customize providers.
-
-
Method Detail
-
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 theentriesprovided for.languagescan benull, in this case theentriesare provided for any language.entries- - the list of language settings entries this provider provides. Ifnullis 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)
LanguageSettingsBaseProviderkeeps the list of key-value pairs so extenders of this class can customize the provider. The properties ofLanguageSettingsBaseProvidercome 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 asnulland the same as missing property, which allowsequals(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:
getProperty(String)
-
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 implementICListenerAgentinterface to get registered and listen to arbitrary events.- Specified by:
getSettingEntriesin interfaceILanguageSettingsProvider- Parameters:
languageId- - language id. Ifnull, then entries defined for the language scope are returned. SeegetLanguageScope()cfgDescription- - configuration description.rc- - resource such as file or folder. Ifnull, the default entries for all resources are returned.- Returns:
- unmodifiable list of setting entries or
nullif 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.
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classObject- Returns:
trueif the objects are equal,falseotherwise.- See Also:
Object.equals(java.lang.Object)
-
-