/// <summary>
        /// Selects the next node whose error level corresponds to the levelEnum provided
        /// </summary>
        /// <param name="levelEnum"></param>
        public void SelectNext(Utils.ElementLog.LevelEnum levelEnum)
        {
            BaseTreeNode node     = Selected;
            BaseTreeNode toSelect = null;

            if (node != null)
            {
                Utils.IModelElement current = node.Model;
                toSelect = RecursivelySelectNext(current, node, levelEnum, false);
                while (toSelect == null && node != null)
                {
                    while (node != null && node.NextNode == null)
                    {
                        node = node.Parent as BaseTreeNode;
                    }

                    if (node != null)
                    {
                        node     = node.NextNode as BaseTreeNode;
                        toSelect = RecursivelySelectNext(current, node, levelEnum, true);
                    }
                }
            }
            else
            {
                toSelect = RecursivelySelectNext(null, Nodes[0] as BaseTreeNode, levelEnum, true);
            }

            Selected = toSelect;
        }
Exemple #2
0
        /// <summary>
        /// Indicates that at least one message of type levelEnum is attached to the element
        /// </summary>
        /// <param name="levelEnum"></param>
        /// <returns></returns>
        public bool HasMessage(Utils.ElementLog.LevelEnum levelEnum)
        {
            bool retVal = false;

            return(retVal);
        }
        /// <summary>
        /// Selects the next node whose error level corresponds to the levelEnum provided
        /// </summary>
        /// <param name="current">the model element that is currently displayed</param>
        /// <param name="node">the node from which the selection process must begin</param>
        /// <param name="levelEnum"></param>
        /// <param name="considerThisOne">Indicates that the current node should be considered by the search</param>
        /// <returns>the node to select</returns>
        private BaseTreeNode RecursivelySelectNext(Utils.IModelElement current, BaseTreeNode node, Utils.ElementLog.LevelEnum levelEnum, bool considerThisOne)
        {
            BaseTreeNode retVal = null;

            if (considerThisOne)
            {
                if (node.Model.HasMessage(levelEnum) && node.Model != current)
                {
                    retVal = node;
                }
            }

            if (retVal == null)
            {
                if (node.Nodes.Count > 0)
                {
                    foreach (BaseTreeNode subNode in node.Nodes)
                    {
                        retVal = RecursivelySelectNext(current, subNode, levelEnum, true);
                        if (retVal != null)
                        {
                            break;
                        }
                    }
                }
            }

            return(retVal);
        }
 /// <summary>
 /// Indicates that at least one message of type levelEnum is attached to the element
 /// </summary>
 /// <param name="levelEnum"></param>
 /// <returns></returns>
 public bool HasMessage(Utils.ElementLog.LevelEnum levelEnum)
 {
     return(false);
 }