author | Claus Gittinger <cg@exept.de> |
Fri, 23 Jan 2015 13:54:20 +0100 | |
changeset 15103 | bf2b44843c24 |
parent 15102 | 158d59b3ca69 |
child 15293 | 6d8bbfd2f7e1 |
permissions | -rw-r--r-- |
10484 | 1 |
" |
2 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
Permission is hereby granted, free of charge, to any person |
|
6 |
obtaining a copy of this software and associated documentation |
|
7 |
files (the 'Software'), to deal in the Software without |
|
8 |
restriction, including without limitation the rights to use, |
|
9 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
10 |
copies of the Software, and to permit persons to whom the |
|
11 |
Software is furnished to do so, subject to the following |
|
12 |
conditions: |
|
13 |
||
14 |
The above copyright notice and this permission notice shall be |
|
15 |
included in all copies or substantial portions of the Software. |
|
16 |
||
17 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
18 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
19 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
20 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
21 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
22 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
23 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
24 |
OTHER DEALINGS IN THE SOFTWARE. |
|
25 |
" |
|
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
CodeViewService subclass:#LintService |
|
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
31 |
instanceVariableNames:'ruleHolderFromApp highlighter annotations |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
32 |
annotationsSequenceNumber' |
11416
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
33 |
classVariableNames:'' |
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
34 |
poolDictionaries:'' |
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
35 |
category:'Interface-Lint' |
10484 | 36 |
! |
37 |
||
38 |
!LintService class methodsFor:'documentation'! |
|
39 |
||
40 |
copyright |
|
41 |
" |
|
42 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
|
43 |
All Rights Reserved |
|
44 |
||
45 |
Permission is hereby granted, free of charge, to any person |
|
46 |
obtaining a copy of this software and associated documentation |
|
47 |
files (the 'Software'), to deal in the Software without |
|
48 |
restriction, including without limitation the rights to use, |
|
49 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
50 |
copies of the Software, and to permit persons to whom the |
|
51 |
Software is furnished to do so, subject to the following |
|
52 |
conditions: |
|
53 |
||
54 |
The above copyright notice and this permission notice shall be |
|
55 |
included in all copies or substantial portions of the Software. |
|
56 |
||
57 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
58 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
59 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
60 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
61 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
62 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
63 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
64 |
OTHER DEALINGS IN THE SOFTWARE. |
|
65 |
" |
|
66 |
! ! |
|
67 |
||
68 |
!LintService class methodsFor:'accessing'! |
|
69 |
||
70 |
label |
|
13099 | 71 |
"Answers a short label - for UI" |
10484 | 72 |
|
73 |
^'SmallLint Checker' |
|
74 |
||
75 |
"Created: / 05-08-2011 / 11:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
76 |
! ! |
|
77 |
||
13202 | 78 |
!LintService class methodsFor:'testing'! |
79 |
||
80 |
isUsefulFor:aCodeView |
|
81 |
"this filters useful services. |
|
82 |
Redefined to return true for myself - not for subclasses" |
|
83 |
||
84 |
^ self == Tools::LintService |
|
85 |
||
86 |
"Created: / 22-07-2013 / 14:01:38 / cg" |
|
87 |
! ! |
|
88 |
||
10484 | 89 |
!LintService methodsFor:'accessing'! |
90 |
||
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
91 |
annotationAtLine: lineNo |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
92 |
| anns | |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
93 |
|
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
94 |
(anns := self annotations) notNil ifTrue:[ |
15076 | 95 |
^ anns detect:[:annotation | annotation line = lineNo] ifNone:[nil] |
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
96 |
]. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
97 |
^ nil |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
98 |
|
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
99 |
"Created: / 30-01-2012 / 21:06:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
100 |
"Modified: / 15-12-2014 / 15:40:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
101 |
! |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
102 |
|
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
103 |
annotations |
15076 | 104 |
#fixme. "/ code duplication with SmalltalkLintService >> annotations |
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
105 |
(highlighter notNil and:[ highlighter sequenceNumber ~~ annotationsSequenceNumber ]) ifTrue:[ |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
106 |
| rulesToIntervalsMap annotationsPerLineMap | |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
107 |
|
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
108 |
rulesToIntervalsMap := highlighter rulesToIntervalsMap. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
109 |
rulesToIntervalsMap notNil ifTrue:[ |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
110 |
annotationsPerLineMap := Dictionary new. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
111 |
rulesToIntervalsMap keysAndValuesDo:[ :rule :intervals | |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
112 |
intervals do:[:interval | |
15076 | 113 |
| line annotation ruleAlready| |
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
114 |
|
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
115 |
line := codeView lineOfCharacterPosition: interval first. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
116 |
annotation := annotationsPerLineMap at: line ifAbsentPut:[ LintAnnotation new line: line ]. |
15076 | 117 |
ruleAlready := annotation rule. |
118 |
ruleAlready notNil ifTrue:[ |
|
119 |
ruleAlready isComposite ifTrue: [ |
|
120 |
(ruleAlready rules includes:rule) ifFalse:[ |
|
121 |
ruleAlready addRule:rule "rules add: rule" |
|
122 |
]. |
|
123 |
] ifFalse:[ |
|
124 |
ruleAlready ~= rule ifTrue:[ |
|
125 |
annotation rule: (RBCompositeLintRule rules: (OrderedCollection with: ruleAlready with: rule)) |
|
126 |
] |
|
127 |
] |
|
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
128 |
] ifFalse:[ |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
129 |
annotation rule: rule |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
130 |
]. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
131 |
]. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
132 |
]. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
133 |
annotations := annotationsPerLineMap values sort:[ :a :b | a line < b line ]. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
134 |
annotationsSequenceNumber := highlighter sequenceNumber. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
135 |
] |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
136 |
]. |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
137 |
^annotations |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
138 |
|
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
139 |
"Created: / 15-12-2014 / 15:29:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
140 |
"Modified: / 15-12-2014 / 18:41:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
141 |
! |
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
142 |
|
10484 | 143 |
syntaxHighlighter |
144 |
| app rules | |
|
145 |
||
11382 | 146 |
app := codeView application. |
147 |
app notNil ifTrue:[ |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
148 |
rules := self ruleHolderFromApp value. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
149 |
rules notEmptyOrNil ifTrue:[ |
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
150 |
annotations := nil. |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
151 |
highlighter rules: rules. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
152 |
^ highlighter |
11382 | 153 |
]. |
10484 | 154 |
]. |
155 |
^nil |
|
156 |
||
157 |
"Created: / 05-08-2011 / 10:59:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
158 |
"Modified: / 08-03-2012 / 01:23:48 / cg" |
15030
c8d7085ee271
LintHighlighter/.LintService refactored to show multiple rules at line...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14972
diff
changeset
|
159 |
"Modified: / 15-12-2014 / 20:22:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10484 | 160 |
! ! |
161 |
||
162 |
!LintService methodsFor:'aspects'! |
|
163 |
||
164 |
ruleHolderFromApp |
|
165 |
"return/create the 'ruleHolderFromApp' value holder (automatically generated)" |
|
166 |
||
11382 | 167 |
|app| |
168 |
||
10484 | 169 |
ruleHolderFromApp isNil ifTrue:[ |
11382 | 170 |
(app := self application) notNil ifTrue:[ |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
171 |
self fetchLintRuleHolder |
11382 | 172 |
"/ ruleHolderFromApp := ValueHolder new. |
173 |
"/ ruleHolderFromApp addDependent:self. |
|
174 |
]. |
|
10484 | 175 |
]. |
176 |
^ ruleHolderFromApp |
|
11382 | 177 |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
178 |
"Modified: / 08-03-2012 / 01:17:15 / cg" |
10484 | 179 |
! |
180 |
||
181 |
ruleHolderFromApp:something |
|
182 |
"set the 'ruleHolderFromApp' value holder (automatically generated)" |
|
183 |
||
184 |
|oldValue newValue| |
|
185 |
||
186 |
ruleHolderFromApp notNil ifTrue:[ |
|
187 |
oldValue := ruleHolderFromApp value. |
|
188 |
ruleHolderFromApp removeDependent:self. |
|
189 |
]. |
|
190 |
ruleHolderFromApp := something. |
|
191 |
ruleHolderFromApp notNil ifTrue:[ |
|
192 |
ruleHolderFromApp addDependent:self. |
|
193 |
]. |
|
194 |
newValue := ruleHolderFromApp value. |
|
195 |
oldValue ~~ newValue ifTrue:[ |
|
196 |
self update:#value with:newValue from:ruleHolderFromApp. |
|
197 |
]. |
|
198 |
! ! |
|
199 |
||
200 |
!LintService methodsFor:'change & update'! |
|
201 |
||
202 |
update: aspect with: param from: sender |
|
11382 | 203 |
aspect == #sizeOfView ifFalse:[ |
204 |
sender == ruleHolderFromApp ifTrue:[ |
|
205 |
self syntaxHighlight: true. |
|
206 |
^ self. |
|
207 |
] |
|
208 |
]. |
|
209 |
super update: aspect with: param from: sender. |
|
10484 | 210 |
|
211 |
"Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11382 | 212 |
"Modified: / 07-03-2012 / 17:16:59 / cg" |
10484 | 213 |
! ! |
214 |
||
14972
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
215 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
216 |
!LintService methodsFor:'help'! |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
217 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
218 |
flyByHelpTextAtLine:aLineNr |
15103 | 219 |
|a html rule info| |
14972
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
220 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
221 |
a := self annotationAtLine:aLineNr. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
222 |
a notNil ifTrue:[ |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
223 |
(rule := a rule) notNil ifTrue:[ |
15103 | 224 |
rule isComposite ifTrue:[ |
225 |
info := Character cr , |
|
226 |
((rule rules collect:[:each | codeView resources string:each infoInToolTip] as:Set) |
|
227 |
asStringCollection asStringWith:Character cr). |
|
228 |
] ifFalse:[ |
|
229 |
info := codeView resources string:rule infoInToolTip |
|
230 |
]. |
|
231 |
^ 'Lint says: ',info. |
|
232 |
||
14972
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
233 |
"/ html := String streamContents:[:s| |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
234 |
"/ s |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
235 |
"/ nextPutAll: '<html>'; |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
236 |
"/ nextPutAll: rule name; |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
237 |
"/ nextPutAll:'<P>'; |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
238 |
"/ nextPutLine: rule rationale; |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
239 |
"/ nextPutAll: '</html>'. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
240 |
"/ ]. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
241 |
"/ ^ html |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
242 |
] |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
243 |
]. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
244 |
^ nil |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
245 |
! ! |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
246 |
|
10484 | 247 |
!LintService methodsFor:'initialization'! |
248 |
||
249 |
initialize |
|
250 |
||
251 |
super initialize. |
|
252 |
||
253 |
highlighter := LintHighlighter new |
|
254 |
||
255 |
"Modified: / 03-09-2010 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
256 |
"Created: / 05-08-2011 / 11:53:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
257 |
! ! |
|
258 |
||
259 |
!LintService methodsFor:'private'! |
|
260 |
||
261 |
syntaxHighlight: delayed |
|
262 |
||
263 |
| service | |
|
264 |
service := self service: #'Tools::CodeHighlightingService'. |
|
265 |
service notNil ifTrue:[ |
|
14052
ebcdddd89b02
Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13498
diff
changeset
|
266 |
service processSafely: delayed |
10484 | 267 |
] |
268 |
||
269 |
"Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14052
ebcdddd89b02
Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13498
diff
changeset
|
270 |
"Modified: / 25-02-2014 / 19:57:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10484 | 271 |
! ! |
272 |
||
14972
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
273 |
!LintService methodsFor:'redrawing'! |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
274 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
275 |
drawLine:lineNo in:view atX:x y:y width:w height:h from:startCol to:endColOrNil with:fg and:bg |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
276 |
"Called by both gutterView and textView (well, not yet) to |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
277 |
allow services to draw custom things on text view. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
278 |
Ask JV what the args means if unsure (I'm lazy to document |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
279 |
them, now it is just an experiment...)" |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
280 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
281 |
| lang annotation | |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
282 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
283 |
((lang := codeView language) isNil or:[lang isSmalltalk not]) ifTrue:[ ^ self ]. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
284 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
285 |
annotation := self annotationAtLine: lineNo. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
286 |
annotation notNil ifTrue:[ |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
287 |
self drawAnnotationIcon: (ToolbarIconLibrary smalllintWarning16x16) |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
288 |
atX: x y: y width: w height: h. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
289 |
]. |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
290 |
|
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
291 |
"Created: / 30-01-2012 / 15:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
292 |
"Modified: / 07-08-2013 / 00:19:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
293 |
! ! |
0e176d3678b1
Support for line annotations
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14052
diff
changeset
|
294 |
|
10484 | 295 |
!LintService methodsFor:'registering'! |
296 |
||
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
297 |
fetchLintRuleHolder |
11382 | 298 |
|app| |
10484 | 299 |
|
11382 | 300 |
app := self application. |
301 |
app notNil ifTrue:[ |
|
302 |
"/ bad design; better idea would be to pass the lintRuleHolder back from the |
|
303 |
"/ application to me explicitely (in a postBuild method for some ruleCanvas of the app) |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
304 |
(app respondsTo: #selectedLintRules) ifTrue:[ |
11382 | 305 |
self ruleHolderFromApp: app selectedLintRules |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
306 |
] ifFalse:[ |
13498
b8d845e42988
Added `environment` instance variable to Tools__NewSystemBrowser and
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13202
diff
changeset
|
307 |
"/ self breakPoint:#jv. |
11416
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
308 |
"/ Transcript showCR:'LintService [info]: app does not provide a lintRuleHolder' |
11382 | 309 |
] |
10484 | 310 |
]. |
311 |
||
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
312 |
"Created: / 08-03-2012 / 01:16:38 / cg" |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
313 |
! |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
314 |
|
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
315 |
registerIn: aCodeView |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
316 |
super registerIn: aCodeView. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
317 |
self fetchLintRuleHolder. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
318 |
|
10484 | 319 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
320 |
"Created: / 05-08-2011 / 11:47:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
321 |
"Modified: / 08-03-2012 / 01:16:51 / cg" |
10484 | 322 |
! ! |
323 |
||
324 |
!LintService class methodsFor:'documentation'! |
|
325 |
||
326 |
version |
|
15103 | 327 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.15 2015-01-23 12:54:20 cg Exp $' |
10484 | 328 |
! |
329 |
||
330 |
version_CVS |
|
15103 | 331 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.15 2015-01-23 12:54:20 cg Exp $' |
10484 | 332 |
! ! |
13099 | 333 |