Tools__BreakpointService.st
author Claus Gittinger <cg@exept.de>
Wed, 06 Jul 2011 16:08:38 +0200
changeset 10208 5f0f44bd199a
parent 10182 9ce79271722f
child 10209 49730d79f786
permissions -rw-r--r--
class definition added: #update:with:from: #updateBreakPointsFor: comment/format in: #buttonPress:x:y:in:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
10071
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
     2
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
10071
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
     5
Permission is hereby granted, free of charge, to any person
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
     6
obtaining a copy of this software and associated documentation
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
     7
files (the 'Software'), to deal in the Software without
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
     8
restriction, including without limitation the rights to use,
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
     9
copy, modify, merge, publish, distribute, sublicense, and/or sell
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    10
copies of the Software, and to permit persons to whom the
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    11
Software is furnished to do so, subject to the following
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    12
conditions:
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    13
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    14
The above copyright notice and this permission notice shall be
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    15
included in all copies or substantial portions of the Software.
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    16
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    17
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    18
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    19
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    20
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    21
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    22
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    24
OTHER DEALINGS IN THE SOFTWARE.
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"{ Package: 'stx:libtool' }"
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"{ NameSpace: Tools }"
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
CodeViewService subclass:#BreakpointService
10208
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    31
	instanceVariableNames:'breakpoints currentMethod'
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
	classVariableNames:''
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
	poolDictionaries:''
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
	category:'Interface-CodeView'
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!BreakpointService class methodsFor:'documentation'!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
copyright
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
10071
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    41
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
              All Rights Reserved
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
10071
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    44
Permission is hereby granted, free of charge, to any person
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    45
obtaining a copy of this software and associated documentation
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    46
files (the 'Software'), to deal in the Software without
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    47
restriction, including without limitation the rights to use,
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    48
copy, modify, merge, publish, distribute, sublicense, and/or sell
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    49
copies of the Software, and to permit persons to whom the
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    50
Software is furnished to do so, subject to the following
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    51
conditions:
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    52
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    53
The above copyright notice and this permission notice shall be
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    54
included in all copies or substantial portions of the Software.
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    55
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    56
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    57
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    58
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    59
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    60
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    61
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    62
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1bf516aac0b8 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9982
diff changeset
    63
