class: Tools::BreakpointService
authorClaus Gittinger <cg@exept.de>
Thu, 20 Jun 2013 19:00:16 +0200
changeset 12940 7ef425531618
parent 12939 78a465c907cd
child 12941 9605021cbfb8
class: Tools::BreakpointService changed: #setOrToggleBreakpointAtLine:
Tools__BreakpointService.st
--- a/Tools__BreakpointService.st	Thu Jun 20 18:22:10 2013 +0200
+++ b/Tools__BreakpointService.st	Thu Jun 20 19:00:16 2013 +0200
@@ -276,7 +276,9 @@
 !
 
 setOrToggleBreakpointAtLine:line
-    |pos bpnt|
+    |pos bpnt prepareFullBreakSupport|
+
+    prepareFullBreakSupport := true.
 
     textView reallyModified ifTrue:[
         "/ leads to ugly behavior (method no longer found), if we allow
@@ -288,8 +290,28 @@
     pos := textView characterPositionOfLine:line col:1.
     bpnt := self breakpointAtLine:line.
     bpnt isNil ifTrue:[
+        "/ no breakpoint there - add as required
         (self canCreateOrToggleBreakpointAtLine:line) ifTrue:[
-            breakpoints add:((bpnt := Breakpoint new) position:pos line:line).
+            prepareFullBreakSupport ifTrue:[
+                "/ add a (disabled) breakpoint for every source line. This
+                "/ allows for breakpoints to be enabled/disabled in the debugger...
+                1 to:textView numberOfLines do:[:eachLine |
+                    |oldBPnt eachPos otherBpnt|
+
+                    oldBPnt := self breakpointAtLine:eachLine.
+                    oldBPnt isNil ifTrue:[
+                        eachPos := textView characterPositionOfLine:eachLine col:1.
+                        breakpoints add:((otherBpnt := Breakpoint new) position:eachPos line:eachLine).
+                        eachLine == line ifTrue:[
+                            bpnt := otherBpnt.
+                        ] ifFalse:[
+                            otherBpnt beInvisible.
+                        ]
+                    ].
+                ].
+            ] ifFalse:[
+                breakpoints add:((bpnt := Breakpoint new) position:pos line:line).
+            ].
             Display shiftDown ifTrue:[
                 "/ trace
                 bpnt beTracepoint
@@ -303,6 +325,7 @@
             ].
         ]
     ] ifFalse:[
+        "/ breakpoint already there - just enable/disable
         Display shiftDown ifTrue:[
             bpnt toggleTracing
         ] ifFalse:[
@@ -394,11 +417,11 @@
 !BreakpointService class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.21 2013-06-14 13:17:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.22 2013-06-20 17:00:16 cg Exp $'
 
 !
 
 version_SVN
-    ^ '$Id: Tools__BreakpointService.st,v 1.21 2013-06-14 13:17:53 cg Exp $'
+    ^ '$Id: Tools__BreakpointService.st,v 1.22 2013-06-20 17:00:16 cg Exp $'
 ! !