Browse Source

add missing command

pull/59/merge
Siegfried Pammer 13 years ago
parent
commit
871022c697
  1. 12
      src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin
  2. 11
      src/AddIns/Debugger/Debugger.AddIn/TreeModel/Commands.cs
  3. 2
      src/AddIns/Debugger/Debugger.AddIn/TreeModel/TreeNode.cs
  4. 54
      src/AddIns/Debugger/Debugger.AddIn/TreeModel/ValueNode.cs

12
src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin

@ -173,6 +173,18 @@
<Path name="/AddIns/Debugger/Tooltips/ContextMenu/TreeNode"> <Path name="/AddIns/Debugger/Tooltips/ContextMenu/TreeNode">
<MenuItem id="Copy" <MenuItem id="Copy"
label="${res:MainWindow.Windows.Debug.LocalVariables.CopyToClipboard}" label="${res:MainWindow.Windows.Debug.LocalVariables.CopyToClipboard}"
icon="Icons.16x16.CopyIcon"
class="Debugger.AddIn.TreeModel.CopyCommand" /> class="Debugger.AddIn.TreeModel.CopyCommand" />
</Path> </Path>
<Path name="/AddIns/Debugger/Tooltips/ContextMenu/ErrorNode">
<MenuItem id="ShowFullError"
label="${res:MainWindow.Windows.Debug.LocalVariables.ShowFullError}"
class="Debugger.AddIn.TreeModel.ShowFullErrorCommand" />
<Include path="/AddIns/Debugger/Tooltips/ContextMenu/TreeNode" />
</Path>
<Path name="/AddIns/Debugger/Tooltips/ContextMenu/ValueNode">
<Include path="/AddIns/Debugger/Tooltips/ContextMenu/TreeNode" />
</Path>
</AddIn> </AddIn>

11
src/AddIns/Debugger/Debugger.AddIn/TreeModel/Commands.cs

@ -35,4 +35,15 @@ namespace Debugger.AddIn.TreeModel
return b.ToString(); 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<ValueNode>().Select(node => node.error).Single();
SD.MessageService.ShowException(error, null);
}
}
} }

2
src/AddIns/Debugger/Debugger.AddIn/TreeModel/TreeNode.cs

@ -83,7 +83,7 @@ namespace Debugger.AddIn.TreeModel
} }
string contextMenuAddInTreeEntry = "/AddIns/Debugger/Tooltips/ContextMenu/TreeNode"; string contextMenuAddInTreeEntry = "/AddIns/Debugger/Tooltips/ContextMenu/TreeNode";
public virtual string ContextMenuAddInTreeEntry { public string ContextMenuAddInTreeEntry {
get { return contextMenuAddInTreeEntry; } get { return contextMenuAddInTreeEntry; }
set { set {
if (this.contextMenuAddInTreeEntry != value) { if (this.contextMenuAddInTreeEntry != value) {

54
src/AddIns/Debugger/Debugger.AddIn/TreeModel/ValueNode.cs

@ -43,7 +43,7 @@ namespace Debugger.AddIn.TreeModel
long cachedValueDebuggeeState; long cachedValueDebuggeeState;
string fullValue; string fullValue;
GetValueException error; internal GetValueException error;
public string FullText { public string FullText {
get { return this.Value; } get { return this.Value; }
@ -57,6 +57,7 @@ namespace Debugger.AddIn.TreeModel
this.getValue = getValue; this.getValue = getValue;
this.setValue = setValue; this.setValue = setValue;
this.ContextMenuAddInTreeEntry = "/AddIns/Debugger/Tooltips/ContextMenu/ValueNode";
GetValueAndUpdateUI(); GetValueAndUpdateUI();
} }
@ -187,54 +188,11 @@ namespace Debugger.AddIn.TreeModel
this.GetChildren = null; this.GetChildren = null;
this.VisualizerCommands = 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";
} }
/// <summary> /// <summary>

Loading…
Cancel
Save