OTHER DEALINGS IN THE SOFTWARE.
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
"
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
! !
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
10208
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    67
!BreakpointService methodsFor:'change & update'!
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    68
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    69
update: aspect with: param from: sender
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    70
    |method|
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    71
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    72
    method := codeView methodHolder value.
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    73
    method ~~ currentMethod ifTrue:[
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    74
        self updateBreakPointsFor:method.
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    75
    ].
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    76
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    77
    super update: aspect with: param from: sender
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    78
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    79
    "Created: / 06-07-2011 / 15:21:08 / cg"
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    80
!
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    81
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    82
updateBreakPointsFor:aMethod
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    83
    |methodsBreakPoints|
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    84
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    85
    methodsBreakPoints := OrderedCollection new.
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    86
    aMethod notNil ifTrue:[
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    87
        aMethod literalsDo:[:eachLiteral |
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    88
            eachLiteral class == Breakpoint ifTrue:[
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    89
                methodsBreakPoints add:eachLiteral.
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    90
            ].
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    91
        ].
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    92
    ].
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    93
    breakpoints := methodsBreakPoints.
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    94
    currentMethod := aMethod.
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    95
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    96
    "Created: / 06-07-2011 / 15:24:09 / cg"
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    97
! !
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
    98
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
!BreakpointService methodsFor:'event handling'!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   101
buttonPress:button x:x y:y in:view 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   102
    codeView methodHolder value isNil ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   103
        ^ false
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   104
    ].
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
    view == gutterView ifTrue:[
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
        button == 1 ifTrue:[
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   107
            self setOrToggleBreakpointAtLine:(textView yVisibleToLineNr:y).
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   108
            ^ true.
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
        ].
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
        button == 3 ifTrue:[
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   111
            ^ true.
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
        ]
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    ].
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   114
    ^ false
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
    "Created: / 17-06-2011 / 13:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    "Modified: / 28-06-2011 / 08:31:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   118
    "Modified (format): / 05-07-2011 / 21:33:29 / cg"
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
! !
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!BreakpointService methodsFor:'initialization'!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
initialize
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    super initialize.
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    breakpoints := OrderedCollection new.
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    "Created: / 17-06-2011 / 13:49:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
! !
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
!BreakpointService methodsFor:'private'!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   133
breakpointAtLine:line 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   134
    |pos|
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    pos := textView characterPositionOfLine:line col:1.
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    ^ breakpoints ? #() detect:[:each | each position = pos ] ifNone:[ nil ]
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    "Modified: / 17-06-2011 / 13:59:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   140
    "Modified (format): / 05-07-2011 / 21:33:23 / cg"
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   141
!
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   142
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   143
recompile
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   144
    "recompile the current method for changed breakpoints"
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   145
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   146
    |method|
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   147
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   148
    method := codeView methodHolder value.
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   149
    (method notNil and:[method hasPrimitiveCode not]) ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   150
        "/ be careful: if the text has been edited/modified, do not compile
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   151
        textView modified ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   152
            self halt
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   153
        ] ifFalse:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   154
            "/ prepare to get reachable bpts
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   155
            breakpoints do:[:bp | bp isReached:false].
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   156
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   157
            ByteCodeCompilerWithBreakpointSupport new
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   158
                breakpoints:breakpoints;
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   159
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   160
                compile:method source
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   161
                forClass:method mclass 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   162
                inCategory:method category 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   163
                notifying:nil
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   164
                install:true 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   165
                skipIfSame:false 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   166
                silent:true 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   167
                foldConstants:true
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   168
                ifFail:[ self halt ].
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   169
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   170
            breakpoints := breakpoints select:[:bp | bp isReached]
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   171
        ]
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   172
    ]
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   173
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   174
    "Created: / 05-07-2011 / 21:33:13 / cg"
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
setOrToggleBreakpointAtLine:line 
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    |pos bpnt|
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    pos := textView characterPositionOfLine:line col:1.
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    bpnt := self breakpointAtLine:line.
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   182
    bpnt isNil ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   183
        breakpoints add:((Breakpoint new)
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   184
                    position:pos;
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   185
                    line:line).
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   186
        self recompile.
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   187
    ] ifFalse:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   188
        bpnt toggle.
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   189
    ].
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
    gutterView redrawLine:line.
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    "Created: / 17-06-2011 / 13:45:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   193
    "Modified: / 05-07-2011 / 21:32:49 / cg"
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
! !
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
!BreakpointService methodsFor:'redrawing'!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   198
drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg 
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    "Called by both gutterView and textView (well, not yet) to
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
     allow services to draw custom things on text view.
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
     Ask JV what the args means if unsure (I'm lazy to document
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
     them, now it is just an experiment...)"
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   203
    
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   204
    |bpnt icon dx dy|
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   206
    codeView methodHolder value isNil ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   207
        ^ self
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   208
    ].
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   209
    view == gutterView ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   210
        bpnt := self breakpointAtLine:lineNo.
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   211
        bpnt isNil ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   212
            ^ self
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   213
        ].
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   214
        icon := bpnt icon.
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   215
        icon isNil ifTrue:[
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   216
            ^ self
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   217
        ].
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   218
        dx := ((w - icon width) / 2) rounded.
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   219
        dy := ((h - icon height) / 2) rounded.
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   220
        icon 
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   221
            displayOn:view
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   222
            x:x + dx
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   223
            y:y - h + dy + 4. "TODO: Magic constant"
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    ].
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    "Created: / 17-06-2011 / 13:52:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10182
9ce79271722f added: #recompile
Claus Gittinger <cg@exept.de>
parents: 10071
diff changeset
   227
    "Modified (format): / 05-07-2011 / 22:14:33 / cg"
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
! !
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
!BreakpointService class methodsFor:'documentation'!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
version_CVS
10208
5f0f44bd199a class definition
Claus Gittinger <cg@exept.de>
parents: 10182
diff changeset
   233
    ^ '$Header: /cvs/stx/stx/libtool/Tools__BreakpointService.st,v 1.4 2011-07-06 14:08:38 cg Exp $'
9982
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
!
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
version_SVN
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
    ^ '§Id§'
527ab4879a77 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
! !