示例#1
0
        public static System.Collections.Generic.List <T> BuildItems <T>(string path, object caller, bool throwOnNotFound)
        {
            AddInTreeNode treeNode = AddInTree.GetTreeNode(path, throwOnNotFound);

            if (treeNode == null)
            {
                return(new System.Collections.Generic.List <T>());
            }
            return(treeNode.BuildChildItems <T>(caller));
        }
示例#2
0
        /// <summary>
        /// Builds the items in the path. Ensures that all items have the type T.
        /// </summary>
        /// <param name="path">A path in the addin tree.</param>
        /// <param name="parameter">The owner used to create the objects.</param>
        /// <param name="throwOnNotFound">If true, throws a <see cref="TreePathNotFoundException"/>
        /// if the path is not found. If false, an empty ArrayList is returned when the
        /// path is not found.</param>
        public IReadOnlyList <T> BuildItems <T>(string path, object parameter, bool throwOnNotFound = true)
        {
            AddInTreeNode node = GetTreeNode(path, throwOnNotFound);

            if (node == null)
            {
                return(new List <T>());
            }

            return(node.BuildChildItems <T>(parameter));
        }
示例#3
0
 /// <summary>
 /// Builds the sub-items.
 /// Conditions on this node are also applied to the sub-nodes.
 /// </summary>
 public List <T> BuildSubItems <T>()
 {
     if (subItemNode == null)
     {
         return(new List <T>());
     }
     else
     {
         return(subItemNode.BuildChildItems <T>(caller, conditions));
     }
 }
示例#4
0
        /// <summary>
        /// Builds the items in the path. Ensures that all items have the type T.
        /// </summary>
        /// <param name="path">A path in the addin tree.</param>
        /// <param name="caller">The owner used to create the objects.</param>
        /// <param name="throwOnNotFound">If true, throws a <see cref="TreePathNotFoundException"/>
        /// if the path is not found. If false, an empty ArrayList is returned when the
        /// path is not found.</param>
        public static List <T> BuildItems <T>(string path, object caller, bool throwOnNotFound)
        {
            AddInTreeNode node = GetTreeNode(path, throwOnNotFound);

            if (node == null)
            {
                return(new List <T>());
            }
            else
            {
                return(node.BuildChildItems <T>(caller));
            }
        }
示例#5
0
            public void Apply(IList items)
            {
                AddInTreeNode node = AddInTree.GetTreeNode(path, false);

                if (node != null)
                {
                    foreach (object o in node.BuildChildItems <object>(caller, additionalConditions))
                    {
                        items.Add(o);
                    }
                }
                else
                {
                    throw new CoreException("IncludeDoozer: AddinTree-Path not found: " + path);
                }
            }
示例#6
0
            public void Apply(IList items)
            {
                AddInTreeNode node = AddInTree.GetTreeNode(path, false);

                if (node != null)
                {
                    foreach (object o in node.BuildChildItems(caller))
                    {
                        items.Add(o);
                    }
                }
                else
                {
                    MessageService.ShowError("IncludeDoozer: AddinTree-Path not found: " + path);
                }
            }
示例#7
0
        public static ToolStripItem[] CreateToolStripItems(object owner, AddInTreeNode treeNode)
        {
            List <ToolStripItem> collection = new List <ToolStripItem>();

            foreach (object item in treeNode.BuildChildItems(owner))
            {
                if (item is ToolStripItem)
                {
                    collection.Add((ToolStripItem)item);
                }
                else
                {
                    ISubmenuBuilder submenuBuilder = (ISubmenuBuilder)item;
                    collection.AddRange(submenuBuilder.BuildSubmenu(null, owner));
                }
            }

            return(collection.ToArray());
        }