// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) using System; using System.Collections.Generic; using System.Linq; namespace ICSharpCode.Core { /// /// Argument class used for . /// public class BuildItemArgs { object caller; Codon codon; IEnumerable conditions; AddInTreeNode subItemNode; public BuildItemArgs(object caller, Codon codon, IEnumerable conditions, AddInTreeNode subItemNode) { if (codon == null) throw new ArgumentNullException("codon"); this.caller = caller; this.codon = codon; this.conditions = conditions ?? Enumerable.Empty(); this.subItemNode = subItemNode; } /// /// The caller passed to . /// public object Caller { get { return caller; } } /// /// The codon to build. /// public Codon Codon { get { return codon; } } /// /// The addin containing the codon. /// public AddIn AddIn { get { return codon.AddIn; } } /// /// The conditions applied to this item. /// public IEnumerable Conditions { get { return conditions; } } /// /// The addin tree node containing the sub-items. /// Returns null if no sub-items exist. /// public AddInTreeNode SubItemNode { get { return subItemNode; } } /// /// Builds the sub-items. /// Conditions on this node are also applied to the sub-nodes. /// public List BuildSubItems() { if (subItemNode == null) return new List(); else return subItemNode.BuildChildItems(caller, conditions); } } }