author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 Jan 2013 11:15:09 +0000 | |
branch | jv |
changeset 12401 | 4714b9640528 |
parent 12206 | 927183c7da24 |
parent 11416 | 941e576b6f71 |
child 12431 | 9f0c59c742d5 |
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 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
30 |
Tools::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 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
67 |
|
10484 | 68 |
!LintService class methodsFor:'accessing'! |
69 |
||
70 |
label |
|
71 |
||
72 |
"Answers short label - for UI" |
|
73 |
||
74 |
^'SmallLint Checker' |
|
75 |
||
76 |
"Created: / 05-08-2011 / 11:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
77 |
! ! |
|
78 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
79 |
|
10484 | 80 |
!LintService methodsFor:'accessing'! |
81 |
||
82 |
syntaxHighlighter |
|
83 |
| app rules | |
|
84 |
||
11382 | 85 |
app := codeView application. |
86 |
app notNil ifTrue:[ |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
87 |
rules := self ruleHolderFromApp value. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
88 |
rules notEmptyOrNil ifTrue:[ |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
89 |
highlighter rules: rules. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
90 |
^ highlighter |
11382 | 91 |
]. |
10484 | 92 |
]. |
93 |
^nil |
|
94 |
||
95 |
"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
|
96 |
"Modified: / 08-03-2012 / 01:23:48 / cg" |
10484 | 97 |
! ! |
98 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
99 |
|
10484 | 100 |
!LintService methodsFor:'aspects'! |
101 |
||
102 |
ruleHolderFromApp |
|
103 |
"return/create the 'ruleHolderFromApp' value holder (automatically generated)" |
|
104 |
||
11382 | 105 |
|app| |
106 |
||
10484 | 107 |
ruleHolderFromApp isNil ifTrue:[ |
11382 | 108 |
(app := self application) notNil ifTrue:[ |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
109 |
self fetchLintRuleHolder |
11382 | 110 |
"/ ruleHolderFromApp := ValueHolder new. |
111 |
"/ ruleHolderFromApp addDependent:self. |
|
112 |
]. |
|
10484 | 113 |
]. |
114 |
^ ruleHolderFromApp |
|
11382 | 115 |
|
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
116 |
"Modified: / 08-03-2012 / 01:17:15 / cg" |
10484 | 117 |
! |
118 |
||
119 |
ruleHolderFromApp:something |
|
120 |
"set the 'ruleHolderFromApp' value holder (automatically generated)" |
|
121 |
||
122 |
|oldValue newValue| |
|
123 |
||
124 |
ruleHolderFromApp notNil ifTrue:[ |
|
125 |
oldValue := ruleHolderFromApp value. |
|
126 |
ruleHolderFromApp removeDependent:self. |
|
127 |
]. |
|
128 |
ruleHolderFromApp := something. |
|
129 |
ruleHolderFromApp notNil ifTrue:[ |
|
130 |
ruleHolderFromApp addDependent:self. |
|
131 |
]. |
|
132 |
newValue := ruleHolderFromApp value. |
|
133 |
oldValue ~~ newValue ifTrue:[ |
|
134 |
self update:#value with:newValue from:ruleHolderFromApp. |
|
135 |
]. |
|
136 |
! ! |
|
137 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
138 |
|
10484 | 139 |
!LintService methodsFor:'change & update'! |
140 |
||
141 |
update: aspect with: param from: sender |
|
11382 | 142 |
aspect == #sizeOfView ifFalse:[ |
143 |
sender == ruleHolderFromApp ifTrue:[ |
|
144 |
self syntaxHighlight: true. |
|
145 |
^ self. |
|
146 |
] |
|
147 |
]. |
|
148 |
super update: aspect with: param from: sender. |
|
10484 | 149 |
|
150 |
"Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11382 | 151 |
"Modified: / 07-03-2012 / 17:16:59 / cg" |
10484 | 152 |
! ! |
153 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
154 |
|
10484 | 155 |
!LintService methodsFor:'initialization'! |
156 |
||
157 |
initialize |
|
158 |
||
159 |
super initialize. |
|
160 |
||
161 |
highlighter := LintHighlighter new |
|
162 |
||
163 |
"Modified: / 03-09-2010 / 22:29:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
164 |
"Created: / 05-08-2011 / 11:53:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
165 |
! ! |
|
166 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
167 |
|
10484 | 168 |
!LintService methodsFor:'private'! |
169 |
||
170 |
syntaxHighlight: delayed |
|
171 |
||
172 |
| service | |
|
173 |
service := self service: #'Tools::CodeHighlightingService'. |
|
174 |
service notNil ifTrue:[ |
|
11227 | 175 |
service process: delayed |
10484 | 176 |
] |
177 |
||
178 |
"Created: / 05-08-2011 / 11:49:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
179 |
! ! |
|
180 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
181 |
|
10484 | 182 |
!LintService methodsFor:'registering'! |
183 |
||
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
184 |
fetchLintRuleHolder |
11382 | 185 |
|app| |
10484 | 186 |
|
11382 | 187 |
app := self application. |
188 |
app notNil ifTrue:[ |
|
189 |
"/ bad design; better idea would be to pass the lintRuleHolder back from the |
|
190 |
"/ 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
|
191 |
(app respondsTo: #selectedLintRules) ifTrue:[ |
11382 | 192 |
self ruleHolderFromApp: app selectedLintRules |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
193 |
] ifFalse:[ |
12206 | 194 |
"/self breakPoint:#jv. |
11416
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
195 |
"/ Transcript showCR:'LintService [info]: app does not provide a lintRuleHolder' |
11382 | 196 |
] |
10484 | 197 |
]. |
198 |
||
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
199 |
"Created: / 08-03-2012 / 01:16:38 / cg" |
12206 | 200 |
"Modified: / 22-03-2012 / 13:51:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11390
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
201 |
! |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
202 |
|
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
203 |
registerIn: aCodeView |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
204 |
super registerIn: aCodeView. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
205 |
self fetchLintRuleHolder. |
b5af6f49f10f
added: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11389
diff
changeset
|
206 |
|
10484 | 207 |
"Modified: / 17-06-2011 / 13:07:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
208 |
"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
|
209 |
"Modified: / 08-03-2012 / 01:16:51 / cg" |
10484 | 210 |
! ! |
211 |
||
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
212 |
|
10484 | 213 |
!LintService class methodsFor:'documentation'! |
214 |
||
215 |
version |
|
11416
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
216 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.6 2012-03-12 18:20:05 cg Exp $' |
10484 | 217 |
! |
218 |
||
219 |
version_CVS |
|
11416
941e576b6f71
changed: #fetchLintRuleHolder
Claus Gittinger <cg@exept.de>
parents:
11390
diff
changeset
|
220 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintService.st,v 1.6 2012-03-12 18:20:05 cg Exp $' |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
221 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
222 |
|
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
223 |
version_SVN |
12206 | 224 |
^ '$Id: Tools__LintService.st 7953 2012-03-22 13:55:44Z vranyj1 $' |
10484 | 225 |
! ! |
12401
4714b9640528
Merged 235b77901045 and 8332590c5a41 (branch default)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
226 |