Browse Source

Removed unused merging functions from VariableCollection

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1113 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
David Srbecký 20 years ago
parent
commit
986ea8c712
  1. 2
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs
  2. 44
      src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

2
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Debugger/NDebugger.cs

@ -209,7 +209,7 @@ namespace Debugger @@ -209,7 +209,7 @@ namespace Debugger
void OnUpdatingLocalVariables(object sender, VariableCollectionEventArgs e)
{
if (CurrentFunction == null) {
e.VariableCollection.UpdateTo(VariableCollection.Empty);
e.VariableCollection.UpdateTo(new Variable[] {}); // Make it empty
} else {
e.VariableCollection.UpdateTo(CurrentFunction.Variables);
}

44
src/AddIns/Misc/Debugger/Debugger.Core/Project/Src/Variables/VariableCollection.cs

@ -138,19 +138,6 @@ namespace Debugger @@ -138,19 +138,6 @@ namespace Debugger
OnUpdating();
}
/// <summary>
/// Updates the given collections and changes the state of this collection so that it matches the given collections.
/// </summary>
/// <param name="collections"></param>
public void UpdateTo(params VariableCollection[] collections)
{
VariableCollection mergedCollection = VariableCollection.Merge(collections);
mergedCollection.Update();
UpdateTo((IEnumerable<Variable>)mergedCollection.InnerList.ToArray(typeof(Variable)));
}
public void UpdateTo(IEnumerable<Variable> newVariables)
{
ArrayList toBeRemoved = (ArrayList)this.InnerList.Clone();
@ -199,36 +186,5 @@ namespace Debugger @@ -199,36 +186,5 @@ namespace Debugger
return txt;
}
public static VariableCollection Merge(params VariableCollection[] collections)
{
if (collections.Length == 0) throw new ArgumentException("Can not have lenght of 0", "collections");
VariableCollection newCollection = new VariableCollection(collections[0].Debugger);
newCollection.MergeWith(collections);
return newCollection;
}
public void MergeWith(params VariableCollection[] collections)
{
// Add items of subcollections and ensure the stay in sync
foreach(VariableCollection collection in collections) {
foreach(Variable variable in collection) {
this.Add(variable);
}
collection.VariableAdded += delegate(object sender, VariableEventArgs e) {
this.Add(e.Variable);
};
collection.VariableRemoved += delegate(object sender, VariableEventArgs e) {
this.Remove(e.Variable);
};
}
// Update subcollections at update
this.Updating += delegate {
foreach(VariableCollection collection in collections) {
collection.Update();
};
};
}
}
}

Loading…
Cancel
Save