A configuration element, with its attributes and children, directly reflects the content and structure of the extension section within the declaring plug-in's manifest (plugin.xml
) file.
This interface also provides a way to create executable extension objects.
These registry objects are intended for relatively short-term use. Clients that deal with these objects must be aware that they may become invalid if the declaring plug-in is updated or uninstalled. If this happens, all methods except IsValid() will throw InvalidRegistryObjectException. For configuration element objects, the most common case is code in a plug-in dealing with extensions contributed to one of the extension points it declares. Code in a plug-in that has declared that it is not dynamic aware (or not declared anything) can safely ignore this issue, since the registry would not be modified while it is active. However, code in a plug-in that declares that it is dynamic aware must be careful when accessing the extension and configuration element objects because they become invalid if the contributing plug-in is removed. Similarly, tools that analyze or display the extension registry are vulnerable. Client code can pre-test for invalid objects by calling IsValid(), which never throws this exception. However, pre-tests are usually not sufficient because of the possibility of the extension or configuration element object becoming invalid as a result of a concurrent activity. At-risk clients must treat InvalidRegistryObjectException
as if it were a checked exception. Also, such clients should probably register a listener with the extension registry so that they receive notification of any changes to the registry.
This interface is not intended to be implemented by clients.
Definition at line 59 of file berryIConfigurationElement.h.
virtual QObject* berry::IConfigurationElement::CreateExecutableExtension |
( |
const QString & |
propertyName | ) |
const |
|
pure virtual |
Creates and returns a new instance of the executable extension identified by the named attribute of this configuration element. The named attribute value must contain a fully qualified name of a class. The class can either refer to a class implementing the executable extension or to a factory capable of returning the executable extension.
The specified class is instantiated using its 0-argument public constructor.
Then the following checks are done:
If the specified class implements the IExecutableExtension interface, the method IExecutableExtension#SetInitializationData is called, passing to the object the configuration information that was used to create it.
If the specified class implements IExecutableExtensionFactory interface, the method IExecutableExtensionFactory#Create() is invoked.
Unlike other methods on this object, invoking this method may activate the plug-in.
- Parameters
-
propertyName | the name of the property |
- Returns
- the executable instance
- Exceptions
-
CoreException | if an instance of the executable extension could not be created for any reason |
- See also
- IExecutableExtension::SetInitializationData(IConfigurationElement, QString, Object*)
-
IExecutableExtensionFactory
- Exceptions
-
virtual QString berry::IConfigurationElement::GetAttribute |
( |
const QString & |
name | ) |
const |
|
pure virtual |
Returns the named attribute of this configuration element, or null
if none.
The names of configuration element attributes are the same as the attribute names of the corresponding XML element. For example, the configuration markup
<bg pattern="stripes"/>
corresponds to a configuration element named "bg"
with an attribute named "pattern"
with attribute value "stripes"
.
Note that any translation specified in the plug-in manifest file is automatically applied.
- Parameters
-
name | the name of the attribute |
- Returns
- attribute value, or
null
if none
- Exceptions
-
virtual QList<QString> berry::IConfigurationElement::GetAttributeNames |
( |
| ) |
const |
|
pure virtual |
Returns the names of the attributes of this configuration element. Returns an empty list if this configuration element has no attributes.
The names of configuration element attributes are the same as the attribute names of the corresponding XML element. For example, the configuration markup
<bg color="blue" pattern="stripes"/>
corresponds to a configuration element named "bg"
with attributes named "color"
and "pattern"
.
- Returns
- the names of the attributes
- Exceptions
-
virtual QString berry::IConfigurationElement::GetValue |
( |
| ) |
const |
|
pure virtual |
Returns the text value of this configuration element. For example, the configuration markup
<script lang="javascript">./scripts/cp.js</script>
corresponds to a configuration element "script"
with value ".\scripts\cp.js"
.
Values may span multiple lines (i.e., contain carriage returns and/or line feeds).
Note that any translation specified in the plug-in manifest file is automatically applied.
- Returns
- the text value of this configuration element or
null
- Exceptions
-
virtual QString berry::IConfigurationElement::GetValue |
( |
const QLocale & |
locale | ) |
const |
|
pure virtual |
When multi-language support is enabled, this method returns the text value of this configuration element in the specified locale, or null
if none.
The locale matching tries to find the best match between available translations and the requested locale, falling back to a more generic locale ("en") when the specific locale ("en_US") is not available.
If multi-language support is not enabled, this method is equivalent to the method GetValue().
- Parameters
-
locale | the requested locale |
- Returns
- the text value of this configuration element in the specified locale, or
null
- Exceptions
-
- See also
- IExtensionRegistry::IsMultiLanguage()