Browse Source

Updated DynamicTreeDebuggerRow adapter to the new model.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2795 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 18 years ago
parent
commit
701390db65
  1. 38
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/DynamicTreeDebuggerRow.cs

38
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/DynamicTreeDebuggerRow.cs

@ -28,8 +28,7 @@ namespace Debugger.AddIn.TreeModel
AbstractNode content; AbstractNode content;
bool populated = false; bool loadChildsWhenExpanding;
bool visible = true;
public AbstractNode Content { public AbstractNode Content {
get { return content; } get { return content; }
@ -37,35 +36,25 @@ namespace Debugger.AddIn.TreeModel
public DynamicTreeDebuggerRow(AbstractNode content) 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); DebuggerGridControl.AddColumns(this.ChildColumns);
this[1].Paint += OnIconPaint; this[1].Paint += OnIconPaint;
this[3].FinishLabelEdit += OnLabelEdited; this[3].FinishLabelEdit += OnLabelEdited;
this[3].MouseDown += OnMouseDown; 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[1].Text = ""; // Icon
this[2].Text = content.Name; this[2].Text = content.Name;
this[3].Text = content.Text; this[3].Text = content.Text;
this[3].AllowLabelEdit = content is ISetText; this[3].AllowLabelEdit = content is ISetText;
this.ShowPlus = content.ChildNodes != null; this.ShowPlus = (content.ChildNodes != null);
this.ShowMinusWhileExpanded = true; this.ShowMinusWhileExpanded = true;
} }
@ -97,18 +86,13 @@ namespace Debugger.AddIn.TreeModel
/// </summary> /// </summary>
protected override void OnExpanding(DynamicListEventArgs e) protected override void OnExpanding(DynamicListEventArgs e)
{ {
if (!populated) { if (loadChildsWhenExpanding) {
WindowsDebugger.DoInPausedState(delegate { Populate(); }); loadChildsWhenExpanding = false;
} this.ChildRows.Clear();
} foreach(AbstractNode childNode in content.ChildNodes) {
this.ChildRows.Add(new DynamicTreeDebuggerRow(childNode));
void Populate() }
{
this.ChildRows.Clear();
foreach(AbstractNode childNode in content.ChildNodes) {
this.ChildRows.Add(new DynamicTreeDebuggerRow(childNode));
} }
populated = true;
} }
} }
} }

Loading…
Cancel
Save