|
|
|
@ -3,7 +3,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Linq; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading; |
|
|
|
|
|
|
|
using System.Windows.Controls; |
|
|
|
using System.Windows.Controls; |
|
|
|
using System.Windows.Input; |
|
|
|
using System.Windows.Input; |
|
|
|
using System.Windows.Threading; |
|
|
|
using System.Windows.Threading; |
|
|
|
@ -14,7 +13,6 @@ using Debugger.AddIn.Pads.Controls; |
|
|
|
using Debugger.AddIn.TreeModel; |
|
|
|
using Debugger.AddIn.TreeModel; |
|
|
|
using ICSharpCode.Core; |
|
|
|
using ICSharpCode.Core; |
|
|
|
using ICSharpCode.Core.Presentation; |
|
|
|
using ICSharpCode.Core.Presentation; |
|
|
|
using ICSharpCode.NRefactory; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Project; |
|
|
|
using ICSharpCode.SharpDevelop.Project; |
|
|
|
using ICSharpCode.SharpDevelop.Services; |
|
|
|
using ICSharpCode.SharpDevelop.Services; |
|
|
|
using ICSharpCode.SharpDevelop.Workbench; |
|
|
|
using ICSharpCode.SharpDevelop.Workbench; |
|
|
|
@ -43,45 +41,52 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads |
|
|
|
var res = new CommonResources(); |
|
|
|
var res = new CommonResources(); |
|
|
|
res.InitializeComponent(); |
|
|
|
res.InitializeComponent(); |
|
|
|
|
|
|
|
|
|
|
|
this.tree = new SharpTreeView(); |
|
|
|
tree = new SharpTreeView(); |
|
|
|
this.tree.Root = new SharpTreeNode(); |
|
|
|
tree.Root = new SharpTreeNode(); |
|
|
|
this.tree.ShowRoot = false; |
|
|
|
tree.ShowRoot = false; |
|
|
|
this.tree.View = (GridView)res["variableGridView"]; |
|
|
|
tree.View = (GridView)res["variableGridView"]; |
|
|
|
this.tree.ContextMenu = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/WatchPad/ContextMenu"); |
|
|
|
tree.SetValue(GridViewColumnAutoSize.AutoWidthProperty, "50%;25%;25%"); |
|
|
|
this.tree.MouseDoubleClick += delegate(object sender, MouseButtonEventArgs e) { |
|
|
|
tree.ContextMenu = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/WatchPad/ContextMenu"); |
|
|
|
|
|
|
|
tree.MouseDoubleClick += delegate(object sender, MouseButtonEventArgs e) { |
|
|
|
if (this.tree.SelectedItem == null) { |
|
|
|
if (this.tree.SelectedItem == null) { |
|
|
|
AddWatchCommand cmd = new AddWatchCommand { Owner = this }; |
|
|
|
AddWatchCommand cmd = new AddWatchCommand { Owner = this }; |
|
|
|
cmd.Run(); |
|
|
|
cmd.Run(); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
ProjectService.SolutionLoaded += delegate { LoadNodes(); }; |
|
|
|
// ProjectService.SolutionLoaded += delegate { LoadNodes(); };
|
|
|
|
ProjectService.SolutionClosing += delegate { SaveNodes(); }; |
|
|
|
// ProjectService.SolutionClosing += delegate { SaveNodes(); };
|
|
|
|
LoadNodes(); |
|
|
|
// LoadNodes();
|
|
|
|
|
|
|
|
|
|
|
|
WindowsDebugger.RefreshingPads += RefreshPad; |
|
|
|
WindowsDebugger.RefreshingPads += RefreshPad; |
|
|
|
RefreshPad(); |
|
|
|
RefreshPad(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void LoadNodes() |
|
|
|
// void LoadNodes()
|
|
|
|
{ |
|
|
|
// {
|
|
|
|
if (ProjectService.OpenSolution != null) { |
|
|
|
// if (ProjectService.OpenSolution != null) {
|
|
|
|
var props = ProjectService.OpenSolution.Preferences.NestedProperties("Watches"); |
|
|
|
// var props = ProjectService.OpenSolution.Preferences.NestedProperties("Watches");
|
|
|
|
foreach (var key in props.Keys) { |
|
|
|
// foreach (var key in props.Keys) {
|
|
|
|
this.Items.Add(new TreeNode(props.Get(key, ""), () => null).ToSharpTreeNode()); |
|
|
|
// this.Items.Add(new TreeNode(props.Get(key, ""), () => null).ToSharpTreeNode());
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// void SaveNodes()
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// if (ProjectService.OpenSolution != null) {
|
|
|
|
|
|
|
|
// var props = new Properties();
|
|
|
|
|
|
|
|
// ProjectService.OpenSolution.Preferences.SetNestedProperties("Watches", props);
|
|
|
|
|
|
|
|
// foreach(var node in this.Items.OfType<TreeNode>()) {
|
|
|
|
|
|
|
|
// props.Set(node.Name, node.EvalEnabled);
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
void SaveNodes() |
|
|
|
public void AddWatch(string expression = null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (ProjectService.OpenSolution != null) { |
|
|
|
var node = MakeNode(expression); |
|
|
|
var props = new Properties(); |
|
|
|
this.Items.Add(node); |
|
|
|
ProjectService.OpenSolution.Preferences.SetNestedProperties("Watches", props); |
|
|
|
|
|
|
|
foreach(var node in this.Items.OfType<TreeNode>()) { |
|
|
|
|
|
|
|
props.Set(node.Name, (object)null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SharpTreeNodeAdapter MakeNode(string name) |
|
|
|
SharpTreeNodeAdapter MakeNode(string name) |
|
|
|
@ -89,13 +94,21 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads |
|
|
|
LoggingService.Info("Evaluating watch: " + name); |
|
|
|
LoggingService.Info("Evaluating watch: " + name); |
|
|
|
TreeNode node = null; |
|
|
|
TreeNode node = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
node = new ValueNode(null, name, () => WindowsDebugger.Evaluate(name)); |
|
|
|
node = new ValueNode(null, name, |
|
|
|
|
|
|
|
() => { |
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(name)) |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
return WindowsDebugger.Evaluate(name); |
|
|
|
|
|
|
|
}); |
|
|
|
} catch (GetValueException e) { |
|
|
|
} catch (GetValueException e) { |
|
|
|
node = new TreeNode(SD.ResourceService.GetImage("Icons.16x16.Error"), name, e.Message, string.Empty, null); |
|
|
|
node = new TreeNode(null, name, e.Message, string.Empty, null); |
|
|
|
} |
|
|
|
} |
|
|
|
node.CanDelete = true; |
|
|
|
node.CanDelete = true; |
|
|
|
node.CanSetName = true; |
|
|
|
node.CanSetName = true; |
|
|
|
node.PropertyChanged += (s, e) => { if (e.PropertyName == "Name") WindowsDebugger.RefreshPads(); }; |
|
|
|
node.PropertyChanged += (s, e) => { |
|
|
|
|
|
|
|
if (e.PropertyName == "Name") |
|
|
|
|
|
|
|
WindowsDebugger.RefreshPads(); |
|
|
|
|
|
|
|
}; |
|
|
|
return node.ToSharpTreeNode(); |
|
|
|
return node.ToSharpTreeNode(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -103,12 +116,14 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads |
|
|
|
{ |
|
|
|
{ |
|
|
|
Process process = WindowsDebugger.CurrentProcess; |
|
|
|
Process process = WindowsDebugger.CurrentProcess; |
|
|
|
if (process != null) { |
|
|
|
if (process != null) { |
|
|
|
var names = this.Items.OfType<SharpTreeNodeAdapter>().Select(n => n.Node.Name).ToList(); |
|
|
|
var expressions = this.Items.OfType<SharpTreeNodeAdapter>() |
|
|
|
|
|
|
|
.Select(n => n.Node.Name) |
|
|
|
|
|
|
|
.ToList(); |
|
|
|
this.Items.Clear(); |
|
|
|
this.Items.Clear(); |
|
|
|
process.EnqueueForEach( |
|
|
|
process.EnqueueForEach( |
|
|
|
Dispatcher.CurrentDispatcher, |
|
|
|
Dispatcher.CurrentDispatcher, |
|
|
|
names, |
|
|
|
expressions, |
|
|
|
name => this.Items.Add(MakeNode(name)) |
|
|
|
expr => this.Items.Add(MakeNode(expr)) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|