From 871022c697ae6b1acdd019300786a3fe5ccfdbaf Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Fri, 30 Aug 2013 15:37:36 +0200 Subject: [PATCH] add missing command --- .../Debugger.AddIn/Debugger.AddIn.addin | 12 +++++ .../Debugger.AddIn/TreeModel/Commands.cs | 13 ++++- .../Debugger.AddIn/TreeModel/TreeNode.cs | 2 +- .../Debugger.AddIn/TreeModel/ValueNode.cs | 54 +++---------------- 4 files changed, 31 insertions(+), 50 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin index 91bc6f8719..f00af0b754 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin +++ b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin @@ -173,6 +173,18 @@ + + + + + + + + + diff --git a/src/AddIns/Debugger/Debugger.AddIn/TreeModel/Commands.cs b/src/AddIns/Debugger/Debugger.AddIn/TreeModel/Commands.cs index b0b5fe0891..e93efe8fbb 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/TreeModel/Commands.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/TreeModel/Commands.cs @@ -31,8 +31,19 @@ namespace Debugger.AddIn.TreeModel b.AppendLine(); b.Append(node.FullText); } - + return b.ToString(); } } + + public class ShowFullErrorCommand : SimpleCommand + { + public override void Execute(object parameter) + { + var grid = parameter as DataGrid; + if (grid == null) return; + var error = grid.SelectedItems.OfType().Select(node => node.error).Single(); + SD.MessageService.ShowException(error, null); + } + } } diff --git a/src/AddIns/Debugger/Debugger.AddIn/TreeModel/TreeNode.cs b/src/AddIns/Debugger/Debugger.AddIn/TreeModel/TreeNode.cs index cd7d108d96..ed4c5bf3a6 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/TreeModel/TreeNode.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/TreeModel/TreeNode.cs @@ -83,7 +83,7 @@ namespace Debugger.AddIn.TreeModel } string contextMenuAddInTreeEntry = "/AddIns/Debugger/Tooltips/ContextMenu/TreeNode"; - public virtual string ContextMenuAddInTreeEntry { + public string ContextMenuAddInTreeEntry { get { return contextMenuAddInTreeEntry; } set { if (this.contextMenuAddInTreeEntry != value) { diff --git a/src/AddIns/Debugger/Debugger.AddIn/TreeModel/ValueNode.cs b/src/AddIns/Debugger/Debugger.AddIn/TreeModel/ValueNode.cs index 2311f6991f..c52c39fbe9 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/TreeModel/ValueNode.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/TreeModel/ValueNode.cs @@ -43,7 +43,7 @@ namespace Debugger.AddIn.TreeModel long cachedValueDebuggeeState; string fullValue; - GetValueException error; + internal GetValueException error; public string FullText { get { return this.Value; } @@ -57,6 +57,7 @@ namespace Debugger.AddIn.TreeModel this.getValue = getValue; this.setValue = setValue; + this.ContextMenuAddInTreeEntry = "/AddIns/Debugger/Tooltips/ContextMenu/ValueNode"; GetValueAndUpdateUI(); } @@ -187,54 +188,11 @@ namespace Debugger.AddIn.TreeModel this.GetChildren = null; this.VisualizerCommands = null; } - } - -// public ContextMenuStrip GetContextMenu() -// { -// if (this.Error != null) return GetErrorContextMenu(); -// -// ContextMenuStrip menu = new ContextMenuStrip(); -// -// ToolStripMenuItem copyItem; -// copyItem = new ToolStripMenuItem(); -// copyItem.Text = ResourceService.GetString("MainWindow.Windows.Debug.LocalVariables.CopyToClipboard"); -// copyItem.Checked = false; -// copyItem.Click += delegate { -// ClipboardWrapper.SetText(fullText); -// }; - -// ToolStripMenuItem hexView; -// hexView = new ToolStripMenuItem(); -// hexView.Text = ResourceService.GetString("MainWindow.Windows.Debug.LocalVariables.ShowInHexadecimal"); -// hexView.Checked = DebuggingOptions.Instance.ShowValuesInHexadecimal; -// hexView.Click += delegate { -// // refresh all pads that use ValueNode for display -// DebuggingOptions.Instance.ShowValuesInHexadecimal = !DebuggingOptions.Instance.ShowValuesInHexadecimal; -// // always check if instance is null, might be null if pad is not opened -// if (LocalVarPad.Instance != null) -// LocalVarPad.Instance.RefreshPad(); -// if (WatchPad.Instance != null) -// WatchPad.Instance.RefreshPad(); -// }; - -// menu.Items.AddRange(new ToolStripItem[] { -// copyItem, -// //hexView -// }); -// -// return menu; -// } - - ContextMenuStrip GetErrorContextMenu() - { - ContextMenuStrip menu = new ContextMenuStrip(); - - ToolStripMenuItem showError = new ToolStripMenuItem(); - showError.Text = StringParser.Parse("${res:MainWindow.Windows.Debug.LocalVariables.ShowFullError}"); - showError.Click += delegate { MessageService.ShowException(error, null); }; - menu.Items.Add(showError); - return menu; + if (error == null) + ContextMenuAddInTreeEntry = "/AddIns/Debugger/Tooltips/ContextMenu/ValueNode"; + else + ContextMenuAddInTreeEntry = "/AddIns/Debugger/Tooltips/ContextMenu/ErrorNode"; } ///