author | Jan Vrany <jan.vrany@labware.com> |
Sat, 30 Sep 2023 22:55:25 +0100 | |
branch | jv |
changeset 19648 | 5df52d354504 |
parent 19631 | 7351a219f202 |
permissions | -rw-r--r-- |
10000 | 1 |
" |
10096 | 2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
4 |
Copyright (c) 2022 LabWare |
10000 | 5 |
|
10096 | 6 |
Permission is hereby granted, free of charge, to any person |
7 |
obtaining a copy of this software and associated documentation |
|
8 |
files (the 'Software'), to deal in the Software without |
|
9 |
restriction, including without limitation the rights to use, |
|
10 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
11 |
copies of the Software, and to permit persons to whom the |
|
12 |
Software is furnished to do so, subject to the following |
|
13 |
conditions: |
|
14 |
||
15 |
The above copyright notice and this permission notice shall be |
|
16 |
included in all copies or substantial portions of the Software. |
|
17 |
||
18 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
19 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
20 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
21 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
22 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
23 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
25 |
OTHER DEALINGS IN THE SOFTWARE. |
|
10000 | 26 |
" |
27 |
"{ Package: 'stx:libtool' }" |
|
28 |
||
29 |
"{ NameSpace: Tools }" |
|
30 |
||
31 |
BrowserList subclass:#LintRuleList |
|
32 |
instanceVariableNames:'listHolder filterHolder modeHolder listSelection listView |
|
33 |
initialSelectionHolder' |
|
14978 | 34 |
classVariableNames:'LastNameFilter' |
10000 | 35 |
poolDictionaries:'' |
36 |
category:'Interface-Lint' |
|
37 |
! |
|
38 |
||
39 |
HierarchicalItem subclass:#ListEntry |
|
40 |
instanceVariableNames:'x rule application' |
|
41 |
classVariableNames:'' |
|
42 |
poolDictionaries:'' |
|
43 |
privateIn:LintRuleList |
|
44 |
! |
|
45 |
||
46 |
!LintRuleList class methodsFor:'documentation'! |
|
47 |
||
48 |
copyright |
|
49 |
" |
|
10096 | 50 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
51 |
Copyright (c) 2009-2010 eXept Software AG |
|
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
52 |
Copyright (c) 2022 LabWare |
10096 | 53 |
|
54 |
Permission is hereby granted, free of charge, to any person |
|
55 |
obtaining a copy of this software and associated documentation |
|
56 |
files (the 'Software'), to deal in the Software without |
|
57 |
restriction, including without limitation the rights to use, |
|
58 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
59 |
copies of the Software, and to permit persons to whom the |
|
60 |
Software is furnished to do so, subject to the following |
|
61 |
conditions: |
|
10000 | 62 |
|
10096 | 63 |
The above copyright notice and this permission notice shall be |
64 |
included in all copies or substantial portions of the Software. |
|
65 |
||
66 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
67 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
68 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
69 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
70 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
71 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
72 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
73 |
OTHER DEALINGS IN THE SOFTWARE. |
|
10000 | 74 |
" |
14754
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
75 |
! |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
76 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
77 |
documentation |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
78 |
" |
17298 | 79 |
Embeddable list to display a set of SmallLint rules. |
80 |
(this is embedded in the browser when showing lint check outcomes) |
|
14754
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
81 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
82 |
Supports 3 modes (controlled by modeHolder) |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
83 |
#display - only display given set of rules. |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
84 |
#displaySelection - display set of rules and indicate which one is selected |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
85 |
by check mark. Does NOT ALLOW to change selection |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
86 |
(add remove tools) |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
87 |
#select - display set of rules and DO ALLOW to change the selection |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
88 |
(add / remove rules) by clicking to check icon |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
89 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
90 |
[author:] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
91 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
92 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
93 |
[instance variables:] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
94 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
95 |
[class variables:] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
96 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
97 |
[see also:] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
98 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
99 |
" |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
100 |
! |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
101 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
102 |
examples |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
103 |
" |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
104 |
Starting the application: |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
105 |
[exBegin] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
106 |
Tools::LintRuleList open |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
107 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
108 |
[exEnd] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
109 |
|
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
110 |
more examples to be added: |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
111 |
[exBegin] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
112 |
... add code fragment for |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
113 |
... executable example here ... |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
114 |
[exEnd] |
7905f58cb037
Do now allow ruleset editing in ruleset selection dialog.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14671
diff
changeset
|
115 |
" |
10000 | 116 |
! ! |
117 |
||
118 |
!LintRuleList class methodsFor:'interface specs'! |
|
119 |
||
120 |
windowSpec |
|
121 |
"This resource specification was automatically generated |
|
122 |
by the UIPainter of ST/X." |
|
123 |
||
124 |
"Do not manually edit this!! If it is corrupted, |
|
125 |
the UIPainter may not be able to read the specification." |
|
126 |
||
127 |
" |
|
128 |
UIPainter new openOnClass:Tools::LintRuleList andSelector:#windowSpec |
|
129 |
Tools::LintRuleList new openInterface:#windowSpec |
|
130 |
Tools::LintRuleList open |
|
131 |
" |
|
132 |
||
133 |
<resource: #canvas> |
|
134 |
||
135 |
^ |
|
16589 | 136 |
#(FullSpec |
137 |
name: windowSpec |
|
138 |
window: |
|
139 |
(WindowSpec |
|
140 |
label: 'SmallLintRuleList' |
|
141 |
name: 'SmallLintRuleList' |
|
142 |
min: (Point 10 10) |
|
143 |
bounds: (Rectangle 0 0 300 300) |
|
144 |
) |
|
145 |
component: |
|
146 |
(SpecCollection |
|
147 |
collection: ( |
|
148 |
(InputFieldSpec |
|
149 |
name: 'RuleFilter' |
|
150 |
layout: (LayoutFrame 0 0 0 0 0 1 28 0) |
|
151 |
model: filterHolder |
|
152 |
immediateAccept: true |
|
153 |
acceptOnReturn: true |
|
154 |
acceptOnTab: true |
|
155 |
acceptOnPointerLeave: true |
|
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
156 |
emptyFieldReplacementText: 'Search pattern, prefix with # to match rule tags' |
10000 | 157 |
) |
16589 | 158 |
(SelectionInListModelViewSpec |
159 |
name: 'RuleList' |
|
160 |
layout: (LayoutFrame 0 0 28 0 0 1 0 1) |
|
161 |
model: listSelection |
|
162 |
menu: menuHolder |
|
163 |
hasHorizontalScrollBar: true |
|
164 |
hasVerticalScrollBar: true |
|
165 |
listModel: listHolder |
|
166 |
multipleSelectOk: true |
|
167 |
useIndex: false |
|
168 |
highlightMode: line |
|
169 |
postBuildCallback: postBuildList: |
|
170 |
) |
|
171 |
) |
|
172 |
||
173 |
) |
|
174 |
) |
|
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
175 |
|
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
176 |
"Modified: / 26-07-2022 / 11:47:26 / Jan Vrany <jan.vrany@labware.com>" |
10000 | 177 |
! ! |
178 |
||
179 |
!LintRuleList class methodsFor:'menu specs'! |
|
180 |
||
181 |
menu |
|
182 |
"This resource specification was automatically generated |
|
183 |
by the MenuEditor of ST/X." |
|
184 |
||
185 |
"Do not manually edit this!! If it is corrupted, |
|
186 |
the MenuEditor may not be able to read the specification." |
|
187 |
||
11381 | 188 |
|
10000 | 189 |
" |
11381 | 190 |
MenuEditor new openOnClass:Tools::LintRuleList andSelector:#menu |
191 |
(Menu new fromLiteralArrayEncoding:(Tools::LintRuleList menu)) startUp |
|
10000 | 192 |
" |
193 |
||
194 |
<resource: #menu> |
|
195 |
||
196 |
^ |
|
197 |
#(Menu |
|
198 |
( |
|
199 |
(MenuItem |
|
16438 | 200 |
label: 'Run this Rule Again' |
201 |
itemValue: runRuleAgain |
|
202 |
) |
|
203 |
(MenuItem |
|
10000 | 204 |
label: '-' |
205 |
) |
|
206 |
(MenuItem |
|
16438 | 207 |
label: 'Inspect Rule' |
208 |
itemValue: menuInspectRule |
|
209 |
) |
|
210 |
(MenuItem |
|
211 |
label: 'Browse Rule Class' |
|
212 |
itemValue: menuBrowseRuleClass |
|
10000 | 213 |
) |
214 |
) |
|
215 |
nil |
|
216 |
nil |
|
217 |
) |
|
218 |
! ! |
|
219 |
||
220 |
!LintRuleList class methodsFor:'plugIn spec'! |
|
221 |
||
222 |
aspectSelectors |
|
223 |
"This resource specification was automatically generated |
|
224 |
by the UIPainter of ST/X." |
|
225 |
||
226 |
"Do not manually edit this. If it is corrupted, |
|
227 |
the UIPainter may not be able to read the specification." |
|
228 |
||
229 |
"Return a description of exported aspects; |
|
230 |
these can be connected to aspects of an embedding application |
|
231 |
(if this app is embedded in a subCanvas)." |
|
232 |
||
233 |
^ #( |
|
16589 | 234 |
#environmentHolder |
10000 | 235 |
#inGeneratorHolder |
13798 | 236 |
#listSelection |
10000 | 237 |
#modeHolder |
238 |
#outGeneratorHolder |
|
239 |
#selectionHolder |
|
240 |
). |
|
241 |
||
242 |
! ! |
|
243 |
||
244 |
!LintRuleList methodsFor:'accessing'! |
|
245 |
||
246 |
mode |
|
247 |
||
248 |
^self modeHolder value |
|
249 |
||
250 |
"Created: / 25-08-2010 / 11:33:51 / Jan Vrany <enter your email here>" |
|
251 |
! |
|
252 |
||
253 |
selection |
|
254 |
||
255 |
| sel | |
|
256 |
sel := self selectionHolder value. |
|
257 |
sel ifNil:[sel := Set new]. |
|
258 |
^sel |
|
259 |
||
260 |
"Created: / 25-08-2010 / 13:26:58 / Jan Vrany <enter your email here>" |
|
261 |
! |
|
262 |
||
263 |
selection: aCollectionOrNil |
|
264 |
||
265 |
| sel | |
|
266 |
sel := aCollectionOrNil |
|
267 |
ifNil:[Set new] |
|
268 |
ifNotNil:[aCollectionOrNil asSet]. |
|
269 |
||
13798 | 270 |
self selectionHolder value: sel. |
10000 | 271 |
|
272 |
"Created: / 25-08-2010 / 13:28:43 / Jan Vrany <enter your email here>" |
|
273 |
"Modified: / 25-08-2010 / 15:29:35 / Jan Vrany <enter your email here>" |
|
13798 | 274 |
"Modified: / 27-02-2013 / 23:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 275 |
! ! |
276 |
||
277 |
!LintRuleList methodsFor:'aspects'! |
|
278 |
||
279 |
filterHolder |
|
280 |
"return/create the 'filterHolder' value holder (automatically generated)" |
|
281 |
||
282 |
filterHolder isNil ifTrue:[ |
|
14978 | 283 |
filterHolder := LastNameFilter asValue. |
10000 | 284 |
filterHolder addDependent:self. |
285 |
]. |
|
286 |
^ filterHolder |
|
287 |
! |
|
288 |
||
289 |
filterHolder:something |
|
290 |
"set the 'filterHolder' value holder (automatically generated)" |
|
291 |
||
292 |
|oldValue newValue| |
|
293 |
||
294 |
filterHolder notNil ifTrue:[ |
|
295 |
oldValue := filterHolder value. |
|
296 |
filterHolder removeDependent:self. |
|
297 |
]. |
|
298 |
filterHolder := something. |
|
299 |
filterHolder notNil ifTrue:[ |
|
300 |
filterHolder addDependent:self. |
|
301 |
]. |
|
302 |
newValue := filterHolder value. |
|
303 |
oldValue ~~ newValue ifTrue:[ |
|
304 |
self update:#value with:newValue from:filterHolder. |
|
305 |
]. |
|
306 |
! |
|
307 |
||
308 |
listHolder |
|
309 |
"return/create the 'ruleList' value holder (automatically generated)" |
|
310 |
||
311 |
listHolder isNil ifTrue:[ |
|
312 |
listHolder := ValueHolder new. |
|
313 |
]. |
|
314 |
^ listHolder |
|
315 |
! |
|
316 |
||
317 |
listSelection |
|
318 |
"return/create the 'listSelection' value holder (automatically generated)" |
|
319 |
||
320 |
listSelection isNil ifTrue:[ |
|
321 |
listSelection := ValueHolder new. |
|
322 |
listSelection addDependent:self. |
|
323 |
]. |
|
324 |
^ listSelection |
|
325 |
! |
|
326 |
||
327 |
listSelection:something |
|
328 |
"set the 'listSelection' value holder (automatically generated)" |
|
329 |
||
330 |
|oldValue newValue| |
|
331 |
||
332 |
listSelection notNil ifTrue:[ |
|
333 |
oldValue := listSelection value. |
|
334 |
listSelection removeDependent:self. |
|
335 |
]. |
|
336 |
listSelection := something. |
|
337 |
listSelection notNil ifTrue:[ |
|
338 |
listSelection addDependent:self. |
|
339 |
]. |
|
340 |
newValue := listSelection value. |
|
341 |
oldValue ~~ newValue ifTrue:[ |
|
342 |
self update:#value with:newValue from:listSelection. |
|
343 |
]. |
|
344 |
! |
|
345 |
||
346 |
modeHolder |
|
16438 | 347 |
"the mode - can run in select or in display modes. |
348 |
select is to choose a set of rules; |
|
349 |
display for presentation of results (in a browser). |
|
350 |
See documentation for details" |
|
351 |
||
352 |
modeHolder isNil ifTrue:[ |
|
353 |
modeHolder := ValueHolder with: #display |
|
354 |
]. |
|
10000 | 355 |
^modeHolder |
356 |
||
357 |
"Modified: / 15-04-2010 / 20:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
358 |
! |
|
359 |
||
360 |
modeHolder:aValueModel |
|
16438 | 361 |
"the mode - can run in select or in display modes. |
362 |
select is to choose a set of rules; |
|
363 |
display for presentation of results (in a browser). |
|
364 |
See documentation for details" |
|
365 |
||
10000 | 366 |
modeHolder := aValueModel. |
367 |
! |
|
368 |
||
369 |
selectedLintRules |
|
370 |
^ self selectionHolder |
|
371 |
||
372 |
"Created: / 02-02-2010 / 20:43:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
373 |
! |
|
374 |
||
375 |
selectedLintRules: anObject |
|
376 |
^ self selectionHolder: anObject |
|
377 |
||
378 |
"Created: / 02-02-2010 / 20:43:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
379 |
! ! |
|
380 |
||
381 |
!LintRuleList methodsFor:'change & update'! |
|
382 |
||
383 |
delayedUpdate:something with:aParameter from:changedObject |
|
384 |
"Invoked when an object that I depend upon sends a change notification." |
|
385 |
||
386 |
changedObject == filterHolder ifTrue:[ |
|
14978 | 387 |
LastNameFilter := filterHolder value. |
10000 | 388 |
self updateList. |
389 |
^ self. |
|
390 |
]. |
|
391 |
||
392 |
(changedObject == listSelection) ifTrue:[ |
|
393 |
listValid ifFalse:[ |
|
394 |
self updateList. |
|
395 |
]. |
|
396 |
^ self selectionChanged |
|
397 |
]. |
|
398 |
||
10499 | 399 |
(changedObject == selectionHolder) ifTrue:[ |
13798 | 400 |
listView notNil ifTrue:[ |
401 |
listView invalidate |
|
402 |
]. |
|
10499 | 403 |
^self. |
404 |
]. |
|
405 |
||
406 |
||
10000 | 407 |
super delayedUpdate:something with:aParameter from:changedObject |
408 |
||
409 |
"Created: / 26-08-2010 / 11:43:33 / Jan Vrany <enter your email here>" |
|
13798 | 410 |
"Modified: / 27-02-2013 / 23:40:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10499 | 411 |
! |
412 |
||
14855 | 413 |
enqueueDelayedUpdateList |
414 |
super enqueueDelayedUpdateList |
|
415 |
! |
|
416 |
||
10499 | 417 |
selectionChanged |
418 |
||
16426 | 419 |
| selection newSelection | |
14169
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
420 |
|
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
421 |
super selectionChanged. |
14786
6761e919308a
Bugfix in selection handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14755
diff
changeset
|
422 |
self mode == #display ifTrue:[ |
14169
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
423 |
selection := self listSelection value. |
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
424 |
selection isEmptyOrNil ifTrue:[ |
16426 | 425 |
newSelection := selection |
14169
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
426 |
] ifFalse:[ |
16426 | 427 |
newSelection := selection collect:[:entry|entry rule] |
14169
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
428 |
]. |
16426 | 429 |
self selectionHolder value: newSelection. |
14855 | 430 |
"/ listView invalidate |
14169
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
431 |
]. |
10499 | 432 |
|
433 |
"Created: / 05-08-2011 / 00:10:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14786
6761e919308a
Bugfix in selection handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14755
diff
changeset
|
434 |
"Modified: / 17-10-2014 / 00:01:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 435 |
! ! |
436 |
||
437 |
!LintRuleList methodsFor:'event processing'! |
|
438 |
||
439 |
buttonPress:button x:x y:y view:aView |
|
440 |
||
441 |
| itemIndex item | |
|
442 |
||
16438 | 443 |
(button == 1 and:[self modeHolder value == #select]) ifFalse:[ |
444 |
^ aView buttonPress:button x:x y:y |
|
445 |
]. |
|
10000 | 446 |
|
447 |
itemIndex := aView yVisibleToLineNr:y. |
|
14755 | 448 |
itemIndex isNil ifTrue:[^self]. |
10000 | 449 |
itemIndex == 0 ifTrue:[^self]. |
450 |
itemIndex > aView list size ifTrue:[^self]. |
|
451 |
item := aView list at: itemIndex. |
|
452 |
||
453 |
((aView left + x) between: (item x) and: (item x + 16)) |
|
454 |
ifFalse:[^aView buttonPress:button x:x y:y]. |
|
455 |
||
456 |
item checked: item checked not. |
|
457 |
aView invalidate |
|
458 |
||
459 |
"Created: / 08-12-2009 / 14:12:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14755 | 460 |
"Modified: / 13-10-2014 / 18:38:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 461 |
! |
462 |
||
463 |
handlesButtonPress:button inView:aView |
|
14923
7c189a24693c
class: Tools::LintRuleList
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14855
diff
changeset
|
464 |
^ listView == aView |
7c189a24693c
class: Tools::LintRuleList
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14855
diff
changeset
|
465 |
and:[ button == 1 |
7c189a24693c
class: Tools::LintRuleList
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14855
diff
changeset
|
466 |
and:[ self modeHolder value == #select ] ] |
10000 | 467 |
|
468 |
"Created: / 08-12-2009 / 14:08:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
14923
7c189a24693c
class: Tools::LintRuleList
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14855
diff
changeset
|
469 |
"Modified: / 27-11-2014 / 09:18:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 470 |
! ! |
471 |
||
472 |
!LintRuleList methodsFor:'generators'! |
|
473 |
||
474 |
makeGenerator |
|
475 |
||
16426 | 476 |
self modeHolder value == #display ifTrue:[ |
477 |
^ Iterator |
|
478 |
on: [:whatToDo| |
|
479 |
self listSelection value ? #() do:[:each| |
|
16875 | 480 |
"/ classes removed (in the meanwhile), but still referenced by name in the lintResults |
481 |
"/ may lead to nil being enumerated here... |
|
482 |
each failedClasses nonNilElementsDo:whatToDo |
|
16426 | 483 |
] |
484 |
] |
|
485 |
]. |
|
486 |
^ Iterator |
|
487 |
on: [:whatToDo| |
|
488 |
self selection do:[:rule| whatToDo value: rule] |
|
489 |
]. |
|
10000 | 490 |
|
491 |
"Modified: / 16-04-2010 / 12:13:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
492 |
"Modified: / 25-08-2010 / 13:39:51 / Jan Vrany <enter your email here>" |
|
493 |
! ! |
|
494 |
||
495 |
!LintRuleList methodsFor:'hooks'! |
|
496 |
||
497 |
commonPostOpen |
|
12035 | 498 |
super commonPostOpen. |
10000 | 499 |
self updateOutputGenerator. |
500 |
||
501 |
"Created: / 16-04-2010 / 11:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
502 |
! |
|
503 |
||
504 |
postBuildList: aView |
|
505 |
||
506 |
listView := aView scrolledView. |
|
507 |
listView delegate: self. |
|
508 |
||
509 |
"Created: / 08-12-2009 / 14:10:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
510 |
! ! |
|
511 |
||
512 |
!LintRuleList methodsFor:'initialization'! |
|
513 |
||
514 |
initialize |
|
14033
a8387e4a0a78
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13798
diff
changeset
|
515 |
| menu | |
10000 | 516 |
|
517 |
super initialize. |
|
16438 | 518 |
|
519 |
menuHolder := |
|
520 |
[ |
|
521 |
menu := self menuFor: #menu. |
|
522 |
menu isArray ifTrue:[ menu := Menu decodeFromLiteralArray: menu ]. |
|
523 |
menu |
|
524 |
]. |
|
525 |
||
14855 | 526 |
"/ self selection: Set new. |
10000 | 527 |
|
528 |
"Modified: / 25-08-2010 / 15:24:45 / Jan Vrany <enter your email here>" |
|
14033
a8387e4a0a78
Refactoring of NavigatorModel's environment.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13798
diff
changeset
|
529 |
"Modified: / 24-02-2014 / 12:00:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 530 |
! ! |
531 |
||
532 |
!LintRuleList methodsFor:'menu actions'! |
|
533 |
||
16438 | 534 |
menuBrowseRuleClass |
535 |
| selection | |
|
10000 | 536 |
|
16438 | 537 |
selection := self listSelection value. |
538 |
selection size = 1 ifTrue:[selection anyOne rule class browse]. |
|
539 |
selection size > 1 ifTrue:[SystemBrowser |
|
540 |
browseClasses:(selection collect:[:e|e rule class]) |
|
541 |
label:'Rule classes']. |
|
542 |
! |
|
543 |
||
544 |
menuInspectRule |
|
10000 | 545 |
| selection | |
16438 | 546 |
|
10000 | 547 |
selection := self listSelection value. |
548 |
selection size = 1 ifTrue:[selection anyOne rule inspect]. |
|
549 |
selection size > 1 ifTrue:[(selection collect:[:e|e rule]) inspect]. |
|
16438 | 550 |
! |
10000 | 551 |
|
16438 | 552 |
runRuleAgain |
553 |
self selectedLintRules value do:[:eachRule | |
|
554 |
eachRule run. |
|
555 |
]. |
|
16442 | 556 |
"/ self updateList. |
557 |
self updateOutputGenerator |
|
10000 | 558 |
! ! |
559 |
||
560 |
!LintRuleList methodsFor:'private'! |
|
561 |
||
562 |
listEntryFor: anRBLintRule |
|
563 |
||
564 |
| entry | |
|
565 |
entry := ListEntry new |
|
566 |
rule: anRBLintRule; |
|
567 |
application: self; |
|
568 |
expand; |
|
569 |
yourself. |
|
570 |
^entry |
|
571 |
||
572 |
"Created: / 15-04-2010 / 18:59:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
573 |
"Modified: / 25-08-2010 / 14:15:46 / Jan Vrany <enter your email here>" |
|
574 |
! |
|
575 |
||
576 |
makeDependent |
|
577 |
||
578 |
"nothing to do" |
|
579 |
||
580 |
"Created: / 02-02-2010 / 20:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
581 |
! |
|
582 |
||
583 |
makeIndependent |
|
584 |
||
585 |
"nothing to do" |
|
586 |
||
587 |
"Created: / 02-02-2010 / 20:23:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
588 |
! |
|
589 |
||
590 |
rules: rules includes: rule |
|
591 |
||
592 |
^rules contains: |
|
593 |
[:each| |
|
594 |
each class == rule class and: |
|
595 |
[each name = rule name]] |
|
596 |
||
597 |
"Created: / 26-08-2010 / 12:04:04 / Jan Vrany <enter your email here>" |
|
598 |
! |
|
599 |
||
14855 | 600 |
setListValid:aBoolean |
14945 | 601 |
"/ listValid ifTrue:[ |
602 |
"/ aBoolean ifFalse:[self halt]. |
|
603 |
"/ ]. |
|
14855 | 604 |
listValid := aBoolean. |
605 |
! |
|
606 |
||
10000 | 607 |
updateList |
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
608 |
|filterString filterBlock| |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
609 |
|
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
610 |
self filterHolder value notEmptyOrNil ifTrue: [ |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
611 |
filterString := self filterHolder value. |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
612 |
"/ If filtering pattern starts with #, filter by tags, |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
613 |
"/ otherwise, filter by (class) name |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
614 |
(filterString startsWith: $#) ifTrue: [ |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
615 |
| tags | |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
616 |
|
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
617 |
tags := filterString splitByAny: '#, '. |
19631
7351a219f202
Oops, fix bug in Lint rules filtering introduced in commit fe29ed10a99d
Jan Vrany <jan.vrany@labware.com>
parents:
19630
diff
changeset
|
618 |
filterBlock := [ :rule :relax | rule class tags anySatisfy: [:ruleTag | tags contains:[:matchTag | ruleTag startsWith: matchTag ] ] ]. |
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
619 |
] ifFalse: [ |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
620 |
| pattern | |
10000 | 621 |
|
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
622 |
pattern := StringPattern matches: filterString. |
19631
7351a219f202
Oops, fix bug in Lint rules filtering introduced in commit fe29ed10a99d
Jan Vrany <jan.vrany@labware.com>
parents:
19630
diff
changeset
|
623 |
filterBlock := [ :rule :relax | (pattern match: rule name case: false relax: relax) or: [ pattern match: rule class name case: false relax: relax] ]. |
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
624 |
]. |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
625 |
]. |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
626 |
self updateListUsingFilter: filterBlock |
19631
7351a219f202
Oops, fix bug in Lint rules filtering introduced in commit fe29ed10a99d
Jan Vrany <jan.vrany@labware.com>
parents:
19630
diff
changeset
|
627 |
|
7351a219f202
Oops, fix bug in Lint rules filtering introduced in commit fe29ed10a99d
Jan Vrany <jan.vrany@labware.com>
parents:
19630
diff
changeset
|
628 |
"Modified: / 17-08-2022 / 12:07:51 / Jan Vrany <jan.vrany@labware.com>" |
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
629 |
! |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
630 |
|
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
631 |
updateListUsingFilter: filterBlockOrNil |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
632 |
|inGenerator newList | |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
633 |
|
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
634 |
inGenerator := self inGeneratorHolder value. |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
635 |
(inGenerator isNil and:[self mode == #display]) ifTrue:[ |
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
636 |
inGenerator := RBCompositeLintRule allRules flattened |
10455 | 637 |
]. |
10000 | 638 |
newList := OrderedCollection new. |
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
639 |
inGenerator do:[:rule | |
10455 | 640 |
rule flattened do: [:rule| |
19631
7351a219f202
Oops, fix bug in Lint rules filtering introduced in commit fe29ed10a99d
Jan Vrany <jan.vrany@labware.com>
parents:
19630
diff
changeset
|
641 |
(filterBlockOrNil isNil or: [ filterBlockOrNil value: rule value: 2]) ifTrue:[ |
10455 | 642 |
newList add: (self listEntryFor:rule) |
643 |
] |
|
644 |
] |
|
645 |
]. |
|
16872 | 646 |
newList |
647 |
sort:[:a :b | |
|
648 |
|sevA sevB| |
|
649 |
||
650 |
sevA := a rule severityAsInteger. |
|
651 |
sevB := b rule severityAsInteger. |
|
652 |
(sevA > sevB) |
|
653 |
or:[ (sevA == sevB) and:[a rule name < b rule name]]. |
|
654 |
]. |
|
655 |
"/ newList sort:[:a :b | a name < b name]. |
|
10000 | 656 |
self listHolder value:newList. |
14855 | 657 |
self setListValid:true. |
10000 | 658 |
|
19630
fe29ed10a99d
Allow to filter using lint rule tags
Jan Vrany <jan.vrany@labware.com>
parents:
17379
diff
changeset
|
659 |
"Created: / 26-07-2022 / 11:38:40 / Jan Vrany <jan.vrany@labware.com>" |
19631
7351a219f202
Oops, fix bug in Lint rules filtering introduced in commit fe29ed10a99d
Jan Vrany <jan.vrany@labware.com>
parents:
19630
diff
changeset
|
660 |
"Modified: / 17-08-2022 / 12:06:44 / Jan Vrany <jan.vrany@labware.com>" |
10000 | 661 |
! ! |
662 |
||
10499 | 663 |
!LintRuleList methodsFor:'queries'! |
664 |
||
665 |
supportsSearch |
|
666 |
||
667 |
^false |
|
668 |
||
669 |
"Created: / 04-08-2011 / 23:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
670 |
! ! |
|
671 |
||
10000 | 672 |
!LintRuleList methodsFor:'selection'! |
673 |
||
674 |
selectionAdd: rule |
|
675 |
||
676 |
self selection: |
|
677 |
(self selection addAll: rule flattened; yourself) |
|
678 |
||
679 |
"Created: / 25-08-2010 / 13:34:57 / Jan Vrany <enter your email here>" |
|
680 |
! |
|
681 |
||
682 |
selectionIncludes: rule |
|
683 |
||
684 |
^self rules: self selection includes: rule |
|
685 |
||
686 |
"Created: / 25-08-2010 / 13:30:14 / Jan Vrany <enter your email here>" |
|
687 |
"Modified: / 26-08-2010 / 12:04:19 / Jan Vrany <enter your email here>" |
|
688 |
! |
|
689 |
||
690 |
selectionRemove: rule |
|
691 |
||
692 |
| sel rules | |
|
693 |
sel := self selection. |
|
694 |
rules := rule flattened. |
|
695 |
sel := sel reject: |
|
696 |
[:each|self rules: rules includes: each]. |
|
697 |
self selection: sel |
|
698 |
||
699 |
"Created: / 25-08-2010 / 13:35:08 / Jan Vrany <enter your email here>" |
|
700 |
"Modified: / 26-08-2010 / 12:05:06 / Jan Vrany <enter your email here>" |
|
701 |
! ! |
|
702 |
||
703 |
!LintRuleList::ListEntry class methodsFor:'instance creation'! |
|
704 |
||
705 |
change: aChange |
|
706 |
||
707 |
^self new change: aChange |
|
708 |
||
709 |
"Created: / 24-07-2009 / 22:43:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
710 |
! |
|
711 |
||
712 |
change: aChange application: anApplicationModel |
|
713 |
||
714 |
^self new change: aChange; application: anApplicationModel |
|
715 |
||
716 |
"Created: / 05-12-2009 / 14:16:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
717 |
! |
|
718 |
||
719 |
change: aChange parent: aChangeList |
|
720 |
||
721 |
^self new change: aChange; parent: aChangeList |
|
722 |
||
723 |
"Created: / 25-07-2009 / 23:33:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
724 |
! ! |
|
725 |
||
726 |
!LintRuleList::ListEntry methodsFor:'accessing'! |
|
727 |
||
728 |
application |
|
14169
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
729 |
^ application notNil ifTrue:[application] ifFalse:[super application] |
10000 | 730 |
|
14169
d983f6273b6d
Fixed LintRileList>>selectionChanged so it works both in browser and in dialog. Bit hacky.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14165
diff
changeset
|
731 |
"Modified: / 28-03-2014 / 10:36:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 732 |
! |
733 |
||
734 |
application:anApplicationModel |
|
735 |
application := anApplicationModel. |
|
736 |
! |
|
737 |
||
738 |
checked |
|
739 |
||
740 |
^rule isComposite |
|
741 |
ifTrue:[self children anySatisfy:[:each|each checked]] |
|
742 |
ifFalse:[self application selectionIncludes: rule] |
|
743 |
||
744 |
"Modified: / 15-04-2010 / 20:59:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
745 |
"Modified: / 25-08-2010 / 13:29:33 / Jan Vrany <enter your email here>" |
|
746 |
! |
|
747 |
||
748 |
checked:aBoolean |
|
749 |
||
750 |
| app | |
|
751 |
app := self application. |
|
752 |
aBoolean |
|
753 |
ifTrue: [app selectionAdd: rule] |
|
754 |
ifFalse:[app selectionRemove: rule] |
|
755 |
||
756 |
"Modified: / 15-04-2010 / 19:06:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
757 |
"Modified: / 25-08-2010 / 13:35:29 / Jan Vrany <enter your email here>" |
|
758 |
! |
|
759 |
||
760 |
checkedRule |
|
761 |
||
762 |
self checked ifFalse:[^nil]. |
|
763 |
||
764 |
rule isComposite |
|
765 |
ifTrue: |
|
766 |
[^rule copy |
|
767 |
rules: (self children |
|
768 |
collect:[:entry|entry checkedRule] |
|
769 |
thenReject:[:rule|rule isNil]); |
|
770 |
yourself] |
|
771 |
ifFalse: |
|
772 |
[^rule] |
|
773 |
||
774 |
"Created: / 16-04-2010 / 12:06:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
775 |
! |
|
776 |
||
777 |
children |
|
14671 | 778 |
children ifNil:[ |
779 |
rule isComposite ifTrue: [ |
|
780 |
| app | |
|
781 |
||
782 |
app := self application. |
|
783 |
children := rule rules collect:[:eachRule | (app listEntryFor:eachRule) parent:self] |
|
784 |
] ifFalse: [ |
|
785 |
children := #() |
|
786 |
] |
|
787 |
]. |
|
10000 | 788 |
|
789 |
^ children |
|
790 |
||
791 |
"Created: / 25-07-2009 / 23:32:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
792 |
"Modified: / 15-04-2010 / 20:40:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
793 |
! |
|
794 |
||
795 |
failedClasses |
|
796 |
||
797 |
^rule failedClasses |
|
798 |
||
799 |
"Created: / 15-04-2010 / 19:10:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
800 |
! |
|
801 |
||
802 |
failedMethods |
|
803 |
||
804 |
^rule failedMethods |
|
805 |
||
806 |
"Created: / 15-04-2010 / 19:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
807 |
! |
|
808 |
||
809 |
failedMethodsInAnyOf: classes meta: meta |
|
810 |
||
811 |
^rule failedMethodsInAnyOf: classes meta: meta |
|
812 |
||
813 |
"Created: / 15-04-2010 / 19:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
814 |
! |
|
815 |
||
816 |
label |
|
16872 | 817 |
|s severity| |
818 |
||
819 |
s := rule displayString. |
|
820 |
(severity := rule severity) == #warning ifTrue:[ |
|
821 |
^ s withColor:Color orange. |
|
822 |
]. |
|
823 |
severity == #error ifTrue:[ |
|
824 |
^ s withColor:Color red. |
|
825 |
]. |
|
826 |
severity == #information ifFalse:[ |
|
827 |
self halt. |
|
828 |
]. |
|
829 |
^ s |
|
10000 | 830 |
|
831 |
"Modified: / 15-04-2010 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
832 |
! |
|
833 |
||
834 |
name |
|
835 |
||
836 |
^rule name |
|
837 |
||
838 |
"Created: / 15-04-2010 / 19:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
839 |
! |
|
840 |
||
841 |
rationale |
|
11315 | 842 |
^ rule rationaleWithAnchor |
10000 | 843 |
|
844 |
"Created: / 15-04-2010 / 19:10:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11315 | 845 |
"Modified: / 01-03-2012 / 20:58:50 / cg" |
10000 | 846 |
! |
847 |
||
11317 | 848 |
rationaleWithAnchor |
849 |
^ rule rationaleWithAnchor |
|
850 |
||
851 |
"Created: / 15-04-2010 / 19:10:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
852 |
"Modified: / 01-03-2012 / 20:58:50 / cg" |
|
853 |
"Created: / 02-03-2012 / 01:04:40 / cg" |
|
854 |
! |
|
855 |
||
10000 | 856 |
rule |
857 |
^ rule |
|
858 |
! |
|
859 |
||
860 |
rule:anRBLintRule |
|
861 |
rule := anRBLintRule. |
|
862 |
! |
|
863 |
||
864 |
x |
|
865 |
^ x ? 0 |
|
866 |
||
867 |
"Modified: / 15-04-2010 / 20:48:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
868 |
! ! |
|
869 |
||
870 |
!LintRuleList::ListEntry methodsFor:'displaying'! |
|
871 |
||
872 |
displayLabel:aLabel h:lH on:aGC x:newX y:y h:h |
|
16872 | 873 |
self displayLabel:aLabel h:lH on:aGC x:newX y:y h:h isHighlightedAsSelected:false |
10000 | 874 |
! |
875 |
||
15151 | 876 |
displayLabel:aLabel h:lH on:aGC x:newX y:y h:h isHighlightedAsSelected:isHighlightedAsSelected |
877 |
| cx icon app mode | |
|
878 |
||
879 |
cx := x := newX. |
|
880 |
app := self application. |
|
881 |
mode := app mode. |
|
882 |
mode ~~ #display ifTrue:[ |
|
883 |
mode == #select ifTrue:[ |
|
884 |
icon := self checked |
|
885 |
ifTrue:[app class checkedIcon] |
|
886 |
ifFalse:[app class uncheckedIcon]. |
|
887 |
] ifFalse:[ |
|
888 |
icon := self checked |
|
889 |
ifTrue:[app class checkedIconDisabled] |
|
890 |
ifFalse:[app class uncheckedIconDisabled]. |
|
891 |
]. |
|
892 |
icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2). |
|
893 |
cx := cx + 22."experimental value - this looks good" |
|
894 |
]. |
|
895 |
||
896 |
super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h isHighlightedAsSelected:isHighlightedAsSelected |
|
897 |
||
898 |
"Modified (format): / 07-03-2012 / 20:08:02 / cg" |
|
899 |
"Modified: / 08-10-2014 / 22:56:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
900 |
! |
|
901 |
||
13320
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
902 |
displayOn:aGCOrStream |
10000 | 903 |
|
13320
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
904 |
"/ what a kludge - Dolphin and Squeak mean: printOn: a stream; |
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
905 |
"/ ST/X (and some old ST80's) mean: draw-yourself on a GC. |
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
906 |
(aGCOrStream isStream) ifFalse:[ |
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
907 |
^ super displayOn:aGCOrStream |
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
908 |
]. |
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
909 |
|
13798 | 910 |
rule displayOn:aGCOrStream |
10000 | 911 |
|
912 |
"Created: / 15-04-2010 / 19:13:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
13798 | 913 |
"Modified: / 29-11-2013 / 12:59:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 914 |
! ! |
915 |
||
916 |
!LintRuleList class methodsFor:'documentation'! |
|
917 |
||
11300
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
918 |
version |
16426 | 919 |
^ '$Header$' |
11300
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
920 |
! |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
921 |
|
10000 | 922 |
version_CVS |
16426 | 923 |
^ '$Header$' |
10000 | 924 |
! |
925 |
||
926 |
version_SVN |
|
16426 | 927 |
^ '$Id$' |
10000 | 928 |
! ! |
13320
3dd1b4cb9c39
Refactor to implement #displayOn:aGcOrStream instead of #displayString
Stefan Vogel <sv@exept.de>
parents:
12035
diff
changeset
|
929 |