diff options
author | Lluis Sanchez <lluis@novell.com> | 2010-07-01 20:25:55 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@novell.com> | 2010-07-01 20:25:55 +0400 |
commit | 5f5512dce6cf3afc5eb262ad4f910d64d4c7a6f6 (patch) | |
tree | fb393fa92221a7adf5fa8308ba5464d3c6ec0bff | |
parent | 3e16c152e9bc357b569064b91ce0b246d0164c23 (diff) |
* Mono.Addins.csproj:
* Mono.Addins.Description/Extension.cs:
* Mono.Addins.Description/Dependency.cs:
* Mono.Addins.Description/AddinFlags.cs:
* Mono.Addins.Description/ExtensionPoint.cs:
* Mono.Addins.Description/AddinDependency.cs:
* Mono.Addins.Description/AddinDescription.cs:
* Mono.Addins.Description/ExtensionNodeSet.cs:
* Mono.Addins.Description/NativeDependency.cs:
* Mono.Addins.Localization/IAddinLocalizer.cs:
* Mono.Addins.Description/ObjectDescription.cs:
* Mono.Addins.Description/ModuleDescription.cs:
* Mono.Addins.Description/ExtensionNodeType.cs:
* Mono.Addins.Description/NodeTypeAttribute.cs:
* Mono.Addins.Description/AssemblyDependency.cs:
* Mono.Addins.Description/ExtensionCollection.cs:
* Mono.Addins.Description/DependencyCollection.cs:
* Mono.Addins.Localization/IPluralAddinLocalizer.cs:
* Mono.Addins.Localization/IAddinLocalizerFactory.cs:
* Mono.Addins.Description/ExtensionNodeDescription.cs:
* Mono.Addins.Description/ExtensionPointCollection.cs:
* Mono.Addins.Description/ConditionTypeDescription.cs:
* Mono.Addins.Description/ExtensionNodeSetCollection.cs:
* Mono.Addins.Description/ModuleDescriptionCollection.cs:
* Mono.Addins.Description/NodeTypeAttributeCollection.cs:
* Mono.Addins.Description/ExtensionNodeTypeCollection.cs:
* Mono.Addins.Description/ObjectDescriptionCollection.cs:
* Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs:
* Mono.Addins.Description/ConditionTypeDescriptionCollection.cs: Added
documentation.
svn path=/trunk/mono-addins/; revision=159783
30 files changed, 1115 insertions, 8 deletions
diff --git a/Mono.Addins/ChangeLog b/Mono.Addins/ChangeLog index 4f4d84d..5509de9 100644 --- a/Mono.Addins/ChangeLog +++ b/Mono.Addins/ChangeLog @@ -1,3 +1,36 @@ +2010-07-01 Lluis Sanchez Gual <lluis@novell.com> + + * Mono.Addins.csproj: + * Mono.Addins.Description/Extension.cs: + * Mono.Addins.Description/Dependency.cs: + * Mono.Addins.Description/AddinFlags.cs: + * Mono.Addins.Description/ExtensionPoint.cs: + * Mono.Addins.Description/AddinDependency.cs: + * Mono.Addins.Description/AddinDescription.cs: + * Mono.Addins.Description/ExtensionNodeSet.cs: + * Mono.Addins.Description/NativeDependency.cs: + * Mono.Addins.Localization/IAddinLocalizer.cs: + * Mono.Addins.Description/ObjectDescription.cs: + * Mono.Addins.Description/ModuleDescription.cs: + * Mono.Addins.Description/ExtensionNodeType.cs: + * Mono.Addins.Description/NodeTypeAttribute.cs: + * Mono.Addins.Description/AssemblyDependency.cs: + * Mono.Addins.Description/ExtensionCollection.cs: + * Mono.Addins.Description/DependencyCollection.cs: + * Mono.Addins.Localization/IPluralAddinLocalizer.cs: + * Mono.Addins.Localization/IAddinLocalizerFactory.cs: + * Mono.Addins.Description/ExtensionNodeDescription.cs: + * Mono.Addins.Description/ExtensionPointCollection.cs: + * Mono.Addins.Description/ConditionTypeDescription.cs: + * Mono.Addins.Description/ExtensionNodeSetCollection.cs: + * Mono.Addins.Description/ModuleDescriptionCollection.cs: + * Mono.Addins.Description/NodeTypeAttributeCollection.cs: + * Mono.Addins.Description/ExtensionNodeTypeCollection.cs: + * Mono.Addins.Description/ObjectDescriptionCollection.cs: + * Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs: + * Mono.Addins.Description/ConditionTypeDescriptionCollection.cs: + Added documentation. + 2010-06-17 Lluis Sanchez Gual <lluis@novell.com> * Mono.Addins/NodeElement.cs: diff --git a/Mono.Addins/Mono.Addins.Description/AddinDependency.cs b/Mono.Addins/Mono.Addins.Description/AddinDependency.cs index a526025..adc0d29 100644 --- a/Mono.Addins/Mono.Addins.Description/AddinDependency.cs +++ b/Mono.Addins/Mono.Addins.Description/AddinDependency.cs @@ -35,22 +35,43 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// Definition of a dependency of an add-in on another add-in. + /// </summary> [XmlType ("AddinReference")] public class AddinDependency: Dependency { string id; string version; + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.AddinDependency"/> class. + /// </summary> public AddinDependency () { } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.AddinDependency"/> class. + /// </summary> + /// <param name='fullId'> + /// Full identifier of the add-in (includes version) + /// </param> public AddinDependency (string fullId) { Addin.GetIdParts (fullId, out id, out version); id = "::" + id; } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.AddinDependency"/> class. + /// </summary> + /// <param name='id'> + /// Identifier of the add-in. + /// </param> + /// <param name='version'> + /// Version of the add-in. + /// </param> public AddinDependency (string id, string version) { this.id = id; @@ -76,6 +97,15 @@ namespace Mono.Addins.Description Element.SetAttribute ("version", Version); } + /// <summary> + /// Gets the full addin identifier. + /// </summary> + /// <value> + /// The full addin identifier. + /// </value> + /// <remarks> + /// Includes namespace and version number. For example: MonoDevelop.TextEditor,1.0 + /// </remarks> public string FullAddinId { get { AddinDescription desc = ParentAddinDescription; @@ -86,16 +116,34 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets or sets the addin identifier. + /// </summary> + /// <value> + /// The addin identifier. + /// </value> public string AddinId { get { return id != null ? id : string.Empty; } set { id = value; } } + /// <summary> + /// Gets or sets the version. + /// </summary> + /// <value> + /// The version. + /// </value> public string Version { get { return version != null ? version : string.Empty; } set { version = value; } } + /// <summary> + /// Display name of the dependency. + /// </summary> + /// <value> + /// The name. + /// </value> public override string Name { get { return AddinId + " v" + version; } } diff --git a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs index e7e93fd..3d589e9 100644 --- a/Mono.Addins/Mono.Addins.Description/AddinDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/AddinDescription.cs @@ -37,8 +37,13 @@ using Mono.Addins.Database; namespace Mono.Addins.Description { - // This class represent an add-in configuration file. It has properties for getting - // all information, and methods for loading and saving files. + /// <summary> + /// An add-in description + /// </summary> + /// <remarks> + /// This class represent an add-in manifest. It has properties for getting + /// all information, and methods for loading and saving files. + /// </remarks> public class AddinDescription: IBinaryXmlElement { XmlDocument configDoc; @@ -97,25 +102,58 @@ namespace Mono.Addins.Description set { ownerDatabase = value; } } + /// <summary> + /// Gets or sets the path to the main addin file. + /// </summary> + /// <value> + /// The addin file. + /// </value> + /// <remarks> + /// The add-in file can be either the main assembly of an add-in or an xml manifest. + /// </remarks> public string AddinFile { get { return sourceAddinFile; } set { sourceAddinFile = value; } } + /// <summary> + /// Gets the addin identifier. + /// </summary> + /// <value> + /// The addin identifier. + /// </value> public string AddinId { get { return Addin.GetFullId (Namespace, LocalId, Version); } } + /// <summary> + /// Gets or sets the local identifier. + /// </summary> + /// <value> + /// The local identifier. + /// </value> public string LocalId { get { return id != null ? id : string.Empty; } set { id = value; hasUserId = true; } } + /// <summary> + /// Gets or sets the namespace. + /// </summary> + /// <value> + /// The namespace. + /// </value> public string Namespace { get { return ns != null ? ns : string.Empty; } set { ns = value; } } + /// <summary> + /// Gets or sets the display name of the add-in. + /// </summary> + /// <value> + /// The name. + /// </value> public string Name { get { if (name != null && name.Length > 0) @@ -130,41 +168,89 @@ namespace Mono.Addins.Description set { name = value; } } + /// <summary> + /// Gets or sets the version. + /// </summary> + /// <value> + /// The version. + /// </value> public string Version { get { return version != null ? version : string.Empty; } set { version = value; } } + /// <summary> + /// Gets or sets the version of the add-in with which this add-in is backwards compatible. + /// </summary> + /// <value> + /// The compat version. + /// </value> public string CompatVersion { get { return compatVersion != null ? compatVersion : string.Empty; } set { compatVersion = value; } } + /// <summary> + /// Gets or sets the author. + /// </summary> + /// <value> + /// The author. + /// </value> public string Author { get { return author != null ? author : string.Empty; } set { author = value; } } + /// <summary> + /// Gets or sets the Url where more information about the add-in can be found. + /// </summary> + /// <value> + /// The URL. + /// </value> public string Url { get { return url != null ? url : string.Empty; } set { url = value; } } + /// <summary> + /// Gets or sets the copyright. + /// </summary> + /// <value> + /// The copyright. + /// </value> public string Copyright { get { return copyright != null ? copyright : string.Empty; } set { copyright = value; } } + /// <summary> + /// Gets or sets the description of the add-in. + /// </summary> + /// <value> + /// The description. + /// </value> public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } + /// <summary> + /// Gets or sets the category of the add-in. + /// </summary> + /// <value> + /// The category. + /// </value> public string Category { get { return category != null ? category : string.Empty; } set { category = value; } } + /// <summary> + /// Gets the base path for locating external files relative to the add-in. + /// </summary> + /// <value> + /// The base path. + /// </value> public string BasePath { get { return basePath != null ? basePath : string.Empty; } } @@ -174,16 +260,34 @@ namespace Mono.Addins.Description basePath = path; } + /// <summary> + /// Gets or sets a value indicating whether this instance is an add-in root. + /// </summary> + /// <value> + /// <c>true</c> if this instance is an add-in root; otherwise, <c>false</c>. + /// </value> public bool IsRoot { get { return isroot; } set { isroot = value; } } + /// <summary> + /// Gets or sets a value indicating whether this add-in is enabled by default. + /// </summary> + /// <value> + /// <c>true</c> if enabled by default; otherwise, <c>false</c>. + /// </value> public bool EnabledByDefault { get { return defaultEnabled; } set { defaultEnabled = value; } } + /// <summary> + /// Gets or sets the add-in flags. + /// </summary> + /// <value> + /// The flags. + /// </value> public AddinFlags Flags { get { return flags; } set { flags = value; } @@ -194,14 +298,32 @@ namespace Mono.Addins.Description set { hasUserId = value; } } + /// <summary> + /// Gets a value indicating whether this add-in can be disabled. + /// </summary> + /// <value> + /// <c>true</c> if this add-in can be disabled; otherwise, <c>false</c>. + /// </value> public bool CanDisable { get { return (flags & AddinFlags.CantDisable) == 0 && !IsHidden; } } + /// <summary> + /// Gets a value indicating whether this add-in can be uninstalled. + /// </summary> + /// <value> + /// <c>true</c> if this instance can be uninstalled; otherwise, <c>false</c>. + /// </value> public bool CanUninstall { get { return (flags & AddinFlags.CantUninstall) == 0 && !IsHidden; } } + /// <summary> + /// Gets a value indicating whether this add-in is hidden. + /// </summary> + /// <value> + /// <c>true</c> if this add-in is hidden; otherwise, <c>false</c>. + /// </value> public bool IsHidden { get { return (flags & AddinFlags.Hidden) != 0; } } @@ -212,6 +334,15 @@ namespace Mono.Addins.Description (CompatVersion.Length == 0 || Addin.CompareVersions (ver, CompatVersion) <= 0); } + /// <summary> + /// Gets all external files + /// </summary> + /// <value> + /// All files. + /// </value> + /// <remarks> + /// External files are data files and assemblies explicitly referenced in the Runtime section of the add-in manifest. + /// </remarks> public StringCollection AllFiles { get { StringCollection col = new StringCollection (); @@ -226,6 +357,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets all paths to be ignored by the add-in scanner. + /// </summary> + /// <value> + /// All paths to be ignored. + /// </value> public StringCollection AllIgnorePaths { get { StringCollection col = new StringCollection (); @@ -240,6 +377,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the main module. + /// </summary> + /// <value> + /// The main module. + /// </value> public ModuleDescription MainModule { get { if (mainModule == null) { @@ -253,6 +396,17 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the optional modules. + /// </summary> + /// <value> + /// The optional modules. + /// </value> + /// <remarks> + /// Optional modules can be used to declare extensions which will be registered only if some specified + /// add-in dependencies can be satisfied. Dependencies specified in optional modules are 'soft dependencies', + /// which means that they don't need to be satisfied in order to load the add-in. + /// </remarks> public ModuleCollection OptionalModules { get { if (optionalModules == null) { @@ -266,6 +420,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets all modules (including the main module and all optional modules) + /// </summary> + /// <value> + /// All modules. + /// </value> public ModuleCollection AllModules { get { ModuleCollection col = new ModuleCollection (this); @@ -276,6 +436,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the extension node sets. + /// </summary> + /// <value> + /// The extension node sets. + /// </value> public ExtensionNodeSetCollection ExtensionNodeSets { get { if (nodeSets == null) { @@ -289,6 +455,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the extension points. + /// </summary> + /// <value> + /// The extension points. + /// </value> public ExtensionPointCollection ExtensionPoints { get { if (extensionPoints == null) { @@ -302,6 +474,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the condition types. + /// </summary> + /// <value> + /// The condition types. + /// </value> public ConditionTypeDescriptionCollection ConditionTypes { get { if (conditionTypes == null) { @@ -315,11 +493,26 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets or sets the add-in localizer. + /// </summary> + /// <value> + /// The description of the add-in localizer for this add-in. + /// </value> public ExtensionNodeDescription Localizer { get { return localizer; } set { localizer = value; } } + /// <summary> + /// Adds an extension point. + /// </summary> + /// <returns> + /// The extension point. + /// </returns> + /// <param name='path'> + /// Path that identifies the new extension point. + /// </param> public ExtensionPoint AddExtensionPoint (string path) { ExtensionPoint ep = new ExtensionPoint (); @@ -376,6 +569,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets or sets file where this description is stored + /// </summary> + /// <value> + /// The file path. + /// </value> public string FileName { get { return configFile; } set { configFile = value; } @@ -416,12 +615,30 @@ namespace Mono.Addins.Description return false; } + /// <summary> + /// Saves the add-in description. + /// </summary> + /// <param name='fileName'> + /// File name where to save this instance + /// </param> + /// <remarks> + /// Saves the add-in description to the specified file and sets the FileName property. + /// </remarks> public void Save (string fileName) { configFile = fileName; Save (); } + /// <summary> + /// Saves the add-in description. + /// </summary> + /// <exception cref='InvalidOperationException'> + /// It is thrown if FileName is not set + /// </exception> + /// <remarks> + /// The description is saved to the file specified in the FileName property. + /// </remarks> public void Save () { if (configFile == null) @@ -436,6 +653,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Generates an XML representation of the add-in description + /// </summary> + /// <returns> + /// An XML manifest. + /// </returns> public XmlDocument SaveToXml () { SaveXml (); @@ -540,6 +763,12 @@ namespace Mono.Addins.Description } + /// <summary> + /// Load an add-in description from a file + /// </summary> + /// <param name='configFile'> + /// The file. + /// </param> public static AddinDescription Read (string configFile) { AddinDescription config; @@ -550,11 +779,29 @@ namespace Mono.Addins.Description return config; } + /// <summary> + /// Load an add-in description from a stream + /// </summary> + /// <param name='stream'> + /// The stream + /// </param> + /// <param name='basePath'> + /// The path to be used to resolve relative file paths. + /// </param> public static AddinDescription Read (Stream stream, string basePath) { return Read (new StreamReader (stream), basePath); } + /// <summary> + /// Load an add-in description from a text reader + /// </summary> + /// <param name='reader'> + /// The text reader + /// </param> + /// <param name='basePath'> + /// The path to be used to resolve relative file paths. + /// </param> public static AddinDescription Read (TextReader reader, string basePath) { AddinDescription config = new AddinDescription (); @@ -637,6 +884,13 @@ namespace Mono.Addins.Description // BinaryXmlReader.DumpFile (configFile); } + /// <summary> + /// Verify this instance. + /// </summary> + /// <remarks> + /// This method checks all the definitions in the description and returns a list of errors. + /// If the returned list is empty, it means that the description is valid. + /// </remarks> public StringCollection Verify () { StringCollection errors = new StringCollection (); diff --git a/Mono.Addins/Mono.Addins.Description/AddinFlags.cs b/Mono.Addins/Mono.Addins.Description/AddinFlags.cs index 80d824d..28c9401 100644 --- a/Mono.Addins/Mono.Addins.Description/AddinFlags.cs +++ b/Mono.Addins/Mono.Addins.Description/AddinFlags.cs @@ -29,11 +29,26 @@ using System; namespace Mono.Addins.Description { + /// <summary> + /// Add-in flags + /// </summary> public enum AddinFlags { + /// <summary> + /// No flags + /// </summary> None = 0, + /// <summary> + /// The add-in can't be uninstalled + /// </summary> CantUninstall = 1, + /// <summary> + /// The add-in can't be disabled + /// </summary> CantDisable = 2, + /// <summary> + /// The add-in is not visible to end users + /// </summary> Hidden = 4 } } diff --git a/Mono.Addins/Mono.Addins.Description/AssemblyDependency.cs b/Mono.Addins/Mono.Addins.Description/AssemblyDependency.cs index 64a28d3..79d92b4 100644 --- a/Mono.Addins/Mono.Addins.Description/AssemblyDependency.cs +++ b/Mono.Addins/Mono.Addins.Description/AssemblyDependency.cs @@ -35,12 +35,18 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// Definition of a dependency of an add-in on an assembly. + /// </summary> [XmlType ("AssemblyDependency")] public class AssemblyDependency: Dependency { string fullName; string package; + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.AssemblyDependency"/> class. + /// </summary> public AssemblyDependency () { } @@ -63,16 +69,34 @@ namespace Mono.Addins.Description Element.SetAttribute ("package", Package); } + /// <summary> + /// Gets or sets the full name of the assembly + /// </summary> + /// <value> + /// The full name of the assembly. + /// </value> public string FullName { get { return fullName != null ? fullName : string.Empty; } set { fullName = value; } } + /// <summary> + /// Gets or sets the name of the package that provides the assembly. + /// </summary> + /// <value> + /// The name of the package that provides the assembly. + /// </value> public string Package { get { return package != null ? package : string.Empty; } set { package = value; } } + /// <summary> + /// Display name of the dependency + /// </summary> + /// <value> + /// The name. + /// </value> public override string Name { get { if (Package.Length > 0) diff --git a/Mono.Addins/Mono.Addins.Description/ConditionTypeDescription.cs b/Mono.Addins/Mono.Addins.Description/ConditionTypeDescription.cs index 65ff53f..a156f95 100644 --- a/Mono.Addins/Mono.Addins.Description/ConditionTypeDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/ConditionTypeDescription.cs @@ -34,6 +34,9 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// A condition type definition. + /// </summary> public sealed class ConditionTypeDescription: ObjectDescription { string id; @@ -41,6 +44,9 @@ namespace Mono.Addins.Description string addinId; string description; + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ConditionTypeDescription"/> class. + /// </summary> public ConditionTypeDescription () { } @@ -52,6 +58,12 @@ namespace Mono.Addins.Description description = ReadXmlDescription (); } + /// <summary> + /// Copies data from another condition type definition + /// </summary> + /// <param name='cond'> + /// Condition from which to copy + /// </param> public void CopyFrom (ConditionTypeDescription cond) { id = cond.id; @@ -66,16 +78,34 @@ namespace Mono.Addins.Description VerifyNotEmpty (location + "ConditionType (" + Id + ")", errors, TypeName, "type"); } + /// <summary> + /// Gets or sets the identifier of the condition type + /// </summary> + /// <value> + /// The identifier. + /// </value> public string Id { get { return id != null ? id : string.Empty; } set { id = value; } } + /// <summary> + /// Gets or sets the name of the type that implements the condition + /// </summary> + /// <value> + /// The name of the type. + /// </value> public string TypeName { get { return typeName != null ? typeName : string.Empty; } set { typeName = value; } } + /// <summary> + /// Gets or sets the description of the condition. + /// </summary> + /// <value> + /// The description. + /// </value> public string Description { get { return description != null ? description : string.Empty; } set { description = value; } diff --git a/Mono.Addins/Mono.Addins.Description/ConditionTypeDescriptionCollection.cs b/Mono.Addins/Mono.Addins.Description/ConditionTypeDescriptionCollection.cs index 8d60f9e..e59c349 100644 --- a/Mono.Addins/Mono.Addins.Description/ConditionTypeDescriptionCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ConditionTypeDescriptionCollection.cs @@ -31,8 +31,14 @@ using System; namespace Mono.Addins.Description { + /// <summary> + /// A collection of condition types + /// </summary> public class ConditionTypeDescriptionCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ConditionTypeDescriptionCollection"/> class. + /// </summary> public ConditionTypeDescriptionCollection () { } @@ -41,6 +47,15 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ConditionTypeDescription"/> at the specified index. + /// </summary> + /// <param name='n'> + /// Index. + /// </param> + /// <returns> + /// The condition. + /// </returns> public ConditionTypeDescription this [int n] { get { return (ConditionTypeDescription) List [n]; } } diff --git a/Mono.Addins/Mono.Addins.Description/Dependency.cs b/Mono.Addins/Mono.Addins.Description/Dependency.cs index 0e63d52..159fd52 100644 --- a/Mono.Addins/Mono.Addins.Description/Dependency.cs +++ b/Mono.Addins/Mono.Addins.Description/Dependency.cs @@ -33,6 +33,9 @@ using System.Xml; namespace Mono.Addins.Description { + /// <summary> + /// Definition of an add-in dependency. + /// </summary> [XmlInclude (typeof(AddinDependency))] public abstract class Dependency: ObjectDescription { @@ -44,6 +47,12 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the display name of the dependency. + /// </summary> + /// <value> + /// The name. + /// </value> public abstract string Name { get; } internal abstract bool CheckInstalled (AddinRegistry registry); } diff --git a/Mono.Addins/Mono.Addins.Description/DependencyCollection.cs b/Mono.Addins/Mono.Addins.Description/DependencyCollection.cs index 9a385f5..151b397 100644 --- a/Mono.Addins/Mono.Addins.Description/DependencyCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/DependencyCollection.cs @@ -31,8 +31,14 @@ using System.Collections; namespace Mono.Addins.Description { + /// <summary> + /// A collection of dependency definitions. + /// </summary> public class DependencyCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.DependencyCollection"/> class. + /// </summary> public DependencyCollection () { } @@ -41,15 +47,33 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.Dependency"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The idnex. + /// </param> public Dependency this [int n] { get { return (Dependency) List [n]; } } + /// <summary> + /// Adds a dependency to the collection + /// </summary> + /// <param name='dep'> + /// The dependency to add. + /// </param> public void Add (Dependency dep) { List.Add (dep); } + /// <summary> + /// Remove the specified dependency. + /// </summary> + /// <param name='dep'> + /// Dependency to remove. + /// </param> public void Remove (Dependency dep) { List.Remove (dep); diff --git a/Mono.Addins/Mono.Addins.Description/Extension.cs b/Mono.Addins/Mono.Addins.Description/Extension.cs index 600249d..2dd8823 100644 --- a/Mono.Addins/Mono.Addins.Description/Extension.cs +++ b/Mono.Addins/Mono.Addins.Description/Extension.cs @@ -34,22 +34,47 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// An extension definition. + /// </summary> + /// <remarks> + /// An Extension is a collection of nodes which have to be registered in an extension point. + /// The target extension point is specified in the <see cref="Mono.Addins.Description.Extension"/>.Path property. + /// </remarks> public class Extension: ObjectDescription, IComparable { string path; ExtensionNodeDescriptionCollection nodes; + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.Extension"/> class. + /// </summary> public Extension () { } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.Extension"/> class. + /// </summary> + /// <param name='path'> + /// Path that identifies the extension point being extended + /// </param> public Extension (string path) { this.path = path; } - // Returns the object extended by this Extension. It can be an ExtensionPoint or - // an ExtensionNodeDescription. + /// <summary> + /// Gets the object extended by this extension + /// </summary> + /// <returns> + /// The extended object can be an <see cref="Mono.Addins.Description.ExtensionPoint"/> or + /// an <see cref="Mono.Addins.Description.ExtensionNodeDescription"/>. + /// </returns> + /// <remarks> + /// This method only works when the add-in description to which the extension belongs has been + /// loaded from an add-in registry. + /// </remarks> public ObjectDescription GetExtendedObject () { AddinDescription desc = ParentAddinDescription; @@ -80,6 +105,16 @@ namespace Mono.Addins.Description return null; } + /// <summary> + /// Gets the node types allowed in this extension. + /// </summary> + /// <returns> + /// The allowed node types. + /// </returns> + /// <remarks> + /// This method only works when the add-in description to which the extension belongs has been + /// loaded from an add-in registry. + /// </remarks> public ExtensionNodeTypeCollection GetAllowedNodeTypes () { ObjectDescription ob = GetExtendedObject (); @@ -146,12 +181,24 @@ namespace Mono.Addins.Description VerifyConditionNode (location, cnode, errors); } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.Extension"/> class. + /// </summary> + /// <param name='element'> + /// XML that describes the extension. + /// </param> public Extension (XmlElement element) { Element = element; path = element.GetAttribute ("path"); } + /// <summary> + /// Gets or sets the path that identifies the extension point being extended. + /// </summary> + /// <value> + /// The path. + /// </value> public string Path { get { return path; } set { path = value; } @@ -168,6 +215,12 @@ namespace Mono.Addins.Description nodes.SaveXml (Element); } + /// <summary> + /// Gets the extension nodes. + /// </summary> + /// <value> + /// The extension nodes. + /// </value> public ExtensionNodeDescriptionCollection ExtensionNodes { get { if (nodes == null) { diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionCollection.cs b/Mono.Addins/Mono.Addins.Description/ExtensionCollection.cs index 55dc16a..a509599 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionCollection.cs @@ -32,8 +32,14 @@ using System.Collections; namespace Mono.Addins.Description { + /// <summary> + /// A collection of extensions + /// </summary> public class ExtensionCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionCollection"/> class. + /// </summary> public ExtensionCollection () { } @@ -42,6 +48,12 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.Extension"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The index. + /// </param> public Extension this [int n] { get { return (Extension) List [n]; } } diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescription.cs b/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescription.cs index 6f901cb..7274c58 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescription.cs @@ -34,12 +34,21 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// An extension node definition. + /// </summary> public class ExtensionNodeDescription: ObjectDescription, NodeElement { ExtensionNodeDescriptionCollection childNodes; string[] attributes; string nodeName; + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionNodeDescription"/> class. + /// </summary> + /// <param name='nodeName'> + /// Node name. + /// </param> public ExtensionNodeDescription (string nodeName) { this.nodeName = nodeName; @@ -55,6 +64,16 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the type of the node. + /// </summary> + /// <returns> + /// The node type. + /// </returns> + /// <remarks> + /// This method only works when the add-in description to which the node belongs has been + /// loaded from an add-in registry. + /// </remarks> public ExtensionNodeType GetNodeType () { if (Parent is Extension) { @@ -78,6 +97,16 @@ namespace Mono.Addins.Description return null; } + /// <summary> + /// Gets the extension path under which this node is registered + /// </summary> + /// <returns> + /// The parent path. + /// </returns> + /// <remarks> + /// For example, if the id of the node is 'ThisNode', and the node is a child of another node with id 'ParentNode', and + /// that parent node is defined in an extension with the path '/Core/MainExtension', then the parent path is 'Core/MainExtension/ParentNode'. + /// </remarks> public string GetParentPath () { if (Parent is Extension) @@ -97,6 +126,12 @@ namespace Mono.Addins.Description ChildNodes.Verify (location + NodeName + "/", errors); } + /// <summary> + /// Gets or sets the name of the node. + /// </summary> + /// <value> + /// The name of the node. + /// </value> public string NodeName { get { return nodeName; } internal set { @@ -106,11 +141,23 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets or sets the identifier of the node. + /// </summary> + /// <value> + /// The identifier. + /// </value> public string Id { get { return GetAttribute ("id"); } set { SetAttribute ("id", value); } } + /// <summary> + /// Gets or sets the identifier of the node after which this node has to be inserted + /// </summary> + /// <value> + /// The identifier of the reference node + /// </value> public string InsertAfter { get { return GetAttribute ("insertafter"); } set { @@ -121,6 +168,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets or sets the identifier of the node before which this node has to be inserted + /// </summary> + /// <value> + /// The identifier of the reference node + /// </value> public string InsertBefore { get { return GetAttribute ("insertbefore"); } set { @@ -131,6 +184,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets a value indicating whether this node is a condition. + /// </summary> + /// <value> + /// <c>true</c> if this node is a condition; otherwise, <c>false</c>. + /// </value> public bool IsCondition { get { return nodeName == "Condition" || nodeName == "ComplexCondition"; } } @@ -148,6 +207,15 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the value of an attribute. + /// </summary> + /// <returns> + /// The value of the attribute, or an empty string if the attribute is not defined. + /// </returns> + /// <param name='key'> + /// Name of the attribute. + /// </param> public string GetAttribute (string key) { if (Element != null) @@ -162,6 +230,15 @@ namespace Mono.Addins.Description return string.Empty; } + /// <summary> + /// Sets the value of an attribute. + /// </summary> + /// <param name='key'> + /// Name of the attribute + /// </param> + /// <param name='value'> + /// The value. + /// </param> public void SetAttribute (string key, string value) { if (Element != null) { @@ -192,6 +269,12 @@ namespace Mono.Addins.Description attributes [attributes.Length - 1] = value; } + /// <summary> + /// Removes an attribute. + /// </summary> + /// <param name='name'> + /// Name of the attribute to remove. + /// </param> public void RemoveAttribute (string name) { if (Element != null) { @@ -213,6 +296,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the attributes of the node. + /// </summary> + /// <value> + /// The attributes. + /// </value> public NodeAttribute[] Attributes { get { if (Element != null) @@ -230,6 +319,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the child nodes. + /// </summary> + /// <value> + /// The child nodes. + /// </value> public ExtensionNodeDescriptionCollection ChildNodes { get { if (childNodes == null) { diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs b/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs index 1f81051..c5430a2 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs @@ -32,8 +32,14 @@ using System.Collections; namespace Mono.Addins.Description { + /// <summary> + /// A collection of extension nodes + /// </summary> public class ExtensionNodeDescriptionCollection: ObjectDescriptionCollection, NodeElementCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionNodeDescriptionCollection"/> class. + /// </summary> public ExtensionNodeDescriptionCollection () { } @@ -42,10 +48,22 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionNodeDescription"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The index. + /// </param> public ExtensionNodeDescription this [int n] { get { return (ExtensionNodeDescription) List [n]; } } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionNodeDescription"/> with the specified identifier. + /// </summary> + /// <param name='id'> + /// Identifier. + /// </param> public ExtensionNodeDescription this [string id] { get { foreach (ExtensionNodeDescription node in List) diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionNodeSet.cs b/Mono.Addins/Mono.Addins.Description/ExtensionNodeSet.cs index 2a8b8b1..cf92c6e 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionNodeSet.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionNodeSet.cs @@ -35,6 +35,15 @@ using System.Collections.Specialized; namespace Mono.Addins.Description { + /// <summary> + /// An extension node set definition. + /// </summary> + /// <remarks> + /// Node sets allow grouping a set of extension node declarations and give an identifier to that group + /// (the node set). Once a node set is declared, it can be referenced from several extension points + /// which use the same extension node structure. Extension node sets also allow declaring recursive + /// extension nodes, that is, extension nodes with a tree structure. + /// </remarks> public class ExtensionNodeSet: ObjectDescription { string id; @@ -49,6 +58,12 @@ namespace Mono.Addins.Description id = element.GetAttribute (IdAttribute); } + /// <summary> + /// Copies data from another node set + /// </summary> + /// <param name='nset'> + /// Node set from which to copy + /// </param> public void CopyFrom (ExtensionNodeSet nset) { id = nset.id; @@ -105,10 +120,19 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionNodeSet"/> class. + /// </summary> public ExtensionNodeSet () { } + /// <summary> + /// Gets or sets the identifier of the node set. + /// </summary> + /// <value> + /// The identifier. + /// </value> public string Id { get { return id != null ? id : string.Empty; } set { id = value; } @@ -118,6 +142,12 @@ namespace Mono.Addins.Description get { return "id"; } } + /// <summary> + /// Gets the node types allowed in this node set. + /// </summary> + /// <value> + /// The node types. + /// </value> public ExtensionNodeTypeCollection NodeTypes { get { if (nodeTypes == null) { @@ -130,6 +160,12 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets a list of other node sets included in this node set. + /// </summary> + /// <value> + /// The node sets. + /// </value> public NodeSetIdCollection NodeSets { get { if (nodeSets == null) { @@ -142,11 +178,18 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets all the allowed node types. + /// </summary> + /// <returns> + /// The allowed node types. + /// </returns> + /// <remarks> + /// Gets all allowed node types, including those defined in included node sets. + /// This method only works for descriptions loaded from a registry. + /// </remarks> public ExtensionNodeTypeCollection GetAllowedNodeTypes () { - // Gets all allowed node types, including those defined in node sets - // It only works for descriptions generated from a registry - if (cachedAllowedTypes == null) { cachedAllowedTypes = new ExtensionNodeTypeCollection (); GetAllowedNodeTypes (new Hashtable (), cachedAllowedTypes); @@ -260,20 +303,41 @@ namespace Mono.Addins.Description } } + /// <summary> + /// A collection of node set identifiers + /// </summary> public class NodeSetIdCollection: IEnumerable { // A list of string[2]. Item 0 is the node set id, item 1 is the addin that defines it. ArrayList list = new ArrayList (); + /// <summary> + /// Gets the node set identifier at the specified index. + /// </summary> + /// <param name='n'> + /// An index. + /// </param> public string this [int n] { get { return (string) list [n]; } } + /// <summary> + /// Gets the item count. + /// </summary> + /// <value> + /// The count. + /// </value> public int Count { get { return list.Count; } } + /// <summary> + /// Gets the collection enumerator. + /// </summary> + /// <returns> + /// The enumerator. + /// </returns> public IEnumerator GetEnumerator () { ArrayList ll = new ArrayList (list.Count); @@ -282,12 +346,24 @@ namespace Mono.Addins.Description return ll.GetEnumerator (); } + /// <summary> + /// Add the specified node set identifier. + /// </summary> + /// <param name='nodeSetId'> + /// Node set identifier. + /// </param> public void Add (string nodeSetId) { if (!Contains (nodeSetId)) list.Add (new string [] { nodeSetId, null }); } + /// <summary> + /// Remove a node set identifier + /// </summary> + /// <param name='nodeSetId'> + /// Node set identifier. + /// </param> public void Remove (string nodeSetId) { int i = IndexOf (nodeSetId); @@ -295,16 +371,34 @@ namespace Mono.Addins.Description list.RemoveAt (i); } + /// <summary> + /// Clears the collection + /// </summary> public void Clear () { list.Clear (); } + /// <summary> + /// Checks if the specified identifier is present in the collection + /// </summary> + /// <param name='nodeSetId'> + /// <c>true</c> if the node set identifier is present. + /// </param> public bool Contains (string nodeSetId) { return IndexOf (nodeSetId) != -1; } + /// <summary> + /// Returns the index of the specified node set identifier + /// </summary> + /// <returns> + /// The index. + /// </returns> + /// <param name='nodeSetId'> + /// A node set identifier. + /// </param> public int IndexOf (string nodeSetId) { for (int n=0; n<list.Count; n++) diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionNodeSetCollection.cs b/Mono.Addins/Mono.Addins.Description/ExtensionNodeSetCollection.cs index c8875ed..51447bb 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionNodeSetCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionNodeSetCollection.cs @@ -32,8 +32,14 @@ using System.Collections; namespace Mono.Addins.Description { + /// <summary> + /// A collection of node sets. + /// </summary> public class ExtensionNodeSetCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionNodeSetCollection"/> class. + /// </summary> public ExtensionNodeSetCollection () { } @@ -42,10 +48,22 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionNodeSet"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The index. + /// </param> public ExtensionNodeSet this [int n] { get { return (ExtensionNodeSet) List [n]; } } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionNodeSet"/> with the specified id. + /// </summary> + /// <param name='id'> + /// Identifier. + /// </param> public ExtensionNodeSet this [string id] { get { for (int n=0; n<List.Count; n++) diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionNodeType.cs b/Mono.Addins/Mono.Addins.Description/ExtensionNodeType.cs index 3fb48e9..ece3091 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionNodeType.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionNodeType.cs @@ -91,8 +91,11 @@ namespace Mono.Addins.Description } /// <summary> - /// Type of the extension node. + /// Type that implements the extension node. /// </summary> + /// <value> + /// The full name of the type. + /// </value> public string TypeName { get { return typeName != null ? typeName : string.Empty; } set { typeName = value; } @@ -101,6 +104,9 @@ namespace Mono.Addins.Description /// <summary> /// Element name to be used when defining an extension in an XML manifest. The default name is "Type". /// </summary> + /// <value> + /// The name of the node. + /// </value> public string NodeName { get { return Id; } set { Id = value; } @@ -168,10 +174,16 @@ namespace Mono.Addins.Description description = de.InnerText; } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionNodeType"/> class. + /// </summary> public ExtensionNodeType () { } + /// <summary> + /// Copies data from another node set + /// </summary> public void CopyFrom (ExtensionNodeType ntype) { base.CopyFrom (ntype); diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionNodeTypeCollection.cs b/Mono.Addins/Mono.Addins.Description/ExtensionNodeTypeCollection.cs index 5f0bd4c..49fad28 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionNodeTypeCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionNodeTypeCollection.cs @@ -32,8 +32,14 @@ using System.Collections; namespace Mono.Addins.Description { + /// <summary> + /// A collection of node types. + /// </summary> public class ExtensionNodeTypeCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionNodeTypeCollection"/> class. + /// </summary> public ExtensionNodeTypeCollection () { } @@ -42,10 +48,22 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionNodeType"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The index. + /// </param> public ExtensionNodeType this [int n] { get { return (ExtensionNodeType) List [n]; } } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionNodeType"/> with the specified id. + /// </summary> + /// <param name='id'> + /// Identifier. + /// </param> public ExtensionNodeType this [string id] { get { for (int n=0; n<List.Count; n++) diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionPoint.cs b/Mono.Addins/Mono.Addins.Description/ExtensionPoint.cs index 5ba9002..ec50c2b 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionPoint.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionPoint.cs @@ -36,6 +36,9 @@ using System.Collections.Generic; namespace Mono.Addins.Description { + /// <summary> + /// An extension point definition. + /// </summary> public sealed class ExtensionPoint: ObjectDescription { string path; @@ -56,10 +59,19 @@ namespace Mono.Addins.Description description = ReadXmlDescription (); } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionPoint"/> class. + /// </summary> public ExtensionPoint () { } + /// <summary> + /// Copies another extension point. + /// </summary> + /// <param name='ep'> + /// Extension point from which to copy. + /// </param> public void CopyFrom (ExtensionPoint ep) { path = ep.path; @@ -155,21 +167,45 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets or sets the path that identifies the extension point. + /// </summary> + /// <value> + /// The path. + /// </value> public string Path { get { return path != null ? path : string.Empty; } set { path = value; } } + /// <summary> + /// Gets or sets the display name of the extension point. + /// </summary> + /// <value> + /// The name. + /// </value> public string Name { get { return name != null ? name : string.Empty; } set { name = value; } } + /// <summary> + /// Gets or sets the description of the extension point. + /// </summary> + /// <value> + /// The description. + /// </value> public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } + /// <summary> + /// Gets a list of add-ins that extend this extension point. + /// </summary> + /// <remarks> + /// This value is only available when the add-in description is loaded from an add-in registry. + /// </remarks> public string[] ExtenderAddins { get { return Addins.ToArray (); @@ -189,6 +225,12 @@ namespace Mono.Addins.Description set { rootAddin = value; } } + /// <summary> + /// A node set which specifies the node types allowed in this extension point. + /// </summary> + /// <value> + /// The node set. + /// </value> public ExtensionNodeSet NodeSet { get { if (nodeSet == null) { @@ -209,6 +251,12 @@ namespace Mono.Addins.Description nodeSet.SetParent (this); } + /// <summary> + /// Gets the conditions available in this node set. + /// </summary> + /// <value> + /// The conditions. + /// </value> public ConditionTypeDescriptionCollection Conditions { get { if (conditions == null) { @@ -222,6 +270,21 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Adds an extension node type. + /// </summary> + /// <returns> + /// The extension node type. + /// </returns> + /// <param name='name'> + /// Name of the node + /// </param> + /// <param name='typeName'> + /// Name of the type that implements the extension node. + /// </param> + /// <remarks> + /// This method can be used to register a new allowed node type for the extension point. + /// </remarks> public ExtensionNodeType AddExtensionNode (string name, string typeName) { ExtensionNodeType ntype = new ExtensionNodeType (); diff --git a/Mono.Addins/Mono.Addins.Description/ExtensionPointCollection.cs b/Mono.Addins/Mono.Addins.Description/ExtensionPointCollection.cs index 6b4423d..2efd3ae 100644 --- a/Mono.Addins/Mono.Addins.Description/ExtensionPointCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ExtensionPointCollection.cs @@ -32,8 +32,14 @@ using System.Collections; namespace Mono.Addins.Description { + /// <summary> + /// A collection of extension point definitions. + /// </summary> public class ExtensionPointCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ExtensionPointCollection"/> class. + /// </summary> public ExtensionPointCollection () { } @@ -42,10 +48,22 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionPoint"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The index. + /// </param> public ExtensionPoint this [int n] { get { return (ExtensionPoint) List [n]; } } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ExtensionPoint"/> with the specified path. + /// </summary> + /// <param name='path'> + /// Path. + /// </param> public ExtensionPoint this [string path] { get { for (int n=0; n<List.Count; n++) diff --git a/Mono.Addins/Mono.Addins.Description/ModuleDescription.cs b/Mono.Addins/Mono.Addins.Description/ModuleDescription.cs index a0712c0..f57a33c 100644 --- a/Mono.Addins/Mono.Addins.Description/ModuleDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/ModuleDescription.cs @@ -36,6 +36,13 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// A module definition. + /// </summary> + /// <remarks> + /// Optional modules can be used to declare extensions which will be registered only if some + /// specified add-in dependencies can be satisfied. + /// </remarks> public class ModuleDescription: ObjectDescription { StringCollection assemblies; @@ -52,10 +59,22 @@ namespace Mono.Addins.Description Element = element; } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ModuleDescription"/> class. + /// </summary> public ModuleDescription () { } + /// <summary> + /// Checks if this module depends on the specified add-in. + /// </summary> + /// <returns> + /// <c>true</c> if there is a dependency. + /// </returns> + /// <param name='addinId'> + /// Identifier of the add-in + /// </param> public bool DependsOnAddin (string addinId) { AddinDescription desc = Parent as AddinDescription; @@ -71,6 +90,9 @@ namespace Mono.Addins.Description return false; } + /// <summary> + /// Gets the list of paths to be ignored by the add-in scanner. + /// </summary> public StringCollection IgnorePaths { get { if (ignorePaths == null) @@ -79,6 +101,15 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets all external files + /// </summary> + /// <value> + /// All files. + /// </value> + /// <remarks> + /// External files are data files and assemblies explicitly referenced in the Runtime section of the add-in manifest. + /// </remarks> public StringCollection AllFiles { get { StringCollection col = new StringCollection (); @@ -92,6 +123,9 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the list of external assemblies used by this module. + /// </summary> public StringCollection Assemblies { get { if (assemblies == null) { @@ -104,6 +138,9 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the list of external data files used by this module + /// </summary> public StringCollection DataFiles { get { if (dataFiles == null) { @@ -116,6 +153,9 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the dependencies of this module + /// </summary> public DependencyCollection Dependencies { get { if (dependencies == null) { @@ -141,6 +181,9 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Gets the extensions of this module + /// </summary> public ExtensionCollection Extensions { get { if (extensions == null) { @@ -154,6 +197,21 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Adds an extension node to the module. + /// </summary> + /// <returns> + /// The extension node. + /// </returns> + /// <param name='path'> + /// Path that identifies the extension point. + /// </param> + /// <param name='nodeName'> + /// Node name. + /// </param> + /// <remarks> + /// This method creates a new Extension object for the provided path if none exist. + /// </remarks> public ExtensionNodeDescription AddExtensionNode (string path, string nodeName) { ExtensionNodeDescription node = new ExtensionNodeDescription (nodeName); @@ -161,6 +219,18 @@ namespace Mono.Addins.Description return node; } + /// <summary> + /// Gets an extension instance. + /// </summary> + /// <returns> + /// The extension instance. + /// </returns> + /// <param name='path'> + /// Path that identifies the extension point that the extension extends. + /// </param> + /// <remarks> + /// This method creates a new Extension object for the provided path if none exist. + /// </remarks> public Extension GetExtension (string path) { foreach (Extension e in Extensions) { @@ -218,6 +288,15 @@ namespace Mono.Addins.Description } } + /// <summary> + /// Adds an add-in reference (there is a typo in the method name) + /// </summary> + /// <param name='id'> + /// Identifier of the add-in. + /// </param> + /// <param name='version'> + /// Version of the add-in. + /// </param> public void AddAssemblyReference (string id, string version) { XmlElement deps = GetDependenciesElement (); diff --git a/Mono.Addins/Mono.Addins.Description/ModuleDescriptionCollection.cs b/Mono.Addins/Mono.Addins.Description/ModuleDescriptionCollection.cs index dd521c3..4fd98cf 100644 --- a/Mono.Addins/Mono.Addins.Description/ModuleDescriptionCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ModuleDescriptionCollection.cs @@ -31,8 +31,14 @@ using System.Collections; namespace Mono.Addins.Description { + /// <summary> + /// A collection of module descriptions + /// </summary> public class ModuleCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ModuleCollection"/> class. + /// </summary> public ModuleCollection () { } @@ -41,6 +47,12 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.ModuleDescription"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The index. + /// </param> public ModuleDescription this [int n] { get { return (ModuleDescription) List [n]; } } diff --git a/Mono.Addins/Mono.Addins.Description/NativeDependency.cs b/Mono.Addins/Mono.Addins.Description/NativeDependency.cs index 143beb2..3bc1dc4 100644 --- a/Mono.Addins/Mono.Addins.Description/NativeDependency.cs +++ b/Mono.Addins/Mono.Addins.Description/NativeDependency.cs @@ -34,6 +34,7 @@ using Mono.Addins.Description; namespace Mono.Addins.Description { + [Obsolete] [XmlType ("NativeReference")] public class NativeDependency: Dependency { diff --git a/Mono.Addins/Mono.Addins.Description/NodeTypeAttribute.cs b/Mono.Addins/Mono.Addins.Description/NodeTypeAttribute.cs index 8e7594e..caf8b45 100644 --- a/Mono.Addins/Mono.Addins.Description/NodeTypeAttribute.cs +++ b/Mono.Addins/Mono.Addins.Description/NodeTypeAttribute.cs @@ -34,6 +34,9 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// Description of the attribute of a node type. + /// </summary> public sealed class NodeTypeAttribute: ObjectDescription { string name; @@ -42,10 +45,19 @@ namespace Mono.Addins.Description bool localizable; string description; + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.NodeTypeAttribute"/> class. + /// </summary> public NodeTypeAttribute() { } + /// <summary> + /// Copies data from another node attribute. + /// </summary> + /// <param name='att'> + /// The attribute from which to copy. + /// </param> public void CopyFrom (NodeTypeAttribute att) { name = att.name; @@ -55,26 +67,56 @@ namespace Mono.Addins.Description description = att.description; } + /// <summary> + /// Gets or sets the name of the attribute. + /// </summary> + /// <value> + /// The name. + /// </value> public string Name { get { return name != null ? name : string.Empty; } set { name = value; } } + /// <summary> + /// Gets or sets a value indicating whether this <see cref="Mono.Addins.Description.NodeTypeAttribute"/> is required. + /// </summary> + /// <value> + /// <c>true</c> if required; otherwise, <c>false</c>. + /// </value> public bool Required { get { return required; } set { required = value; } } + /// <summary> + /// Gets or sets a value indicating whether this <see cref="Mono.Addins.Description.NodeTypeAttribute"/> is localizable. + /// </summary> + /// <value> + /// <c>true</c> if localizable; otherwise, <c>false</c>. + /// </value> public bool Localizable { get { return localizable; } set { localizable = value; } } + /// <summary> + /// Gets or sets the type of the attribute. + /// </summary> + /// <value> + /// The type. + /// </value> public string Type { get { return type != null ? type : string.Empty; } set { type = value; } } + /// <summary> + /// Gets or sets the description of the attribute. + /// </summary> + /// <value> + /// The description. + /// </value> public string Description { get { return description != null ? description : string.Empty; } set { description = value; } diff --git a/Mono.Addins/Mono.Addins.Description/NodeTypeAttributeCollection.cs b/Mono.Addins/Mono.Addins.Description/NodeTypeAttributeCollection.cs index 276cb8c..eebfa3e 100644 --- a/Mono.Addins/Mono.Addins.Description/NodeTypeAttributeCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/NodeTypeAttributeCollection.cs @@ -31,8 +31,14 @@ using System; namespace Mono.Addins.Description { + /// <summary> + /// A collection of node attributes + /// </summary> public class NodeTypeAttributeCollection: ObjectDescriptionCollection { + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.NodeTypeAttributeCollection"/> class. + /// </summary> public NodeTypeAttributeCollection () { } @@ -41,6 +47,12 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the <see cref="Mono.Addins.Description.NodeTypeAttribute"/> at the specified index. + /// </summary> + /// <param name='n'> + /// The index. + /// </param> public NodeTypeAttribute this [int n] { get { return (NodeTypeAttribute) List [n]; } } diff --git a/Mono.Addins/Mono.Addins.Description/ObjectDescription.cs b/Mono.Addins/Mono.Addins.Description/ObjectDescription.cs index 756823c..660c26a 100644 --- a/Mono.Addins/Mono.Addins.Description/ObjectDescription.cs +++ b/Mono.Addins/Mono.Addins.Description/ObjectDescription.cs @@ -34,6 +34,9 @@ using Mono.Addins.Serialization; namespace Mono.Addins.Description { + /// <summary> + /// Base class for add-in description definitions. + /// </summary> public class ObjectDescription: IBinaryXmlElement { internal XmlElement Element; @@ -48,10 +51,22 @@ namespace Mono.Addins.Description { } + /// <summary> + /// Gets the parent object. + /// </summary> + /// <value> + /// The parent object. + /// </value> public object Parent { get { return parent; } } + /// <summary> + /// Gets the parent add-in description. + /// </summary> + /// <value> + /// The parent add-in description. + /// </value> public AddinDescription ParentAddinDescription { get { if (parent is AddinDescription) diff --git a/Mono.Addins/Mono.Addins.Description/ObjectDescriptionCollection.cs b/Mono.Addins/Mono.Addins.Description/ObjectDescriptionCollection.cs index 920584b..162804c 100644 --- a/Mono.Addins/Mono.Addins.Description/ObjectDescriptionCollection.cs +++ b/Mono.Addins/Mono.Addins.Description/ObjectDescriptionCollection.cs @@ -34,6 +34,9 @@ using System.Collections.Specialized; namespace Mono.Addins.Description { + /// <summary> + /// Base class for add-in description collections. + /// </summary> public class ObjectDescriptionCollection: CollectionBase { object owner; @@ -43,31 +46,67 @@ namespace Mono.Addins.Description this.owner = owner; } + /// <summary> + /// Initializes a new instance of the <see cref="Mono.Addins.Description.ObjectDescriptionCollection"/> class. + /// </summary> public ObjectDescriptionCollection () { } + /// <summary> + /// Add an object. + /// </summary> + /// <param name='ep'> + /// The object. + /// </param> public void Add (ObjectDescription ep) { List.Add (ep); } + /// <summary> + /// Adds a collection of objects. + /// </summary> + /// <param name='collection'> + /// The objects to add. + /// </param> public void AddRange (ObjectDescriptionCollection collection) { foreach (ObjectDescription ob in collection) Add (ob); } + /// <summary> + /// Insert an object. + /// </summary> + /// <param name='index'> + /// Insertion index. + /// </param> + /// <param name='ep'> + /// The object. + /// </param> public void Insert (int index, ObjectDescription ep) { List.Insert (index, ep); } + /// <summary> + /// Removes an object. + /// </summary> + /// <param name='ep'> + /// Object to remove. + /// </param> public void Remove (ObjectDescription ep) { List.Remove (ep); } + /// <summary> + /// Checks if an object is present in the collection. + /// </summary> + /// <param name='ob'> + /// Objecect to check. + /// </param> public bool Contains (ObjectDescription ob) { return List.Contains (ob); diff --git a/Mono.Addins/Mono.Addins.Localization/IAddinLocalizer.cs b/Mono.Addins/Mono.Addins.Localization/IAddinLocalizer.cs index eb38adc..09a39c2 100644 --- a/Mono.Addins/Mono.Addins.Localization/IAddinLocalizer.cs +++ b/Mono.Addins/Mono.Addins.Localization/IAddinLocalizer.cs @@ -30,8 +30,24 @@ using System; namespace Mono.Addins.Localization { + /// <summary> + /// An add-in localizer. + /// </summary> + /// <remarks> + /// Add-in localizers which want to provide support for localization of plural forms + /// can additionally implement <see cref="Mono.Addins.Localization.IPluralAddinLocalizer"/>. + /// </remarks> public interface IAddinLocalizer { + /// <summary> + /// Gets a localized message. + /// </summary> + /// <returns> + /// The localized message. + /// </returns> + /// <param name='msgid'> + /// The message identifier. + /// </param> string GetString (string msgid); } } diff --git a/Mono.Addins/Mono.Addins.Localization/IAddinLocalizerFactory.cs b/Mono.Addins/Mono.Addins.Localization/IAddinLocalizerFactory.cs index c54583f..b5c54c5 100644 --- a/Mono.Addins/Mono.Addins.Localization/IAddinLocalizerFactory.cs +++ b/Mono.Addins/Mono.Addins.Localization/IAddinLocalizerFactory.cs @@ -30,8 +30,23 @@ using System; namespace Mono.Addins.Localization { + /// <summary> + /// A localizer factory. + /// </summary> public interface IAddinLocalizerFactory { + /// <summary> + /// Creates a localizer for an add-in. + /// </summary> + /// <returns> + /// The localizer. + /// </returns> + /// <param name='addin'> + /// The add-in for which to create the localizer. + /// </param> + /// <param name='element'> + /// Localizer parameters. + /// </param> IAddinLocalizer CreateLocalizer (RuntimeAddin addin, NodeElement element); } } diff --git a/Mono.Addins/Mono.Addins.Localization/IPluralAddinLocalizer.cs b/Mono.Addins/Mono.Addins.Localization/IPluralAddinLocalizer.cs index 57a7494..828b135 100644 --- a/Mono.Addins/Mono.Addins.Localization/IPluralAddinLocalizer.cs +++ b/Mono.Addins/Mono.Addins.Localization/IPluralAddinLocalizer.cs @@ -29,8 +29,30 @@ using System; namespace Mono.Addins.Localization { + /// <summary> + /// A localizer that supports localization of plural forms. + /// </summary> + /// <remarks> + /// This interface can be implemented by add-in localizers which want to provide + /// support plural forms. + /// </remarks> public interface IPluralAddinLocalizer { + /// <summary> + /// Gets a localized message which may contain plural forms. + /// </summary> + /// <returns> + /// The localized message. + /// </returns> + /// <param name='singular'> + /// Message identifier to use when the specified count is 1. + /// </param> + /// <param name='defaultPlural'> + /// Default message identifier to use when the specified count is not 1. + /// </param> + /// <param name='n'> + /// The count that determines which plural form to use. + /// </param> string GetPluralString (string singular, String defaultPlural, int n); } } diff --git a/Mono.Addins/Mono.Addins.csproj b/Mono.Addins/Mono.Addins.csproj index 043a2b6..13e28bf 100644 --- a/Mono.Addins/Mono.Addins.csproj +++ b/Mono.Addins/Mono.Addins.csproj @@ -21,6 +21,7 @@ <WarningLevel>4</WarningLevel> <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> <ConsolePause>false</ConsolePause> + <GenerateDocumentation>true</GenerateDocumentation> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>none</DebugType> |