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 Summary
Modifier and TypeFieldDescriptionLanguage scope, i.e.Provider-specific properties -
Constructor Summary
ConstructorDescriptionDefault 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
Modifier and TypeMethodDescriptionvoid
configureProvider
(String id, String name, List<String> languages, List<ICLanguageSettingEntry> entries, Map<String, String> properties) A method to configure the provider.boolean
getProperty
(String key) LanguageSettingsBaseProvider
keeps the list of key-value pairs so extenders of this class can customize the provider.boolean
getPropertyBool
(String key) Convenience method to get boolean property.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.int
hashCode()
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
-
Field Details
-
languageScope
Language scope, i.e. list of languages the entries will be provided for. -
properties
Provider-specific properties
-
-
Constructor Details
-
LanguageSettingsBaseProvider
public LanguageSettingsBaseProvider()Default constructor. -
LanguageSettingsBaseProvider
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 theentries
provided for.languages
can benull
, in this case theentries
are provided for any language.entries
- - the list of language settings entries this provider provides. Ifnull
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 theentries
provided for.languages
can benull
, in this case theentries
are provided for any language.entries
- - the list of language settings entries this provider provides. Ifnull
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 theentries
provided for.languages
can benull
, in this case theentries
are provided for any language.entries
- - the list of language settings entries this provider provides. Ifnull
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
LanguageSettingsBaseProvider
keeps the list of key-value pairs so extenders of this class can customize the provider. The properties ofLanguageSettingsBaseProvider
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 asnull
and 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
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 implementICListenerAgent
interface to get registered and listen to arbitrary events.- Specified by:
getSettingEntries
in 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
null
if no settings defined. the list is internally pooled and guaranteed to be the same object for equal lists.
-
getLanguageScope
- Returns:
- the unmodifiable list of languages this provider provides for.
If
null
, the provider provides for any language.
-
hashCode
public int hashCode() -
equals
-