ExtensionAttribute Class |
Namespace: Sdl.Core.PluginFramework
The ExtensionAttribute type exposes the following members.
Name | Description | |
---|---|---|
ExtensionAttribute |
Default constructor for XML serialization.
| |
ExtensionAttribute(String, String, String) |
Constructor with required attributes.
|
Name | Description | |
---|---|---|
Description |
Gets or sets the description of the extension.
| |
Icon |
Gets or sets the resource key for an the icon representing this extension. Can be null.
| |
Id |
Gets or sets the unique id of the extension.
| |
Name |
Gets or sets the name of the extension.
| |
TypeId | When implemented in a derived class, gets a unique identifier for this Attribute. (Inherited from Attribute.) |
Name | Description | |
---|---|---|
Equals | Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsDefaultAttribute | When overridden in a derived class, indicates whether the value of this instance is the default value for the derived class. (Inherited from Attribute.) | |
Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
Validate |
Validates an extension targeting this extension point. This method is called by the framework while generating the plug-in manifest.
| |
ValidateId |
Validates the extension Id. Checks whether this is not null or empty.
| |
ValidateName |
Validates the extension Name. Checks whether this is not null or empty.
|
To define a new extension point, create a new attribute class, extending ExtensionAttribute. The class must be annotated with the ExtensionPointInfoAttribute attribute, which indicates that the class defines an extension point.
Users can now create new extension classes annotated with the new extension attribute, and implementing a specified interface.
To get access to all the extensions registered with your extension point, use GetExtensionPointT, specifying the type of your extension attribute. For more information, see IExtensionPoint.
When the plug-in manifest is generated, instances of the extension attribute are saved in the plug-in manifest using XML serialization. For that reason, make sure your extension attribute supports this (e.g. add a default constructor).
The framework also provides support for getting property values from the PluginResources.resx resource file, which is deployed together with the plug-in manifest. To specify that the value of a certain string property needs to be retrieved from the resource file, annotate the property definition with the PluginResourceAttribute attribute. Users should now specify the name of the resource key, instead of the actual value, as the property value. When no resource string with the specified key can be found, the framework keeps the specified string as the property value. To define non-string properties whose value is stored in the PluginResources.resx resource file, create a string property, which value should be set to a resource key. When consuming the extension, use GetPluginResourceT(String) tio retriece the resource from the plug-in resource file.