From 701390db650a9ad06ffce2b4eeb986962716acf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Srbeck=C3=BD?= Date: Tue, 8 Jan 2008 22:01:51 +0000 Subject: [PATCH] Updated DynamicTreeDebuggerRow adapter to the new model. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2795 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Adapters/DynamicTreeDebuggerRow.cs | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/DynamicTreeDebuggerRow.cs b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/DynamicTreeDebuggerRow.cs index 3dc5fbb5f7..8ab58bce1b 100644 --- a/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/DynamicTreeDebuggerRow.cs +++ b/src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/DynamicTreeDebuggerRow.cs @@ -28,8 +28,7 @@ namespace Debugger.AddIn.TreeModel AbstractNode content; - bool populated = false; - bool visible = true; + bool loadChildsWhenExpanding; public AbstractNode Content { get { return content; } @@ -37,35 +36,25 @@ namespace Debugger.AddIn.TreeModel public DynamicTreeDebuggerRow(AbstractNode content) { - this.content = content; - - this.Shown += delegate { - visible = true; - WindowsDebugger.DoInPausedState( delegate { Update(); } ); - }; - this.Hidden += delegate { - visible = false; - }; - DebuggerGridControl.AddColumns(this.ChildColumns); this[1].Paint += OnIconPaint; this[3].FinishLabelEdit += OnLabelEdited; this[3].MouseDown += OnMouseDown; - Update(); + SetContent(content); } - void Update() + public void SetContent(AbstractNode content) { - if (!visible) return; + this.content = content; this[1].Text = ""; // Icon this[2].Text = content.Name; this[3].Text = content.Text; this[3].AllowLabelEdit = content is ISetText; - this.ShowPlus = content.ChildNodes != null; + this.ShowPlus = (content.ChildNodes != null); this.ShowMinusWhileExpanded = true; } @@ -97,18 +86,13 @@ namespace Debugger.AddIn.TreeModel /// protected override void OnExpanding(DynamicListEventArgs e) { - if (!populated) { - WindowsDebugger.DoInPausedState(delegate { Populate(); }); - } - } - - void Populate() - { - this.ChildRows.Clear(); - foreach(AbstractNode childNode in content.ChildNodes) { - this.ChildRows.Add(new DynamicTreeDebuggerRow(childNode)); + if (loadChildsWhenExpanding) { + loadChildsWhenExpanding = false; + this.ChildRows.Clear(); + foreach(AbstractNode childNode in content.ChildNodes) { + this.ChildRows.Add(new DynamicTreeDebuggerRow(childNode)); + } } - populated = true; } } }