Tools__CodeHighlightingService.st
author vrany
Wed, 03 Aug 2011 01:33:41 +0200
changeset 10434 f3f696075c22
parent 10420 ed96d3da2be7
child 10438 bd3f0c062ac3
permissions -rw-r--r--
Fix after moving BackgroundJob from libtool to libbasic2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
10077
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
     2
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
     3
              All Rights Reserved
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
10077
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
     5
Permission is hereby granted, free of charge, to any person
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
     6
obtaining a copy of this software and associated documentation
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
     7
files (the 'Software'), to deal in the Software without
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
     8
restriction, including without limitation the rights to use,
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
     9
copy, modify, merge, publish, distribute, sublicense, and/or sell
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    10
copies of the Software, and to permit persons to whom the
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    11
Software is furnished to do so, subject to the following
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    12
conditions:
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    13
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    14
The above copyright notice and this permission notice shall be
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    15
included in all copies or substantial portions of the Software.
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    16
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    17
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    18
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    19
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    20
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    21
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    22
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    23
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    24
OTHER DEALINGS IN THE SOFTWARE.
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"{ Package: 'stx:libtool' }"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
"{ NameSpace: Tools }"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
CodeViewService subclass:#CodeHighlightingService
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
    31
	instanceVariableNames:'job done'
10275
1151182dcaae changed: #startSyntaxHighlightProcess
Claus Gittinger <cg@exept.de>
parents: 10272
diff changeset
    32
	classVariableNames:''
1151182dcaae changed: #startSyntaxHighlightProcess
Claus Gittinger <cg@exept.de>
parents: 10272
diff changeset
    33
	poolDictionaries:''
1151182dcaae changed: #startSyntaxHighlightProcess
Claus Gittinger <cg@exept.de>
parents: 10272
diff changeset
    34
	category:'Interface-CodeView'
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
!CodeHighlightingService class methodsFor:'documentation'!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
copyright
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
10077
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    41
 COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    42
              All Rights Reserved
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    43
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    44
Permission is hereby granted, free of charge, to any person
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    45
obtaining a copy of this software and associated documentation
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    46
files (the 'Software'), to deal in the Software without
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    47
restriction, including without limitation the rights to use,
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    48
copy, modify, merge, publish, distribute, sublicense, and/or sell
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    49
copies of the Software, and to permit persons to whom the
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    50
Software is furnished to do so, subject to the following
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    51
conditions:
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
10077
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    53
The above copyright notice and this permission notice shall be
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    54
included in all copies or substantial portions of the Software.
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    55
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    56
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    57
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    58
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    59
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    60
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    61
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    62
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
d2b07a20c425 changed: #copyright
Claus Gittinger <cg@exept.de>
parents: 9980
diff changeset
    63
OTHER DEALINGS IN THE SOFTWARE.
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
! !
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
!CodeHighlightingService class methodsFor:'accessing'!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
label
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    "Answers short label - for UI"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    ^'Syntax Highlighting'
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    "Created: / 07-03-2010 / 14:00:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
! !
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
!CodeHighlightingService methodsFor:'change & update'!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
update: aspect with: param from: sender
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
    82
    sender == textView modifiedChannel ifTrue:[^self codeChanged: false].
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
    83
    sender == textView model ifTrue:[^self codeChanged: true].
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    sender == codeView languageHolder ifTrue:[^self codeChanged: true].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    sender == codeView classHolder ifTrue:[^self codeChanged: true].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    super update: aspect with: param from: sender
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    "Created: / 06-03-2010 / 19:38:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
    90
    "Modified: / 05-07-2011 / 10:18:08 / cg"
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
! !
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
    93
!CodeHighlightingService methodsFor:'initialization'!
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
    94
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
    95
initialize
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
    96
10434
f3f696075c22 Fix after moving BackgroundJob from libtool to libbasic2
vrany
parents: 10420
diff changeset
    97
    job := (Smalltalk at:#BackgroundJob)
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
    98
            named: 'Syntax Highlighting Job' 
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
    99
            on:[self syntaxHighlight: true].
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   100
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   101
    "Created: / 29-07-2011 / 10:31:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   102
! !
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   103
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
!CodeHighlightingService methodsFor:'private'!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
codeChanged: force
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    (force or:[codeView textView modified]) ifTrue:
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   109
        [self syntaxHighlight].
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   111
    "Modified: / 29-07-2011 / 11:07:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
setHighlightedCode:newCode elements: elements
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    "the background synhighlighter has generated new colored text,
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
     with highlighted syntax.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
     If there have been no modifications in the meantime, install it."
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   119
    |firstShown lastShown cursorWasOn anyChange newLines l replaceAction list|
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   121
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    textView modified ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
        "/ new input arrived in the meantime
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
        ^ self
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    ].
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   127
    done  ifFalse:[
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
        "/ another coloring process has already been started.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
        "/ ignore this (leftover) code.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
        ^ self
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    ].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    firstShown := textView firstLineShown.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    lastShown := textView lastLineShown.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    replaceAction := [:lNr :line |
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
            |oldLine|
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
            oldLine := list at:lNr ifAbsent:nil.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
            oldLine notNil ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
                line notNil ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
                    "/ this check is needed - there is a race
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
                    "/ when the text is converted. This detects the
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
                    "/ resulting error.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
                    "/ Certainly a kludge.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
                    oldLine string = line string ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
                        oldLine emphasis ~= line emphasis ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
                            textView modifiedChannel removeDependent:self.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
                            list at:lNr put:line.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
                            textView modifiedChannel addDependent:self.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
                            (lNr between:firstShown and:lastShown) ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
                                anyChange ifFalse:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
                                    anyChange := true.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
                                    cursorWasOn := textView hideCursor
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
                                ].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
                                textView redrawLine:lNr
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
                            ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
                        ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
                    ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
                ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
            ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
        ].
