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. 84
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

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

@ -84,67 +84,59 @@ 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) {
} else { if (classVariable != null && classVariable.IsStatic) {
if (classVariable.IsPublic) { // Public static
if (classVariable.IsStatic) { if (staticMenu.TreeListView == null) {
publicStatic.Add(variable); tree.Add(staticMenu);
tree.Sort(false);
}
staticMenu.Items.Add(new TreeListViewDebuggerItem(variable));
} else { } else {
publicInstance.Add(variable); // Public instance
tree.Add(new TreeListViewDebuggerItem(variable));
} }
} else { } else {
if (classVariable.IsStatic) { if (classVariable.IsStatic) {
privateStatic.Add(variable); // Private static
} else { if (staticMenu.TreeListView == null) {
privateInstance.Add(variable); tree.Add(staticMenu);
} tree.Sort(false);
}
}
} }
if (privateStaticMenu.TreeListView == null) {
if (privateInstance.Count > 0) { staticMenu.Items.Add(privateStaticMenu);
AddMenu("<Private Members>", privateInstance, tree); staticMenu.Items.Sort(false);
}
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);
} }
privateStaticMenu.Items.Add(new TreeListViewDebuggerItem(variable));
} else {
// Private instance
if (privateInstanceMenu.TreeListView == null) {
tree.Add(privateInstanceMenu);
tree.Sort(false);
} }
privateInstanceMenu.Items.Add(new TreeListViewDebuggerItem(variable));
public static void AddMenu(string name, List<Variable> variables, TreeListViewItemCollection tree)
{
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) varCollection.VariableAdded += delegate(object sender, VariableEventArgs e) {
{ addVariable(e.Variable);
TreeListViewDebuggerItem newItem = new TreeListViewDebuggerItem(variableToAdd); };
tree.Add(newItem); foreach(Variable variable in varCollection) {
addVariable(variable);
}
} }
private void localVarList_BeforeExpand(object sender, TreeListViewCancelEventArgs e) private void localVarList_BeforeExpand(object sender, TreeListViewCancelEventArgs e)

Loading…
Cancel
Save