private ITreeNode GetNodeFromRange(DocumentRange needRange) { IDocument doc = needRange.Document; var treeList = new List <ITreeNode>(ExistingTreeNodes.GetTreeNodes(doc)); foreach (ITreeNode tree in treeList) { List <DocumentRange> treeRanges = tree.UserData.GetData(Constants.Ranges); if (treeRanges == null) { continue; } foreach (var range in treeRanges) { if (needRange.ContainedIn(range)) { return(tree.FindNodeAt(GetTreeTextRange(needRange.TextRange))); } } } return(null); }
private ITreeNode GetNodeFromRange(DocumentRange needRange) { IDocument doc = needRange.Document; var treeList = new List<ITreeNode>(ExistingTreeNodes.GetTreeNodes(doc)); foreach (ITreeNode tree in treeList) { List<DocumentRange> treeRanges = tree.UserData.GetData(Constants.Ranges); if (treeRanges == null) continue; foreach (var range in treeRanges) { if (needRange.ContainedIn(range)) return tree.FindNodeAt(GetTreeTextRange(needRange.TextRange)); } } return null; }