Mono.Addins 0.4.0.0 1.0.0.0 System.Object A node of the extension tree.

An extension node is an element registered by an add-in in an extension point. A host can get nodes registered in an extension point using methods such as , which returns a collection of ExtensionNode objects.

ExtensionNode will normally be used as a base class of more complex extension point types. The most common subclass is , which allows registering a class implemented in an add-in.

EXAMPLE: An application has a toolbar that must be extensible by add-ins. The application could define the following extension node type:

`public class ToolbarItemNode: ExtensionNode { [NodeAttribute] string icon; [NodeAttribute] string label; public string Icon { get { return icon; } } public string Label { get { return label; } } }`

In the implementation of an ExtensionNode, the attribute can be applied to fields to specify which attributes must be loaded from the node.

The extension point could be defined like this:

`<Addin id = "SomeApplication" version = "0.1.0" isroot="true"> ... <ExtensionPoint path = "/MainWindow/Toolbar"> <ExtensionNode id="ToolbarItem" type="ToolbarItemNode"/> </ExtensionPoint> ... </Addin>`

An add-in could extend the toolbar by registering new nodes in the extension point like this:

`<Addin id = "SomeAddin" version = "0.1.0"> ... <Extension path = "/MainWindow/Toolbar"> <ToolbarItem label="Open" icon="gtk-open"/> <ToolbarItem label="New" icon="gtk-new"/> </Extension> ... </Addin>`

To create the toolbar, the host application would get the nodes registered in the extension point:

`foreach (ToolbarItemNode node in AddinManager.GetExtensionNodes ("/MainWindow/Toolbar")) { Gtk.ToolButton it = new Gtk.ToolButton (new Gtk.Image (node.Icon, IconSize.SmallToolbar), node.Label); // Add the button to the toolbar }`
- Constructor
  Creates an extension node.
  0.4.0.0
- Property
  Mono.Addins.RuntimeAddin The add-in that registered this extension node. The add-in that created the node. This property provides access to the resources and types of the add-in that created this extension node. 0.4.0.0
- Property
  Mono.Addins.ExtensionNodeList Child nodes of this extension node. A list of child nodes. 0.4.0.0
- Property
  0.4.0.0
  Mono.Addins.ExtensionContext To be added. To be added. To be added.
- Event
  Mono.Addins.ExtensionNodeEventHandler To be added. To be added. 0.4.0.0
- Method
  System.Object[] Returns the child objects of a node. An array of child objects. This method only works if all children of this node are of type . The returned array is composed by all objects created by calling the method for each node. 0.4.0.0
- Method
  System.Object[] `` True if the method can reuse instances created in previous calls. Returns the child objects of a node. An array of child objects. This method only works if all children of this node are of type . The returned array is composed by all objects created by calling the method for each node (or if reuseCachedInstance is set to true). 0.4.0.0
- Method
  System.Object[] `` Type of the return array elements. Returns the child objects of a node (with type check). An array of child objects. This method only works if all children of this node are of type . The returned array is composed by all objects created by calling the method for each node.

  A exception is thrown if one of the found child objects is not a subclass of the provided type.

  0.4.0.0
- Method
  System.Object[] `` `` Type of the return array elements. True if the method can reuse instances created in previous calls. Returns the child objects of a node (with type check). An array of child objects.

  This method only works if all children of this node are of type . The returned array is composed by all objects created by calling the method for each node (or if reuseCachedInstance is set to true).

  A exception will be thrown if one of the found child objects is not a subclass of the provided type.

  0.4.0.0
- Property
  System.Boolean Specifies whether the extension node has as an Id or not. True if this node has an user-specified id. It is not mandatory to specify an 'id' for a node. When none is provided, the add-in manager will automatically generate an unique id for the node. This property will return true if an 'id' was provided for the node, and false if the id was assigned by the add-in manager. 0.4.0.0
- Property
  System.String Identifier of the node. Identifier of the node. It is not mandatory to specify an 'id' for a node. When none is provided, the add-in manager will automatically generate an unique id for the node. The property can be used to know if the 'id' has been specified by the developer or not. 0.4.0.0
- Method
  System.Void Notifies that the owner add-in has been loaded. This overridable method is called when the add-in that registered this node has been loaded in memory. 0.4.0.0
- Method
  System.Void Notifies that the owner add-in has been unloaded. This overridable method is called when the add-in that registered this node has been unloaded from memory. 0.4.0.0
- Method
  System.Void `` The new child node. Notifies the addition of a child node. This method is called when a new child is added to this node. It may be due to changes in conditions or for an add-in being enabled. 0.4.0.0
- Method
  System.Void `` The removed node. Notifies the removal of a child node. This method is called when a child of this node is removed. It may be due to changes in conditions or for an add-in being disabled. 0.4.0.0
- Method
  System.Void Notifies changes in child nodes. This method is called when child nodes are added or removed. It may be due to changes in conditions, or to add-ins being enabled or disabled. 0.4.0.0
- Property
  0.4.0.0
  Mono.Addins.ExtensionNode To be added. To be added. To be added.
- Property
  System.String Location of this node in the extension tree. Path of the node.

  The node path is composed by the path of the extension point where it is defined, the identifiers of its parent nodes, and its own identifier. For example:

  `<Extension path="/MonoDevelop/Workbench/MainMenu"> <ItemSet id="File" _label="_File"> <CommandItem id="NewFile" /> <CommandItem id="NewProject" /> </ItemSet> </Extension>`

  The path of the node "NewProject" would be "/MonoDevelop/Workbench/MainMenu/File/NewProject".

  0.4.0.0
- Method
  System.Void `` To be added. To be added.

  ExtensionNode subclasses can override this method to take control on the process of loading an ExtensionNode instance out of an extension node. If the Read method is overriden (and if it doesn't call the base class) [] attributes will be ignored.

  The following example would be equivalent to the example shown for the class , but this implementation would be more efficient since no reflection would be involved:

  `public class FileTemplateNode: ExtensionNode { string resource; string name; public string Name { get { return name != null ? name : Id; } } public virtual string GetContent () { using (StreamReader sr = new StreamReader(Addin.GetResource (resource))) { return sr.ReadToEnd (); } } protected override void Read (NodeElement elem) { resource = elem.GetAttribute ("resource-name"); name = elem.GetAttribute ("name"); } }` 0.4.0.0