10234
7cdbded1e728 comment/format in: #setHighlightedCode:elements:
Claus Gittinger <cg@exept.de>
parents: 10151
diff changeset
   162
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    anyChange := false.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    newLines := newCode asStringCollection.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    list := textView list.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    list isNil ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
        textView list:newLines.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    ] ifFalse:[
10234
7cdbded1e728 comment/format in: #setHighlightedCode:elements:
Claus Gittinger <cg@exept.de>
parents: 10151
diff changeset
   169
        "/ the cursor line first - that's where your eyes are ...
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
        (l := textView cursorLine) notNil ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
            l <= newLines size ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
                replaceAction value:l value:(newLines at:l)
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
            ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
        ].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
        newLines keysAndValuesDo:replaceAction.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
        anyChange ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
            cursorWasOn ifTrue:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
                textView showCursor
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
            ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
        ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    ].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    codeView syntaxElements: elements
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    "Modified: / 09-10-2006 / 11:50:17 / cg"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    "Created: / 14-02-2010 / 16:10:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10234
7cdbded1e728 comment/format in: #setHighlightedCode:elements:
Claus Gittinger <cg@exept.de>
parents: 10151
diff changeset
   186
    "Modified (format): / 06-07-2011 / 18:21:12 / cg"
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   187
    "Modified: / 29-07-2011 / 11:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
showInfo: aString
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
    codeView showInfo: aString
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
    "Created: / 06-03-2010 / 19:34:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   197
syntaxHighlight
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   199
    |highlighterClass prio |
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    highlighterClass := self syntaxHighlighterClass.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   203
    highlighterClass isNil ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   204
        "No higlighter, nothing to do"
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   205
        ^self
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   206
    ].
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
    "/ this clobbers the codeViews modified state; therefore, we have to remember
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
    "/ this info somewhere ...
10244
9dac22861b94 Attempt to fix the accept/cancel bar - no success.
vrany
parents: 10234
diff changeset
   210
    codeView browser ifNotNil:[
9dac22861b94 Attempt to fix the accept/cancel bar - no success.
vrany
parents: 10234
diff changeset
   211
        textView modified ifTrue:[
9dac22861b94 Attempt to fix the accept/cancel bar - no success.
vrany
parents: 10234
diff changeset
   212
            codeView browser navigationState realModifiedState: true
9dac22861b94 Attempt to fix the accept/cancel bar - no success.
vrany
parents: 10234
diff changeset
   213
        ].
9dac22861b94 Attempt to fix the accept/cancel bar - no success.
vrany
parents: 10234
diff changeset
   214
        textView modifiedChannel setValue:false.
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    ].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   217
    job scheduled ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   218
        job running ifFalse:[
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
            "/ process already created, but did not get a change to start yet;
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
            ^ self
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   221
        ] ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   222
            job stop.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   223
        ]
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    ].
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    prio := Processor userBackgroundPriority - 1.
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    textView shown ifFalse:[
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
        prio := prio - 1 max:1
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    ].
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   229
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   230
    job startWithPriority: prio.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   231
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   232
    "Modified: / 07-07-2011 / 12:26:12 / Jan Vrany <jan.vrant@fit.cvut,cz>"
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   233
    "Modified: / 20-07-2011 / 15:14:14 / cg"
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   234
    "Created: / 29-07-2011 / 11:07:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   235
