// This is called as windows open so we only need to process the opening window. private void DoCopyBreakpointsToWindow(Boss boss) { string file = DoGetFile(boss); if (file != null) { // Another document window may be open for the same file so we need to // check those first. var bps = new List<WindowedBreakpoint>(); foreach (WindowedBreakpoint wbp in ms_windowedBreakpoints) { if (wbp.File == file && wbp.Annotation.Parent != boss && wbp.Annotation.IsValid) { bps.Add(wbp); } } if (bps.Count > 0) { foreach (WindowedBreakpoint wbp in bps) { var b = new WindowedBreakpoint(DoCreateBreakpoint(boss, file, wbp.GetLine()), file); ms_windowedBreakpoints.Add(b); } } else { foreach (Breakpoint bp in ms_savedBreakpoints) { if (bp.File == file) { var b = new WindowedBreakpoint(DoCreateBreakpoint(boss, file, bp.Line), file); ms_windowedBreakpoints.Add(b); } } } } }
// There may be multiple windows viewing the same file so we need to // iterate over all document windows. private void DoAddBreakpoints(string file, int line) { Boss boss = ObjectModel.Create("TextEditorPlugin"); Boss[] bosses = boss.Get<IWindows>().All(); foreach (Boss b in bosses) { if (DoGetFile(b) == file) { var bp = new WindowedBreakpoint(DoCreateBreakpoint(b, file, line), file); ms_windowedBreakpoints.Add(bp); Broadcaster.Invoke("added breakpoint", new Breakpoint(file, line)); } } }