/// <summary> /// Finds the node which references the element provided /// </summary> /// <param name="node"></param> /// <param name="element"></param> /// <param name="buildSubNodes">Indicates that the sub nodes should be built before trying to select a sub element</param> /// <returns></returns> private BaseTreeNode InnerFindNode(BaseTreeNode node, IModelElement element, bool buildSubNodes) { BaseTreeNode retVal = null; if (node.Model == element) { retVal = node; } else { // Ensures that the sub nodes have been built before trying to find the corresponding element if (buildSubNodes && !node.SubNodesBuilt) { node.BuildOrRefreshSubNodes(null); } foreach (BaseTreeNode subNode in node.Nodes) { if (subNode.Model.IsParent(element)) { retVal = InnerFindNode(subNode, element, buildSubNodes); if (retVal != null) { break; } } } } return(retVal); }
/// <summary> /// Builds the subnodes if needed, then try to select the next Error/Warning/Info /// </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> /// <returns>The node which corresponds to the search criteria, null otherwise</returns> private BaseTreeNode InnerSelectNext(IModelElement current, BaseTreeNode node, ElementLog.LevelEnum levelEnum) { BaseTreeNode retVal = null; if (!node.SubNodesBuilt) { node.BuildOrRefreshSubNodes(null); } foreach (BaseTreeNode subNode in node.Nodes) { retVal = RecursivelySelectNext(current, subNode, levelEnum, true); if (retVal != null) { break; } } return(retVal); }