Browse Source

Private and static members in Local Variables Pad fixed for variables that change type

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1405 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
666b22345b
  1. 88
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

88
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

@ -84,69 +84,61 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
localVarList.EndUpdate(); localVarList.EndUpdate();
} }
delegate void AddVariableMethod(Variable variable);
public static void AddVariableCollectionToTree(VariableCollection varCollection, TreeListViewItemCollection tree) public static void AddVariableCollectionToTree(VariableCollection varCollection, TreeListViewItemCollection tree)
{ {
varCollection.VariableAdded += delegate(object sender, VariableEventArgs e) { TreeListViewItem privateInstanceMenu = new TreeListViewItem("<Private Members>", 0);
AddVariableToTree(e.Variable, tree); TreeListViewItem staticMenu = new TreeListViewItem("<Static Members>", 0);
}; TreeListViewItem privateStaticMenu = new TreeListViewItem("<Private Static Members>", 0);
List<Variable> publicStatic = new List<Variable>();
List<Variable> publicInstance = new List<Variable>();
List<Variable> privateStatic = new List<Variable>();
List<Variable> privateInstance = new List<Variable>();
foreach(Variable variable in varCollection) { AddVariableMethod addVariable = delegate(Variable variable) {
ClassVariable classVariable = variable as ClassVariable; ClassVariable classVariable = variable as ClassVariable;
if (classVariable == null) {
publicInstance.Add(variable); if (classVariable == null || classVariable.IsPublic) {
if (classVariable != null && classVariable.IsStatic) {
// Public static
if (staticMenu.TreeListView == null) {
tree.Add(staticMenu);
tree.Sort(false);
}
staticMenu.Items.Add(new TreeListViewDebuggerItem(variable));
} else {
// Public instance
tree.Add(new TreeListViewDebuggerItem(variable));
}
} else { } else {
if (classVariable.IsPublic) { if (classVariable.IsStatic) {
if (classVariable.IsStatic) { // Private static
publicStatic.Add(variable); if (staticMenu.TreeListView == null) {
} else { tree.Add(staticMenu);
publicInstance.Add(variable); tree.Sort(false);
}
if (privateStaticMenu.TreeListView == null) {
staticMenu.Items.Add(privateStaticMenu);
staticMenu.Items.Sort(false);
} }
privateStaticMenu.Items.Add(new TreeListViewDebuggerItem(variable));
} else { } else {
if (classVariable.IsStatic) { // Private instance
privateStatic.Add(variable); if (privateInstanceMenu.TreeListView == null) {
} else { tree.Add(privateInstanceMenu);
privateInstance.Add(variable); tree.Sort(false);
} }
privateInstanceMenu.Items.Add(new TreeListViewDebuggerItem(variable));
} }
} }
} };
if (privateInstance.Count > 0) { varCollection.VariableAdded += delegate(object sender, VariableEventArgs e) {
AddMenu("<Private Members>", privateInstance, tree); addVariable(e.Variable);
} };
if (publicStatic.Count > 0) {
AddMenu("<Public Static Members>", publicStatic, tree);
}
if (privateStatic.Count > 0) {
AddMenu("<Private Static Members>", privateStatic, tree);
}
// Public Members
foreach(Variable variable in publicInstance) {
AddVariableToTree(variable, tree);
}
}
public static void AddMenu(string name, List<Variable> variables, TreeListViewItemCollection tree) foreach(Variable variable in varCollection) {
{ addVariable(variable);
TreeListViewItem menu = new TreeListViewItem(name, 0);
tree.Add(menu);
foreach(Variable variable in variables) {
AddVariableToTree(variable, menu.Items);
} }
} }
public static void AddVariableToTree(Variable variableToAdd, TreeListViewItemCollection tree)
{
TreeListViewDebuggerItem newItem = new TreeListViewDebuggerItem(variableToAdd);
tree.Add(newItem);
}
private void localVarList_BeforeExpand(object sender, TreeListViewCancelEventArgs e) private void localVarList_BeforeExpand(object sender, TreeListViewCancelEventArgs e)
{ {
if (debuggerCore.IsPaused) { if (debuggerCore.IsPaused) {

Loading…
Cancel
Save