!
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   236
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   237
syntaxHighlight: delayed
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   238
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   239
    |oldCode oldCodeList newCode elements cls mthd highlighterClass|
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   240
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   241
    done := false.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   242
    codeView syntaxElements: nil.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   243
    codeView syntaxElementSelection: nil.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   244
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   245
    highlighterClass := self syntaxHighlighterClass.
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   246
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   247
    cls := codeView klass.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   248
    (cls notNil and:[cls isObsolete]) ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   249
        cls isMeta ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   250
            cls := (Smalltalk at:cls theNonMetaclass name) class
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   251
        ] ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   252
            cls := Smalltalk at:cls name
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   253
        ].
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   254
    ].
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   255
    mthd := codeView methodHolder value.
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   256
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   257
    textView modified ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   258
        oldCodeList := textView list copy.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   259
        textView modified ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   260
            oldCodeList isNil ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   261
                oldCode := oldCodeList asStringWithoutEmphasis.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   262
                textView modified ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   263
                    Screen currentScreenQuerySignal answer:codeView device
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   264
                    do:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   265
                        Parser::ParseError handle:[:ex |
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   266
                            |errMsg|
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   268
                            errMsg := ex description asStringCollection first asString.
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   270
                            "/ Transcript topView raiseDeiconified.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   271
                            "/ Transcript showCR:'ParseError: ', ex description.
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
"/ self halt.
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   273
                            "/ self showInfo:(errMsg colorizeAllWith:Color red).
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   274
                            newCode := nil.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   275
                        ] do:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   276
                            elements := SortedCollection new.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   277
                            codeView codeAspect == #method ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   278
                                newCode := highlighterClass formatMethod:mthd source:oldCode in:cls using: nil elementsInto: elements.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   279
                            ] ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   280
                                codeView codeAspect == #expression ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   281
                                    newCode := highlighterClass formatExpression:oldCode in:cls elementsInto: elements.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   282
                                ] ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   283
                                    codeView codeAspect == #classDefinition ifTrue:[                                            
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   284
                                        newCode := highlighterClass formatClassDefinition:oldCode in:cls elementsInto: elements.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   285
                                    ]
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   286
                                ].
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   287
                            ].
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   288
                        ]
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   289
                    ].
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   290
                    newCode notNil ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   291
                        textView modified ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   292
                            newCode ~= oldCodeList ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   293
                                newCode := newCode asStringCollection.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   294
                                textView modified ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   295
                                    done := true.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   296
                                    textView notNil ifTrue:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   297
                                        "/ must add this event - and not been interrupted
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   298
                                        "/ by any arriving key-event.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   299
                                        "/ self showInfo:nil.
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   300
                                        delayed ifTrue:[                                                
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   301
                                            codeView sensor
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   302
                                                pushUserEvent:#setHighlightedCode:elements:
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   303
                                                for:self
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   304
                                                withArguments:(Array with:newCode with: elements).
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   305
                                                "/self delayedUpdateBufferLabelWithCheckIfModified
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   306
                                        ] ifFalse:[
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   307
                                            textView contents: newCode.
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
                                        ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
                                    ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
                                ]
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   311
                            ].
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
                        ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
                    ]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
                ]
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   315
            ]
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   316
        ]
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   317
    ]
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   319
    "Created: / 29-07-2011 / 11:01:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
syntaxHighlighterClass
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   323
    | lang cls mthd |
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
    cls := (lang := codeView languageHolder value)
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
                ifNil:[nil]
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
                ifNotNil:[lang syntaxHighlighterClass].
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   328
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
    "Ugly hack because I don't want to branch libcomp :-)"
10149
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   330
    cls == SyntaxHighlighter ifTrue:[
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   331
        "/ hack
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   332
        mthd := codeView methodHolder value.
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   333
        "/ what about method-language ?
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   334
        (mthd notNil and:[codeView browserHolder value notNil]) ifTrue:[
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   335
            cls := codeView browserHolder value syntaxHighlighterForMethod:mthd.
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   336
        ].
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   337
        cls == SyntaxHighlighter ifTrue:[
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   338
            cls := SyntaxHighlighter2
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   339
        ]
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   340
    ].
d390c010293f changed:
Claus Gittinger <cg@exept.de>
parents: 10077
diff changeset
   341
    ^ cls
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
    "Created: / 14-02-2010 / 12:39:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
    "Modified: / 06-03-2010 / 19:39:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
10151
8d04d7db6448 comment/format in: #startSyntaxHighlightProcess
Claus Gittinger <cg@exept.de>
parents: 10149
diff changeset
   345
    "Modified: / 05-07-2011 / 11:10:11 / cg"
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
! !
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
10410
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   348
!CodeHighlightingService methodsFor:'registering'!
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   349
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   350
registerIn: aCodeView
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   351
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   352
    super registerIn: aCodeView.
10420
ed96d3da2be7 - CodeHighlightingService refactored to use
vrany
parents: 10410
diff changeset
   353
    self syntaxHighlight.
10410
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   354
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   355
    "Created: / 27-07-2011 / 13:25:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   356
! !
0d8eaf28b7a9 Fixes for debugger
vrany
parents: 10353
diff changeset
   357
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
!CodeHighlightingService class methodsFor:'documentation'!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
version_CVS
10434
f3f696075c22 Fix after moving BackgroundJob from libtool to libbasic2
vrany
parents: 10420
diff changeset
   361
    ^ '$Header: /cvs/stx/stx/libtool/Tools__CodeHighlightingService.st,v 1.12 2011-08-02 23:33:41 vrany Exp $'
9980
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
!
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
version_SVN
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    ^ '§Id: Tools__CodeHighlightingService.st 7715 2011-04-10 16:32:58Z vranyj1 §'
cf0d7a8b54e9 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
! !