Browse Source

Updating DynamicTreeDebuggerRow adapter.

Fixed disappearing plus for TreeViewNode.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2841 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 19 years ago
parent
commit
90e524eeb7
  1. 6
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  2. 82
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/DynamicTreeDebuggerRow.cs
  3. 5
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs

6
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -286,7 +286,11 @@ namespace ICSharpCode.SharpDevelop.Services @@ -286,7 +286,11 @@ namespace ICSharpCode.SharpDevelop.Services
if (expression == null) {
return null;
} else {
return new DebuggerGridControl(new DynamicTreeDebuggerRow(new ExpressionNode(expression)));
try {
return new DebuggerGridControl(new DynamicTreeDebuggerRow(DebuggedProcess, new ExpressionNode(expression)));
} catch (AbortedBecauseDebugeeStateExpiredException) {
return null;
}
}
}

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

@ -25,27 +25,30 @@ namespace Debugger.AddIn.TreeModel @@ -25,27 +25,30 @@ namespace Debugger.AddIn.TreeModel
// 1 = icon
// 2 = text
// 3 = value
Process process;
AbstractNode content;
bool loadChildsWhenExpanding;
bool childsLoaded;
public AbstractNode Content {
get { return content; }
}
public DynamicTreeDebuggerRow(AbstractNode content)
public DynamicTreeDebuggerRow(Process process, AbstractNode content)
{
this.process = process;
DebuggerGridControl.AddColumns(this.ChildColumns);
this[1].Paint += OnIconPaint;
this[3].FinishLabelEdit += OnLabelEdited;
this[3].MouseDown += OnMouseDown;
SetContent(content);
SetContentRecursive(content);
}
public void SetContent(AbstractNode content)
public void SetContentRecursive(AbstractNode content)
{
this.content = content;
@ -56,6 +59,62 @@ namespace Debugger.AddIn.TreeModel @@ -56,6 +59,62 @@ namespace Debugger.AddIn.TreeModel
this.ShowPlus = (content.ChildNodes != null);
this.ShowMinusWhileExpanded = true;
childsLoaded = false;
if (content.ChildNodes != null && this.ChildRows.Count > 0) {
LoadChilds();
}
// Repaint and process user commands
DebugeeState state = process.DebugeeState;
Util.DoEvents();
if (process.IsRunning || state.HasExpired) {
throw new AbortedBecauseDebugeeStateExpiredException();
}
}
public void SetChildContentRecursive(IEnumerable<AbstractNode> contentEnum)
{
contentEnum = contentEnum ?? new AbstractNode[0];
int index = 0;
foreach(AbstractNode content in contentEnum) {
// Add or overwrite existing items
if (index < ChildRows.Count) {
// Overwrite
((DynamicTreeDebuggerRow)ChildRows[index]).SetContentRecursive(content);
} else {
// Add
ChildRows.Add(new DynamicTreeDebuggerRow(process, content));
}
index++;
}
int count = index;
// Delete other nodes
while(ChildRows.Count > count) {
ChildRows.RemoveAt(count);
}
}
/// <summary>
/// Called when plus is pressed in debugger tooltip.
/// Sets the data to be show in the next level.
/// </summary>
protected override void OnExpanding(DynamicListEventArgs e)
{
base.OnExpanding(e);
try {
LoadChilds();
} catch (AbortedBecauseDebugeeStateExpiredException) {
}
}
void LoadChilds()
{
if (!childsLoaded) {
childsLoaded = true;
SetChildContentRecursive(content.ChildNodes);
}
}
void OnIconPaint(object sender, ItemPaintEventArgs e)
@ -79,20 +138,5 @@ namespace Debugger.AddIn.TreeModel @@ -79,20 +138,5 @@ namespace Debugger.AddIn.TreeModel
}
}
}
/// <summary>
/// Called when plus is pressed in debugger tooltip.
/// Sets the data to be show in the next level.
/// </summary>
protected override void OnExpanding(DynamicListEventArgs e)
{
if (loadChildsWhenExpanding) {
loadChildsWhenExpanding = false;
this.ChildRows.Clear();
foreach(AbstractNode childNode in content.ChildNodes) {
this.ChildRows.Add(new DynamicTreeDebuggerRow(childNode));
}
}
}
}
}

5
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewNode.cs

@ -51,7 +51,8 @@ namespace Debugger.AddIn.TreeModel @@ -51,7 +51,8 @@ namespace Debugger.AddIn.TreeModel
this.content = content;
this.IsLeaf = (content.ChildNodes == null);
childsLoaded = false;
if (content.ChildNodes != null && expandedNodes.ContainsKey(this.FullName) && expandedNodes[this.FullName]) {
this.IsExpandedOnce = false;
if (!IsLeaf && expandedNodes.ContainsKey(this.FullName) && expandedNodes[this.FullName]) {
LoadChilds();
this.Expand();
} else {
@ -103,8 +104,8 @@ namespace Debugger.AddIn.TreeModel @@ -103,8 +104,8 @@ namespace Debugger.AddIn.TreeModel
{
if (!childsLoaded) {
childsLoaded = true;
SetContentRecursive(localVarPad, this.Children, this.Content.ChildNodes);
this.IsExpandedOnce = true;
SetContentRecursive(localVarPad, this.Children, this.Content.ChildNodes);
}
}

Loading…
Cancel
Save