/// <summary>
        /// Fills the treeview with box types
        /// </summary>
        /// <param name="creators">creators of boxes in the project</param>
        protected void FillTreeView(IBoxModuleFactoryCreator[] creators)
        {
            List<string> allCategories = new List<string>();

            //finding all the level 1 categories
            foreach (IBoxModuleFactoryCreator creator in creators)
            {
                foreach (string category in creator.BoxCategories)
                {
                    if (!allCategories.Contains(category))
                    {
                        allCategories.Add(category);
                    }
                }
            }
            allCategories.Sort();

            foreach (string cat in allCategories)
            {
                if (cat.Contains("."))
                {
                    CreateDottedTree(cat, creators);
                }
                else
                {
                    FillCategory(cat, creators, null);
                }
            }
        }
        /// <summary>
        /// Fills the image list of the tree view and the dictionary for
        /// converting category names into icons.
        /// </summary>
        /// <param name="creators">creators of boxes in the project</param>
        protected void FillImageList(IBoxModuleFactoryCreator[] creators)
        {
            int j = 0;

            MemoryStream stream;
            Icon icon;

            ImageList list = new ImageList();
            iconDictionary = new Dictionary<string, int>();

            for (int i = 0; i < creators.Length; i++)
            {
                if (creators[i].Icon.Length != 0)
                {
                    stream = new MemoryStream(creators[i].Icon);
                    icon = new Icon(stream);
                    list.Images.Add(icon);
                    iconDictionary.Add(creators[i].Identifier, j);
                    j++;
                }
            }

            //adding the folder and NA icon
            list.Images.Add(naIcon);
            iconDictionary.Add("noicon", list.Images.Count - 1);
            list.Images.Add(folderIcon);
            iconDictionary.Add("foldericon", list.Images.Count - 1);

            //adding the list to the control
            this.ImageList = list;
        }
        /// <summary>
        /// Creates a tree from a label that contains dots
        /// </summary>
        /// <param name="cat">Label of the category</param>
        /// <param name="creators">Creators of the boxes</param>
        protected void CreateDottedTree(string cat, IBoxModuleFactoryCreator[] creators)
        {
            NewBoxNode tn = null;
            NewBoxNode nextNode;
            string beginning;
            bool contains = false;

            //the first occurence is dealt separately, because we have to add directly
            //to the control
            beginning = cat.Substring(0, cat.IndexOf('.'));
            cat = cat.Substring(cat.IndexOf('.') + 1);

            //checking if the treeNode is there already
            foreach (NewBoxNode n in Nodes)
            {
                if (n.Text == beginning)
                {
                    contains = true;
                    tn = n;
                    break;
                }
            }
            if (!contains)
            {
                nextNode = new NewBoxNode(beginning, ENodeType.Category, String.Empty);
                nextNode.ImageIndex = iconDictionary["foldericon"];
                nextNode.SelectedImageIndex = iconDictionary["foldericon"];
                Nodes.Add(nextNode);
                tn = nextNode;
            }

            //all other dots
            while (cat.Contains("."))
            {
                contains = false;
                beginning = cat.Substring(0, cat.IndexOf('.'));
                cat = cat.Substring(cat.IndexOf('.') + 1);

                //checking if the treeNode is there already
                foreach (NewBoxNode n in tn.Nodes)
                {
                    if (n.Text == beginning)
                    {
                        contains = true;
                        tn = n;
                        break;
                    }
                }
                if (!contains)
                {
                    nextNode = new NewBoxNode(beginning, ENodeType.Category, String.Empty);
                    nextNode.ImageIndex = iconDictionary["foldericon"];
                    nextNode.SelectedImageIndex = iconDictionary["foldericon"];
                    tn.Nodes.Add(nextNode);
                    tn = nextNode;
                }
            }

            //adding the last element that's left (shouldn't be there already,
            //because FillTreeView chooses only distinct category names
            //tn.Nodes.Add(cat);
            FillCategory(cat, creators, tn);
        }
        /// <summary>
        /// Fills a particular category and all the boxes that belong
        /// to that category
        /// </summary>
        /// <param name="catName">name of the category</param>
        /// <param name="creators">Creators of the boxes</param>
        /// <param name="baseNode">The node where a new node should be created
        /// It is a null, when it should be created to the control itself</param>
        protected void FillCategory(string catName, IBoxModuleFactoryCreator[] creators, NewBoxNode baseNode)
        {
            bool contains;
            List<IBoxModuleFactoryCreator> newNodes = new List<IBoxModuleFactoryCreator>();

            NewBoxNode tn = new NewBoxNode(catName, ENodeType.Category, String.Empty);
            tn.ImageIndex = iconDictionary["foldericon"];
            tn.SelectedImageIndex = iconDictionary["foldericon"];
            if (baseNode == null)
            {
                Nodes.Add(tn);
            }
            else
            {
                baseNode.Nodes.Add(tn);
            }
            string catFullName = GetFullCategoryName(catName, tn.Parent);

            //iterating through all the creators we have
            foreach (IBoxModuleFactoryCreator creator in creators)
            {
                contains = false;

                foreach (string category in creator.BoxCategories)
                {
                    if (category == catFullName)
                    {
                        contains = true;
                        break;
                    }
                }

                if (contains)
                {
                    newNodes.Add(creator);
                }
            }

            IBoxModuleFactoryCreatorComparer comp = new IBoxModuleFactoryCreatorComparer();
            newNodes.Sort(comp);

            foreach (IBoxModuleFactoryCreator c in newNodes)
            {
                NewBoxNode node = new NewBoxNode(c.Label, ENodeType.Box, c.Identifier);
                if (iconDictionary.ContainsKey(c.Identifier))
                {
                    node.ImageIndex = iconDictionary[c.Identifier];
                    node.SelectedImageIndex = iconDictionary[c.Identifier];
                }
                else
                {
                    node.ImageIndex = iconDictionary["noicon"];
                    node.SelectedImageIndex = iconDictionary["noicon"];
                }
                tn.Nodes.Add(node);
            }
        }
        /// <summary>
        /// Determines if the creator in the first argument contains the property in
        /// the second argument. It is tested to the same property name and property
        /// type
        /// </summary>
        /// <param name="iBoxModuleFactoryCreator">A creator with properties</param>
        /// <param name="property">A particular property</param>
        /// <returns>True if contains, false otherwise</returns>
        protected static bool ContainsPropertyInfo(IBoxModuleFactoryCreator iBoxModuleFactoryCreator, PropertyInfo property)
        {
            foreach (PropertyInfo info in iBoxModuleFactoryCreator.Properties)
            {
                if ((info.name == property.name) &&
                    (info.typeClassIceId == property.typeClassIceId))
                {
                    return true;
                }
            }

            return false;
        }