public void Execute(int line) { if (DebugInformation.CodeMappings != null && DebugInformation.CodeMappings.Count > 0) { // check if the codemappings exists for this line var storage = DebugInformation.CodeMappings; int token = 0; foreach (var key in storage.Keys) { var instruction = storage[key].GetInstructionByLineNumber(line, out token); if (instruction == null) { continue; } // no bookmark on the line: create a new breakpoint DebuggerService.ToggleBreakpointAt( instruction.MemberMapping.MemberReference, line, token, instruction.ILInstructionOffset, DebugInformation.Language); break; } if (token == 0) { MessageBox.Show(string.Format("Missing code mappings at line {0}.", line), "Code mappings", MessageBoxButton.OK, MessageBoxImage.Information); return; } } }
public override void Run() { var viewContent = WorkbenchSingleton.Workbench.ActiveContent; ITextEditorProvider provider = viewContent as ITextEditorProvider; ITextEditor editor = null; if (provider != null) { editor = provider.TextEditor; if (!string.IsNullOrEmpty(editor.FileName)) { DebuggerService.ToggleBreakpointAt(editor, editor.Caret.Line, typeof(BreakpointBookmark)); } } else { var view = viewContent as AbstractViewContentWithoutFile; if (view != null) { editor = view.GetService(typeof(ITextEditor)) as ITextEditor; if (editor != null) { DebuggerService.ToggleBreakpointAt(editor, editor.Caret.Line, typeof(DecompiledBreakpointBookmark)); } } } }
public override void Run() { IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; if (window == null || !(window.ViewContent is ITextEditorControlProvider)) { return; } TextEditorControl textEditor = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl; DebuggerService.ToggleBreakpointAt(textEditor.Document, textEditor.FileName, textEditor.ActiveTextAreaControl.Caret.Line); }
protected override void OnMouseUp(MouseButtonEventArgs e) { base.OnMouseUp(e); int line = GetLineFromMousePosition(e); if (!e.Handled && dragDropBookmark != null) { if (dragStarted) { if (line != 0) { dragDropBookmark.Drop(line); } e.Handled = true; } CancelDragDrop(); } if (!e.Handled && line != 0) { IBookmark bm = GetBookmarkFromLine(line); if (bm != null) { bm.MouseUp(e); if (e.Handled) { return; } } if (e.ChangedButton == MouseButton.Left && TextView != null) { // no bookmark on the line: create a new breakpoint ITextEditor textEditor = TextView.Services.GetService(typeof(ITextEditor)) as ITextEditor; if (textEditor != null) { DebuggerService.ToggleBreakpointAt(textEditor, line, typeof(BreakpointBookmark)); return; } // create breakpoint for the other posible active contents var viewContent = WorkbenchSingleton.Workbench.ActiveContent as AbstractViewContentWithoutFile; if (viewContent != null) { textEditor = viewContent.Services.GetService(typeof(ITextEditor)) as ITextEditor; if (textEditor != null) { DebuggerService.ToggleBreakpointAt(textEditor, line, typeof(DecompiledBreakpointBookmark)); return; } } } } }
public override void Run() { ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveContent as ITextEditorProvider; if (provider != null) { ITextEditor editor = provider.TextEditor; if (!string.IsNullOrEmpty(editor.FileName)) { DebuggerService.ToggleBreakpointAt(editor, editor.Caret.Line); } } }
public override void Run() { ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveContent as ITextEditorControlProvider; if (provider != null) { TextEditorControl textEditor = provider.TextEditorControl; if (!string.IsNullOrEmpty(textEditor.FileName)) { DebuggerService.ToggleBreakpointAt(textEditor.Document, textEditor.FileName, textEditor.ActiveTextAreaControl.Caret.Line); } } }
/// <summary> /// Recreates breakpoints after change of source code. /// </summary> private void updateBreakpoints() { BreakpointBookmark[] markers = new BreakpointBookmark[DebuggerService.Breakpoints.Count]; DebuggerService.Breakpoints.CopyTo(markers, 0); foreach (BreakpointBookmark item in markers) { ITextEditor editor = findEditor(item); if (editor != null) { DebuggerService.ToggleBreakpointAt(editor, item.LineNumber, typeof(BreakpointBookmark)); DebuggerService.ToggleBreakpointAt(editor, item.LineNumber, typeof(BreakpointBookmark)); } } }
protected override void OnMouseUp(MouseButtonEventArgs e) { base.OnMouseUp(e); int line = GetLineFromMousePosition(e); if (!e.Handled && dragDropBookmark != null) { if (dragStarted) { if (line != 0) { dragDropBookmark.Drop(line); } e.Handled = true; } CancelDragDrop(); } if (!e.Handled && line != 0) { BookmarkBase bm = GetBookmarkFromLine(line); if (bm != null) { bm.MouseUp(e); if (bm.CanToggle) { BookmarkManager.RemoveMark(bm); InvalidateVisual(); } if (e.Handled) { return; } } if (e.ChangedButton == MouseButton.Left) { if (DebugData.CodeMappings != null && DebugData.CodeMappings.Count > 0) { // check if the codemappings exists for this line var storage = DebugData.CodeMappings; int token = 0; foreach (var key in storage.Keys) { var instruction = storage[key].GetInstructionByLineNumber(line, out token); if (instruction == null) { continue; } // no bookmark on the line: create a new breakpoint DebuggerService.ToggleBreakpointAt( DebugData.DecompiledMemberReferences[key], line, instruction.ILInstructionOffset, DebugData.Language); break; } if (token == 0) { MessageBox.Show(string.Format("Missing code mappings at line {0}.", line), "Code mappings", MessageBoxButton.OK, MessageBoxImage.Information); return; } } } InvalidateVisual(); } }