author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 25 Feb 2014 21:03:46 +0100 | |
changeset 14052 | ebcdddd89b02 |
parent 13498 | b8d845e42988 |
child 14972 | 0e176d3678b1 |
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 |
|
11416
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
31 |
instanceVariableNames:'ruleHolderFromApp highlighter' |
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
32 |
classVariableNames:'' |
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
33 |
poolDictionaries:'' |
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
34 |
category:'Interface-Lint' |
10484 | 35 |
! |
36 |
||
37 |
!LintService class methodsFor:'documentation'! |
|
38 |
||
39 |
copyright |
|
40 |
" |
|
41 |
COPYRIGHT (c) 2010 by Jan Vrany, SWING Research Group. CTU in Prague |
|
42 |
All Rights Reserved |
|
43 |
||
44 |
Permission is hereby granted, free of charge, to any person |
|
45 |
obtaining a copy of this software and associated documentation |
|
46 |
files (the 'Software'), to deal in the Software without |
|
47 |
restriction, including without limitation the rights to use, |
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
49 |
copies of the Software, and to permit persons to whom the |
|
50 |
Software is furnished to do so, subject to the following |
|
51 |
conditions: |
|
52 |
||
53 |
The above copyright notice and this permission notice shall be |
|
54 |
included in all copies or substantial portions of the Software. |
|
55 |
||
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
|
64 |
" |
|
65 |
! ! |
|
66 |
||
67 |
!LintService class methodsFor:'accessing'! |
|
68 |
||
69 |
label |
|
13099 | 70 |
"Answers a short label - for UI" |
10484 | 71 |
|
72 |
^'SmallLint Checker' |
|
73 |
||
74 |
"Created: / 05-08-2011 / 11:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
75 |
! ! |
|
76 |
||
13202 | 77 |
!LintService class methodsFor:'testing'! |
78 |
||
79 |
isUsefulFor:aCodeView |
|
80 |
"this filters useful services. |
|
81 |
Redefined to return true for myself - not for subclasses" |
|
82 |
||
83 |
^ self == Tools::LintService |
|
84 |
||
85 |
"Created: / 22-07-2013 / 14:01:38 / cg" |
|
86 |
! ! |
|
87 |
||
10484 | 88 |
!LintService methodsFor:'accessing'! |
89 |
||
90 |
syntaxHighlighter |
|
91 |
| app rules | |
|
92 |
||
11382 | 93 |
app := codeView application. |
94 |
app notNil ifTrue:[ |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
95 |
rules := self ruleHolderFromApp value. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
96 |
rules notEmptyOrNil ifTrue:[ |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
97 |
highlighter rules: rules. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
98 |
^ highlighter |
11382 | 99 |
]. |
10484 | 100 |
]. |
101 |
^nil |
|
102 |
||
103 |
"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
|
104 |
"Modified: / 08-03-2012 / 01:23:48 / cg" |
10484 | 105 |
! ! |
106 |
||
107 |
!LintService methodsFor:'aspects'! |
|
108 |
||
109 |
ruleHolderFromApp |
|
110 |
"return/create the 'ruleHolderFromApp' value holder (automatically generated)" |
|
111 |
||
11382 | 112 |
|app| |
113 |
||
10484 | 114 |
ruleHolderFromApp isNil ifTrue:[ |
11382 | 115 |
(app := self application) notNil ifTrue:[ |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
116 |
self fetchLintRuleHolder |
11382 | 117 |
"/ ruleHolderFromApp := ValueHolder new. |
118 |
"/ ruleHolderFromApp addDependent:self. |
|
119 |
]. |
|
10484 | 120 |
]. |
121 |
^ ruleHolderFromApp |
|
11382 | 122 |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
123 |
"Modified: / 08-03-2012 / 01:17:15 / cg" |
10484 | 124 |
! |
125 |
||
126 |
ruleHolderFromApp:something |
|
127 |
"set the 'ruleHolderFromApp' value holder (automatically generated)" |
|
128 |
||
129 |
|oldValue newValue| |
|
130 |
||
131 |
ruleHolderFromApp notNil ifTrue:[ |
|
132 |
oldValue := ruleHolderFromApp value. |
|
133 |
ruleHolderFromApp removeDependent:self. |
|
134 |
]. |
|
135 |
ruleHolderFromApp := something. |
|
136 |
ruleHolderFromApp notNil ifTrue:[ |
|
137 |
ruleHolderFromApp addDependent:self. |
|
138 |
]. |
|
139 |
newValue := ruleHolderFromApp value. |
|
140 |
oldValue ~~ newValue ifTrue:[ |
|
141 |
self update:#value with:newValue from:ruleHolderFromApp. |
|
142 |
]. |
|
143 |
! ! |
|
144 |
||
145 |
!LintService methodsFor:'change & update'! |
|
146 |
||
147 |
update: aspect with: param from: sender |
|
11382 | 148 |
aspect == #sizeOfView ifFalse:[ |
149 |
sender == ruleHolderFromApp ifTrue:[ |
|
150 |
self syntaxHighlight: true. |
|
151 |
^ self. |
|
152 |
] |
|
153 |
]. |
|
154 |
super update: aspect with: param from: sender. |
|
10484 | 155 |
|
156 |
"Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11382 | 157 |
"Modified: / 07-03-2012 / 17:16:59 / cg" |
10484 | 158 |
! ! |
159 |
||
160 |
!LintService methodsFor:'initialization'! |
|
161 |
||
162 |
initialize |
|
163 |
||
164 |
super initialize. |
|
165 |
||
166 |
highlighter := LintHighlighter new |
|
167 |
||
168 |
"Modified: / 03-09-2010 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
169 |
"Created: / 05-08-2011 / 11:53:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
170 |
! ! |
|
171 |
||
172 |
!LintService methodsFor:'private'! |
|
173 |
||
174 |
syntaxHighlight: delayed |
|
175 |
||
176 |
| service | |
|
177 |
service := self service: #'Tools::CodeHighlightingService'. |
|
178 |
service notNil ifTrue:[ |
|
14052
ebcdddd89b02
Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13498
diff
changeset
|
179 |
service processSafely: delayed |
10484 | 180 |
] |
181 |
||
182 |
"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
|
183 |
"Modified: / 25-02-2014 / 19:57:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10484 | 184 |
! ! |
185 |
||
186 |
!LintService methodsFor:'registering'! |
|
187 |
||
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
188 |
fetchLintRuleHolder |
11382 | 189 |
|app| |
10484 | 190 |
|
11382 | 191 |
app := self application. |
192 |
app notNil ifTrue:[ |
|
193 |
"/ bad design; better idea would be to pass the lintRuleHolder back from the |
|
194 |
"/ 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
|
195 |
(app respondsTo: #selectedLintRules) ifTrue:[ |
11382 | 196 |
self ruleHolderFromApp: app selectedLintRules |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
197 |
] ifFalse:[ |
13498
b8d845e42988
Added `environment` instance variable to Tools__NewSystemBrowser and
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13202
diff
changeset
|
198 |
"/ self breakPoint:#jv. |
11416
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
199 |
"/ Transcript showCR:'LintService [info]: app does not provide a lintRuleHolder' |
11382 | 200 |
] |
10484 | 201 |
]. |
202 |
||
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
203 |
"Created: / 08-03-2012 / 01:16:38 / cg" |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
204 |
! |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
205 |
|
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
206 |
registerIn: aCodeView |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
207 |
super registerIn: aCodeView. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
208 |
self fetchLintRuleHolder. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
209 |
|
10484 | 210 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
211 |
"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
|
212 |
"Modified: / 08-03-2012 / 01:16:51 / cg" |
10484 | 213 |
! ! |
214 |
||
215 |
!LintService class methodsFor:'documentation'! |
|
216 |
||
217 |
version |
|
14052
ebcdddd89b02
Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13498
diff
changeset
|
218 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.10 2014-02-25 20:03:46 vrany Exp $' |
10484 | 219 |
! |
220 |
||
221 |
version_CVS |
|
14052
ebcdddd89b02
Fix in BackrgoundSourceProcessingService:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13498
diff
changeset
|
222 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.10 2014-02-25 20:03:46 vrany Exp $' |
10484 | 223 |
! ! |
13099 | 224 |