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

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

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

Loading…
Cancel
Save