diff -r f1815719ba75 -r 3f8f012f121b Tools__BreakpointService.st --- a/Tools__BreakpointService.st Fri Aug 30 23:43:33 2013 +0200 +++ b/Tools__BreakpointService.st Sat Aug 31 00:54:49 2013 +0200 @@ -204,7 +204,7 @@ self hasBreakpoints ifFalse:[ ^ 'Sorry - cannot add breakpoint in the debugger (would need recompilation)\(can only add breakpoints if stopped at a method breakpoint)' withCRs ]. - ^ 'Click to toggle existing breakpoint. Shift-Click to toggle tracepoint.\Sorry - cannot add new breakpoint if method is already entered\(i.e. if not stopped at a method breakpoint).' withCRs + ^ 'Sorry - cannot add new breakpoint if method is already entered\(i.e. if not stopped at a breakpoint).' withCRs ]. ^ 'Cannot add breakpoint when modified. Please accept first.' ]. @@ -434,6 +434,8 @@ bpnt beTracepoint ]. self assert: breakpoints notEmptyOrNil. + + "/ recompile the method with breakpoints self recompile. ] ] ifFalse:[ @@ -447,7 +449,7 @@ "/ hack: ouch - was wrapped in the meantime; "/ hurry up and update. Should be done elsewhere (in codeView) self updateCurrentMethod. - mClass := currentMethod mclass. + currentMethod notNil ifTrue:[ mClass := currentMethod mclass ]. ]. mClass notNil ifTrue:[ Smalltalk changed:#methodTrap with:(MethodTrapChangeNotificationParameter changeClass:mClass changeSelector:currentMethod selector). @@ -464,19 +466,37 @@ !BreakpointService methodsFor:'queries'! canCreateOrToggleBreakpointAtLine:lineOrNilForAnywhere + "is it possible to place a breakpoint here and now?" + |bpnt topView| textView reallyModified ifTrue:[ + "/ this is not really true - we could keep track of where the breakpoints + "/ are while editing and shift them as required. + "/ (another idea worth a try would be + "/ to match the original parsetree (enumerating nodes with the breakpoints) + "/ against the new parsetree (walking in sync?) when finally compiling, + "/ and placing new breakpoints on matching tree nodes. + "/ (too much work, for a quick solution, I guess) ^ false ]. + "/ can always toggle existing breakpoints... lineOrNilForAnywhere notNil ifTrue:[ bpnt := self breakpointAtLine:lineOrNilForAnywhere. bpnt notNil ifTrue:[ ^ true. ] + ] ifFalse:[ + (currentMethod notNil and:[currentMethod isMethodWithBreakpoints]) ifTrue:[ + ^ true. + ] ]. + "/ ok, the method has no breakpoints yet. + + "/ this is a bad hack - looking into the debugger's state here. + "/ I guess, we have to move code around a bit... ((topView := codeView topView) class == DebugView) ifTrue:[ "/ can only create new breakpoints in the debugger, "/ iff we are in a wrapped method's prolog @@ -485,8 +505,15 @@ ^ true ]. ]. + + "/ well, if the debugger's code has already been modified, + "/ we will accept the new code anyway. So there's no problem in adding + "/ a breakpoint on the fly... + topView showingAlreadyModifiedCode ifTrue:[^ true]. ^ false. ]. + + "/ in a non-debugger, we can do it. ^ true. ! @@ -548,14 +575,14 @@ !BreakpointService class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.38 2013-08-28 14:50:12 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.39 2013-08-30 22:54:49 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.38 2013-08-28 14:50:12 cg Exp $' + ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.39 2013-08-30 22:54:49 cg Exp $' ! version_SVN - ^ '$Id: Tools__BreakpointService.st,v 1.38 2013-08-28 14:50:12 cg Exp $' + ^ '$Id: Tools__BreakpointService.st,v 1.39 2013-08-30 22:54:49 cg Exp $' ! !