static void BuildTreeChildren (Gtk.TreeStore store, Gtk.TreeIter parent, XContainer p) { foreach (XNode n in p.Nodes) { Gtk.TreeIter childIter; if (!parent.Equals (Gtk.TreeIter.Zero)) childIter = store.AppendValues (parent, n); else childIter = store.AppendValues (n); XContainer c = n as XContainer; if (c != null && c.FirstChild != null) BuildTreeChildren (store, childIter, c); } }
void BuildTreeChildren (Gtk.TreeStore store, Gtk.TreeIter parent, XContainer p, IList<Block> blocks) { foreach (XNode node in p.Nodes) { var el = node as XElement; if (el == null) { var startLoc = node.Region.Begin; var endLoc = node.Region.End; var doc = defaultDocument.Editor.Document; var blocksBetween = blocks.Where (n => n.Start.AbsoluteIndex >= doc.GetOffset (startLoc) && n.Start.AbsoluteIndex <= doc.GetOffset (endLoc)); foreach (var block in blocksBetween) { var outlineNode = new RazorOutlineNode (block) { Location = new DomRegion (doc.OffsetToLocation (block.Start.AbsoluteIndex), doc.OffsetToLocation (block.Start.AbsoluteIndex + block.Length)) }; if (!parent.Equals (Gtk.TreeIter.Zero)) store.AppendValues (parent, outlineNode); else store.AppendValues (outlineNode); } continue; } Gtk.TreeIter childIter; if (!parent.Equals (Gtk.TreeIter.Zero)) childIter = store.AppendValues (parent, new RazorOutlineNode(el)); else childIter = store.AppendValues (new RazorOutlineNode(el)); BuildTreeChildren (store, childIter, el, blocks); } }