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 RefreshPad() { if (debuggedProcess == null || debuggedProcess.IsRunning || debuggedProcess.SelectedStackFrame == null) { localVarList.Root.Children.Clear(); return; } using (new PrintTimes("Local Variables refresh")) { try { localVarList.BeginUpdate(); Utils.DoEvents(debuggedProcess); TreeViewVarNode.SetContentRecursive(debuggedProcess, localVarList, new StackFrameNode(debuggedProcess.SelectedStackFrame).ChildNodes); } catch (AbortedBecauseDebuggeeResumedException) { } catch (Exception) { if (debuggedProcess == null || debuggedProcess.HasExited) { // Process unexpectedly exited } else { throw; } } finally { localVarList.EndUpdate(); } } }
void watchList_DragDrop(object sender, DragEventArgs e) { watchList.BeginUpdate(); TextNode text = new TextNode(e.Data.GetData(DataFormats.StringFormat).ToString()); TreeViewVarNode node = new TreeViewVarNode(this.debuggedProcess, this.watchList, text); watches.Add(text); watchList.Root.Children.Add(node); watchList.EndUpdate(); node.IsSelected = true; this.RefreshPad(); }
void watchList_DoubleClick(object sender, MouseEventArgs e) { if (watchList.SelectedNode == null) { watchList.BeginUpdate(); TextNode text = new TextNode(""); TreeViewVarNode node = new TreeViewVarNode(this.debuggedProcess, this.watchList, text); watches.Add(text); watchList.Root.Children.Add(node); watchList.EndUpdate(); node.IsSelected = true; this.RefreshPad(); foreach (NodeControlInfo nfo in watchList.GetNodeControls(node)) { if (nfo.Control is WatchItemName) { ((EditableControl)nfo.Control).MouseUp(new TreeNodeAdvMouseEventArgs(e)); } } } }
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(); } }