/// <summary> /// Open pads on their default positions. /// </summary> protected override void OpenDefaultPads() { base.OpenDefaultPads(); BreakpointsPad.ShowOnMainForm(); HardwarePad.ShowOnMainForm(); WatchPad.ShowOnMainForm(); }
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { List <ToolStripItem> items = new List <ToolStripItem>(); if (owner is WatchPad) { WatchPad pad = (WatchPad)owner; if (pad.WatchList.SelectedNode == null) { return(items.ToArray()); } var node = pad.WatchList.SelectedNode.Node; while (node.Parent != null && node.Parent.Parent != null) { node = node.Parent; } if (!(node is TextNode)) { return(items.ToArray()); } foreach (string item in SupportedLanguage.GetNames(typeof(SupportedLanguage))) { items.Add(MakeItem(item, item, node as TextNode, (sender, e) => HandleItem(sender))); } } return(items.ToArray()); }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; var inputWindow = new WatchInputBox(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.AddWatch}"), StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.EnterExpression}")); inputWindow.Owner = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWindow; if (inputWindow.ShowDialog() != true) { return; } string input = inputWindow.CommandText; if (!string.IsNullOrEmpty(input)) { var text = new TextNode(null, input, inputWindow.ScriptLanguage).ToSharpTreeNode(); var list = pad.WatchList; if (!list.WatchItems.Any(n => text.Node.FullName == ((TreeNodeWrapper)n).Node.FullName)) { list.WatchItems.Add(text); } } pad.InvalidatePad(); } }
public ToolStripItem[] BuildSubmenu(Codon codon, object owner) { List <ToolStripItem> items = new List <ToolStripItem>(); if (owner is WatchPad) { WatchPad pad = (WatchPad)owner; TreeViewVarNode node = ((TreeViewAdv)pad.Control).SelectedNode as TreeViewVarNode; if (node == null) { return(items.ToArray()); } while (node.Parent != ((TreeViewAdv)pad.Control).Root) { node = node.Parent as TreeViewVarNode; } if (!(node.Content is TextNode)) { return(items.ToArray()); } foreach (string item in SupportedLanguage.GetNames(typeof(SupportedLanguage))) { items.Add(MakeItem(item, item, node.Content as TextNode, (sender, e) => HandleItem(sender))); } } return(items.ToArray()); }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; pad.Items.Clear(); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; pad.AddWatch(focus: true); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; pad.Items.Remove(pad.Tree.SelectedItem as SharpTreeNodeAdapter); WindowsDebugger.RefreshPads(); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; var list = pad.WatchList; list.WatchItems.Clear(); } }
/// <summary> /// Saves the content of the Watch pad. /// </summary> public virtual void SaveWatch() { var memento = WatchPad.CreateMemento(); string path = Path.Combine(Platform.Project.Directory, "Watch.xml"); XmlSerializer s = new XmlSerializer(memento.GetType()); TextWriter w = new StreamWriter(path); s.Serialize(w, memento); w.Close(); }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; ((TreeViewAdv)pad.Control).BeginUpdate(); pad.Watches.Clear(); ((TreeViewAdv)pad.Control).Root.Children.Clear(); ((TreeViewAdv)pad.Control).EndUpdate(); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; var node = pad.WatchList.SelectedNode; if (node != null && node.Node is ExpressionNode) { string text = ((ExpressionNode)node.Node).FullText; ClipboardWrapper.SetText(text); } } }
/// <summary> /// Loads the content of the Watch pad. /// </summary> public virtual void LoadWatch() { string path = Path.Combine(Platform.Project.Directory, "Watch.xml"); if (File.Exists(path)) { XmlSerializer s = new XmlSerializer(typeof(WatchPad.WatchMemento)); TextReader r = new StreamReader(path); var memento = s.Deserialize(r) as WatchPad.WatchMemento; r.Close(); WatchPad.SetMemento(memento); } }
/// <summary> /// Creates, initializes pads and populates the Pads list. /// </summary> protected override void CreatePads() { base.CreatePads(); WatchPad = new WatchPad(Platform.Project); WatchPad.WatchAdded += new Action <WatchPad.WatchItem>(UpdateWatchItem); WatchPad.WatchValueEdited += new Action <WatchPad.WatchItem, long>(EditWatchValue); Pads.Add(WatchPad); BreakpointsPad = new BreakpointsPad(Platform.Project); BreakpointsPad.BreakpointController = Platform.DebuggerController.BreakpointController; Pads.Add(BreakpointsPad); HardwarePad = new HardwarePad(Platform.Project); Pads.Add(HardwarePad); }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; var list = pad.WatchList; var node = list.SelectedNode; if (node == null) { return; } list.WatchItems.Remove(node); ((WatchPad)this.Owner).InvalidatePad(); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; var inputWindow = new WatchInputBox(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.AddWatch}"), StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.EnterExpression}")); inputWindow.Owner = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainWindow; var result = inputWindow.ShowDialog(); if (!result.HasValue || !result.Value) { return; } string input = inputWindow.CommandText; if (!string.IsNullOrEmpty(input)) { // get language if (ProjectService.CurrentProject == null) { return; } string language = ProjectService.CurrentProject.Language; TextNode text = new TextNode(input, language == "VB" || language == "VBNet" ? SupportedLanguage.VBNet : SupportedLanguage.CSharp); var list = pad.WatchList; if (!list.WatchItems.ContainsItem(text)) { list.WatchItems.Add(text); } } pad.RefreshPad(); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; TreeViewAdv ctrl = (TreeViewAdv)pad.Control; string input = MessageService.ShowInputBox(StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.AddWatch}"), StringParser.Parse("${res:MainWindow.Windows.Debug.Watch.EnterExpression}"), ""); if (!string.IsNullOrEmpty(input)) { ((TreeViewAdv)pad.Control).BeginUpdate(); TextNode text = new TextNode(input); TreeViewVarNode node = new TreeViewVarNode(pad.Process, (TreeViewAdv)pad.Control, text); pad.Watches.Add(text); ((TreeViewAdv)pad.Control).Root.Children.Add(node); ((TreeViewAdv)pad.Control).EndUpdate(); } ((WatchPad)this.Owner).RefreshPad(); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; TreeNodeAdv node = ((TreeViewAdv)pad.Control).SelectedNode; if (node == null) { return; } while (node.Parent != ((TreeViewAdv)pad.Control).Root) { node = node.Parent; } pad.Watches.RemoveAt(node.Index); ((TreeViewAdv)pad.Control).Root.Children.Remove(node); ((WatchPad)this.Owner).RefreshPad(); } }
/// <summary> /// Creates, initializes pads and populates the Pads list. /// </summary> protected override void CreatePads() { base.CreatePads(); WatchPad = new WatchPad(Platform.Project); WatchPad.WatchAdded += new Action<WatchPad.WatchItem>(UpdateWatchItem); WatchPad.WatchValueEdited += new Action<WatchPad.WatchItem, long>(EditWatchValue); Pads.Add(WatchPad); BreakpointsPad = new BreakpointsPad(Platform.Project); BreakpointsPad.BreakpointController = Platform.DebuggerController.BreakpointController; Pads.Add(BreakpointsPad); HardwarePad = new HardwarePad(Platform.Project); Pads.Add(HardwarePad); }
/// <summary> /// Updates the watch item value according to the watch type. /// </summary> /// <param name="item">The watch item to update.</param> /// <param name="value">The value to set.</param> private static void UpdateItemValue(WatchPad.WatchItem item, long value) { if (item.Type == "Signed") { item.Value = ((short)value).ToString(); } else { item.Value = ((ushort)value).ToString(); } }
/// <summary> /// Updates the value of the specified watch item. /// </summary> /// <param name="item">The watch item to update.</param> protected override void UpdateWatchItem(WatchPad.WatchItem item) { if (Platform.DebuggerController.State == DebuggerController.States.Suspended) { ushort address; if (!GetAddress(item.Name, out address)) { item.Value = "?"; return; } long val = Platform.DebuggerController.Debugger.Target.Memory[address]; UpdateItemValue(item, val); } else { item.Value = "?"; } }
/// <summary> /// Edits the specified watch item and the corresponding memory location /// by storing the specified value. /// </summary> /// <param name="item">The watch to edit.</param> /// <param name="value">The value to store.</param> protected override void EditWatchValue(WatchPad.WatchItem item, long value) { if (Platform.DebuggerController.State != DebuggerController.States.Suspended) return; ushort address; if (!GetAddress(item.Name, out address)) return; Platform.DebuggerController.Debugger.Target.Memory[address] = value; UpdateItemValue(item, value); }