--- a/Tools__BreakpointService.st Tue Jul 23 20:55:42 2013 +0100
+++ b/Tools__BreakpointService.st Wed Jul 24 11:15:26 2013 +0100
@@ -72,6 +72,17 @@
^ 'Breakpoints'
! !
+!BreakpointService class methodsFor:'testing'!
+
+isUsefulFor:aCodeView
+ "this filters useful services.
+ Redefined to return true for myself - not for subclasses"
+
+ ^ self == Tools::BreakpointService
+
+ "Created: / 22-07-2013 / 14:01:17 / cg"
+! !
+
!BreakpointService methodsFor:'accessing'!
breakpoints
@@ -123,7 +134,7 @@
"/ codeView methodHolder class == BlockValue ifTrue:[self breakPoint:#cg].
- method := realMethod := codeView methodHolder value.
+ method := realMethod := codeView method.
(method notNil and:[method mclass isNil]) ifTrue:[
"/ hack: ouch - was wrapped in the meantime;
"/ hurry up and update. Should be done elsewhere (in codeView)
@@ -140,6 +151,8 @@
gutterView invalidate.
]
].
+
+ "Modified: / 22-07-2013 / 13:33:28 / cg"
! !
!BreakpointService methodsFor:'event handling'!
@@ -218,7 +231,13 @@
breakpoints isNil ifTrue:[^ nil].
pos := textView characterPositionOfLine:line col:1.
- ^ breakpoints detect:[:each | each position = pos ] ifNone:[ nil ]
+ ^ breakpoints
+ detect:[:each | each position = pos ]
+ ifNone:[
+ breakpoints
+ detect:[:each | each line == line and:[each position isNil ]]
+ ifNone:[ nil ]
+ ]
"Modified: / 17-06-2011 / 13:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified (format): / 05-07-2011 / 21:33:23 / cg"
@@ -244,9 +263,9 @@
recompile
"recompile the current method for changed breakpoints"
- |oldMethod newMethod compiler class selector|
+ |oldMethod newMethod compilerClass compiler class selector|
- oldMethod := codeView methodHolder value.
+ oldMethod := codeView method.
(oldMethod notNil and:[oldMethod hasPrimitiveCode not]) ifTrue:[
"/ be careful: if the text has been edited/modified, do not compile
textView modified ifTrue:[
@@ -269,9 +288,18 @@
selector := oldMethod selector.
Class withoutUpdatingChangesDo:[
- compiler := ByteCodeCompilerWithBreakpointSupport new.
+ "/ compilerClass := ByteCodeCompilerWithBreakpointSupport.
+ compilerClass := oldMethod programmingLanguage compilerWithBreakpointSupportClass.
+ compilerClass isNil ifTrue:[
+ Dialog warn:'No breakpoint support for this programming language'.
+ ^ self.
+ ].
+ compiler := compilerClass new.
compiler breakpoints:breakpoints.
- compiler methodClass:MethodWithBreakpoints.
+"/ not needed - new compilers already know it
+"/ compiler methodClass:(oldMethod programmingLanguage isSTXJavaScript
+"/ ifTrue:[JavaScriptFunctionWithBreakpoints]
+"/ ifFalse:[MethodWithBreakpoints]).
newMethod := compiler
compile:oldMethod source
forClass:class
@@ -330,7 +358,7 @@
"Created: / 05-07-2011 / 21:33:13 / cg"
"Modified: / 18-07-2012 / 10:53:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-08-2012 / 09:35:41 / cg"
+ "Modified: / 22-07-2013 / 16:00:13 / cg"
!
setOrToggleBreakpointAtLine:line
@@ -346,7 +374,7 @@
"/ prepareFullBreakSupport := false.
prepareFullBreakSupport := true.
- codeView methodHolder value isNil ifTrue:[
+ codeView method isNil ifTrue:[
^ self
].
@@ -418,7 +446,7 @@
"Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 27-07-2011 / 13:27:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 02-08-2012 / 09:26:38 / cg"
+ "Modified: / 22-07-2013 / 13:33:18 / cg"
! !
!BreakpointService methodsFor:'queries'!
@@ -464,15 +492,19 @@
|mthd bpnt icon dx dy|
- (mthd := codeView methodHolder value) isNil ifTrue:[
- ^ self
- ].
- currentMethodClass isNil ifTrue:[
- "/ hack: ouch - was wrapped in the meantime;
- ^ self. "/ wait for the real update
- "/ hurry up and update. Should be done elsewhere (in codeView)
- "/ self updateCurrentMethod.
- ].
+"/ these tests make the breakpointService unusable for other applications (which are mote
+"/ based on smalltalk methods. They are not really needed: if there is a breakpoint,
+"/ I can show it. Period.
+
+"/ (mthd := codeView methodHolder value) isNil ifTrue:[
+"/ ^ self
+"/ ].
+"/ currentMethodClass isNil ifTrue:[
+"/ "/ hack: ouch - was wrapped in the meantime;
+"/ ^ self. "/ wait for the real update
+"/ "/ hurry up and update. Should be done elsewhere (in codeView)
+"/ "/ self updateCurrentMethod.
+"/ ].
view == gutterView ifTrue:[
bpnt := self breakpointAtLine:lineNo.
@@ -504,14 +536,14 @@
!BreakpointService class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.31 2013-07-12 05:50:20 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.35 2013-07-22 14:00:21 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.31 2013-07-12 05:50:20 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.35 2013-07-22 14:00:21 cg Exp $'
!
version_SVN
- ^ '$Id: Tools__BreakpointService.st,v 1.31 2013-07-12 05:50:20 cg Exp $'
+ ^ '$Id: Tools__BreakpointService.st,v 1.35 2013-07-22 14:00:21 cg Exp $'
! !