author | Claus Gittinger <cg@exept.de> |
Thu, 01 Mar 2012 12:03:46 +0100 | |
changeset 11300 | b9accf9080e4 |
parent 11297 | 7115aaff3d0a |
child 11301 | 99f40de78ada |
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 |
|
10000 | 4 |
|
10096 | 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. |
|
10000 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
BrowserList subclass:#LintRuleList |
|
31 |
instanceVariableNames:'listHolder filterHolder modeHolder listSelection listView |
|
32 |
initialSelectionHolder' |
|
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
category:'Interface-Lint' |
|
36 |
! |
|
37 |
||
38 |
HierarchicalItem subclass:#ListEntry |
|
39 |
instanceVariableNames:'x rule application' |
|
40 |
classVariableNames:'' |
|
41 |
poolDictionaries:'' |
|
42 |
privateIn:LintRuleList |
|
43 |
! |
|
44 |
||
45 |
!LintRuleList class methodsFor:'documentation'! |
|
46 |
||
47 |
copyright |
|
48 |
" |
|
10096 | 49 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
50 |
Copyright (c) 2009-2010 eXept Software AG |
|
51 |
||
52 |
Permission is hereby granted, free of charge, to any person |
|
53 |
obtaining a copy of this software and associated documentation |
|
54 |
files (the 'Software'), to deal in the Software without |
|
55 |
restriction, including without limitation the rights to use, |
|
56 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
57 |
copies of the Software, and to permit persons to whom the |
|
58 |
Software is furnished to do so, subject to the following |
|
59 |
conditions: |
|
10000 | 60 |
|
10096 | 61 |
The above copyright notice and this permission notice shall be |
62 |
included in all copies or substantial portions of the Software. |
|
63 |
||
64 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
65 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
66 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
67 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
68 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
69 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
70 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
71 |
OTHER DEALINGS IN THE SOFTWARE. |
|
10000 | 72 |
" |
73 |
! ! |
|
74 |
||
75 |
!LintRuleList class methodsFor:'interface specs'! |
|
76 |
||
77 |
windowSpec |
|
78 |
"This resource specification was automatically generated |
|
79 |
by the UIPainter of ST/X." |
|
80 |
||
81 |
"Do not manually edit this!! If it is corrupted, |
|
82 |
the UIPainter may not be able to read the specification." |
|
83 |
||
84 |
" |
|
85 |
UIPainter new openOnClass:Tools::LintRuleList andSelector:#windowSpec |
|
86 |
Tools::LintRuleList new openInterface:#windowSpec |
|
87 |
Tools::LintRuleList open |
|
88 |
" |
|
89 |
||
90 |
<resource: #canvas> |
|
91 |
||
92 |
^ |
|
93 |
#(FullSpec |
|
94 |
name: windowSpec |
|
95 |
window: |
|
96 |
(WindowSpec |
|
97 |
label: 'SmallLintRuleList' |
|
98 |
name: 'SmallLintRuleList' |
|
99 |
min: (Point 10 10) |
|
100 |
bounds: (Rectangle 0 0 300 300) |
|
101 |
) |
|
102 |
component: |
|
103 |
(SpecCollection |
|
104 |
collection: ( |
|
105 |
(InputFieldSpec |
|
106 |
name: 'RuleFilter' |
|
107 |
layout: (LayoutFrame 0 0 0 0 0 1 22 0) |
|
108 |
model: filterHolder |
|
109 |
immediateAccept: true |
|
110 |
acceptOnReturn: true |
|
111 |
acceptOnTab: true |
|
112 |
acceptOnPointerLeave: true |
|
113 |
emptyFieldReplacementText: 'Rule Search' |
|
114 |
) |
|
115 |
(SelectionInListModelViewSpec |
|
116 |
name: 'RuleList' |
|
117 |
layout: (LayoutFrame 0 0 23 0 0 1 0 1) |
|
118 |
model: listSelection |
|
119 |
menu: menuHolder |
|
120 |
hasHorizontalScrollBar: true |
|
121 |
hasVerticalScrollBar: true |
|
122 |
listModel: listHolder |
|
123 |
multipleSelectOk: true |
|
124 |
useIndex: false |
|
125 |
highlightMode: line |
|
126 |
postBuildCallback: postBuildList: |
|
127 |
) |
|
128 |
) |
|
129 |
||
130 |
) |
|
131 |
) |
|
132 |
! ! |
|
133 |
||
134 |
!LintRuleList class methodsFor:'menu specs'! |
|
135 |
||
136 |
menu |
|
137 |
"This resource specification was automatically generated |
|
138 |
by the MenuEditor of ST/X." |
|
139 |
||
140 |
"Do not manually edit this!! If it is corrupted, |
|
141 |
the MenuEditor may not be able to read the specification." |
|
142 |
||
143 |
" |
|
144 |
MenuEditor new openOnClass:Tools::SmalllintRuleList andSelector:#menu |
|
145 |
(Menu new fromLiteralArrayEncoding:(Tools::SmalllintRuleList menu)) startUp |
|
146 |
" |
|
147 |
||
148 |
<resource: #menu> |
|
149 |
||
150 |
^ |
|
151 |
#(Menu |
|
152 |
( |
|
153 |
(MenuItem |
|
154 |
label: '-' |
|
155 |
) |
|
156 |
(MenuItem |
|
157 |
label: 'Inspect' |
|
158 |
itemValue: menuInspect |
|
159 |
translateLabel: true |
|
160 |
) |
|
161 |
) |
|
162 |
nil |
|
163 |
nil |
|
164 |
) |
|
165 |
! ! |
|
166 |
||
167 |
!LintRuleList class methodsFor:'plugIn spec'! |
|
168 |
||
169 |
aspectSelectors |
|
170 |
"This resource specification was automatically generated |
|
171 |
by the UIPainter of ST/X." |
|
172 |
||
173 |
"Do not manually edit this. If it is corrupted, |
|
174 |
the UIPainter may not be able to read the specification." |
|
175 |
||
176 |
"Return a description of exported aspects; |
|
177 |
these can be connected to aspects of an embedding application |
|
178 |
(if this app is embedded in a subCanvas)." |
|
179 |
||
180 |
^ #( |
|
181 |
#inGeneratorHolder |
|
182 |
#modeHolder |
|
183 |
#outGeneratorHolder |
|
184 |
#selectionHolder |
|
11297
7115aaff3d0a
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10499
diff
changeset
|
185 |
#listSelection |
10000 | 186 |
). |
187 |
||
10499 | 188 |
"Modified: / 05-08-2011 / 00:09:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
11297
7115aaff3d0a
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10499
diff
changeset
|
189 |
"Modified: / 01-03-2012 / 10:48:43 / cg" |
10000 | 190 |
! ! |
191 |
||
192 |
!LintRuleList methodsFor:'accessing'! |
|
193 |
||
194 |
mode |
|
195 |
||
196 |
^self modeHolder value |
|
197 |
||
198 |
"Created: / 25-08-2010 / 11:33:51 / Jan Vrany <enter your email here>" |
|
199 |
! |
|
200 |
||
201 |
selection |
|
202 |
||
203 |
| sel | |
|
204 |
sel := self selectionHolder value. |
|
205 |
sel ifNil:[sel := Set new]. |
|
206 |
^sel |
|
207 |
||
208 |
"Created: / 25-08-2010 / 13:26:58 / Jan Vrany <enter your email here>" |
|
209 |
! |
|
210 |
||
211 |
selection: aCollectionOrNil |
|
212 |
||
213 |
| sel | |
|
214 |
sel := aCollectionOrNil |
|
215 |
ifNil:[Set new] |
|
216 |
ifNotNil:[aCollectionOrNil asSet]. |
|
217 |
||
218 |
self selectionHolder value: sel |
|
219 |
||
220 |
"Created: / 25-08-2010 / 13:28:43 / Jan Vrany <enter your email here>" |
|
221 |
"Modified: / 25-08-2010 / 15:29:35 / Jan Vrany <enter your email here>" |
|
222 |
! |
|
223 |
||
224 |
showCheckbox |
|
225 |
"return the value in 'showCheckboxHolder'" |
|
226 |
||
227 |
^ self modeHolder value == #select |
|
228 |
||
229 |
"Modified: / 15-04-2010 / 20:56:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
230 |
! ! |
|
231 |
||
232 |
!LintRuleList methodsFor:'aspects'! |
|
233 |
||
234 |
filterHolder |
|
235 |
"return/create the 'filterHolder' value holder (automatically generated)" |
|
236 |
||
237 |
filterHolder isNil ifTrue:[ |
|
238 |
filterHolder := ValueHolder new. |
|
239 |
filterHolder addDependent:self. |
|
240 |
]. |
|
241 |
^ filterHolder |
|
242 |
! |
|
243 |
||
244 |
filterHolder:something |
|
245 |
"set the 'filterHolder' value holder (automatically generated)" |
|
246 |
||
247 |
|oldValue newValue| |
|
248 |
||
249 |
filterHolder notNil ifTrue:[ |
|
250 |
oldValue := filterHolder value. |
|
251 |
filterHolder removeDependent:self. |
|
252 |
]. |
|
253 |
filterHolder := something. |
|
254 |
filterHolder notNil ifTrue:[ |
|
255 |
filterHolder addDependent:self. |
|
256 |
]. |
|
257 |
newValue := filterHolder value. |
|
258 |
oldValue ~~ newValue ifTrue:[ |
|
259 |
self update:#value with:newValue from:filterHolder. |
|
260 |
]. |
|
261 |
! |
|
262 |
||
263 |
listHolder |
|
264 |
"return/create the 'ruleList' value holder (automatically generated)" |
|
265 |
||
266 |
listHolder isNil ifTrue:[ |
|
267 |
listHolder := ValueHolder new. |
|
268 |
]. |
|
269 |
^ listHolder |
|
270 |
! |
|
271 |
||
272 |
listSelection |
|
273 |
"return/create the 'listSelection' value holder (automatically generated)" |
|
274 |
||
275 |
listSelection isNil ifTrue:[ |
|
276 |
listSelection := ValueHolder new. |
|
277 |
listSelection addDependent:self. |
|
278 |
]. |
|
279 |
^ listSelection |
|
280 |
! |
|
281 |
||
282 |
listSelection:something |
|
283 |
"set the 'listSelection' value holder (automatically generated)" |
|
284 |
||
285 |
|oldValue newValue| |
|
286 |
||
287 |
listSelection notNil ifTrue:[ |
|
288 |
oldValue := listSelection value. |
|
289 |
listSelection removeDependent:self. |
|
290 |
]. |
|
291 |
listSelection := something. |
|
292 |
listSelection notNil ifTrue:[ |
|
293 |
listSelection addDependent:self. |
|
294 |
]. |
|
295 |
newValue := listSelection value. |
|
296 |
oldValue ~~ newValue ifTrue:[ |
|
297 |
self update:#value with:newValue from:listSelection. |
|
298 |
]. |
|
299 |
! |
|
300 |
||
301 |
modeHolder |
|
302 |
||
303 |
modeHolder ifNil: |
|
304 |
[modeHolder := ValueHolder with: #display]. |
|
305 |
^modeHolder |
|
306 |
||
307 |
"Modified: / 15-04-2010 / 20:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
308 |
! |
|
309 |
||
310 |
modeHolder:aValueModel |
|
311 |
modeHolder := aValueModel. |
|
312 |
! |
|
313 |
||
314 |
selectedLintRules |
|
315 |
^ self selectionHolder |
|
316 |
||
317 |
"Created: / 02-02-2010 / 20:43:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
318 |
! |
|
319 |
||
320 |
selectedLintRules: anObject |
|
321 |
^ self selectionHolder: anObject |
|
322 |
||
323 |
"Created: / 02-02-2010 / 20:43:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
324 |
! ! |
|
325 |
||
326 |
!LintRuleList methodsFor:'change & update'! |
|
327 |
||
328 |
delayedUpdate:something with:aParameter from:changedObject |
|
329 |
"Invoked when an object that I depend upon sends a change notification." |
|
330 |
||
331 |
changedObject == filterHolder ifTrue:[ |
|
332 |
self updateList. |
|
333 |
^ self. |
|
334 |
]. |
|
335 |
||
336 |
(changedObject == listSelection) ifTrue:[ |
|
337 |
listValid ifFalse:[ |
|
338 |
self updateList. |
|
339 |
]. |
|
340 |
^ self selectionChanged |
|
341 |
]. |
|
342 |
||
10499 | 343 |
(changedObject == selectionHolder) ifTrue:[ |
344 |
^self. |
|
345 |
]. |
|
346 |
||
347 |
||
10000 | 348 |
super delayedUpdate:something with:aParameter from:changedObject |
349 |
||
350 |
"Created: / 26-08-2010 / 11:43:33 / Jan Vrany <enter your email here>" |
|
10499 | 351 |
"Modified: / 05-08-2011 / 00:17:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
352 |
! |
|
353 |
||
354 |
selectionChanged |
|
355 |
||
356 |
| selection | |
|
357 |
||
358 |
super selectionChanged. |
|
359 |
selection := self listSelection value. |
|
360 |
selection isEmptyOrNil ifTrue:[ |
|
361 |
self selectionHolder value: selection |
|
362 |
] ifFalse:[ |
|
363 |
self selectionHolder value: (selection collect:[:entry|entry rule]) |
|
364 |
] |
|
365 |
||
366 |
"Created: / 05-08-2011 / 00:10:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10000 | 367 |
! ! |
368 |
||
369 |
!LintRuleList methodsFor:'event processing'! |
|
370 |
||
371 |
buttonPress:button x:x y:y view:aView |
|
372 |
||
373 |
| itemIndex item | |
|
374 |
||
375 |
button ~= 1 ifTrue:[^aView buttonPress:button x:x y:y]. |
|
376 |
self modeHolder value == #display ifTrue:[^aView buttonPress:button x:x y:y]. |
|
377 |
||
378 |
itemIndex := aView yVisibleToLineNr:y. |
|
379 |
itemIndex ifNil:[^self]. |
|
380 |
itemIndex == 0 ifTrue:[^self]. |
|
381 |
itemIndex > aView list size ifTrue:[^self]. |
|
382 |
item := aView list at: itemIndex. |
|
383 |
||
384 |
((aView left + x) between: (item x) and: (item x + 16)) |
|
385 |
ifFalse:[^aView buttonPress:button x:x y:y]. |
|
386 |
||
387 |
item checked: item checked not. |
|
388 |
aView invalidate |
|
389 |
||
390 |
"Created: / 08-12-2009 / 14:12:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
391 |
"Modified: / 15-04-2010 / 21:05:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
392 |
! |
|
393 |
||
394 |
handlesButtonPress:button inView:aView |
|
395 |
||
396 |
^listView == aView |
|
397 |
||
398 |
"Created: / 08-12-2009 / 14:08:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
399 |
"Modified: / 15-04-2010 / 20:19:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
400 |
! ! |
|
401 |
||
402 |
!LintRuleList methodsFor:'generators'! |
|
403 |
||
404 |
makeGenerator |
|
405 |
||
406 |
^self modeHolder value == #display |
|
407 |
ifTrue: |
|
408 |
[Iterator on: |
|
409 |
[:whatToDo| |
|
410 |
self listSelection value ? #() do: |
|
411 |
[:each|each failedClasses do:whatToDo]]] |
|
412 |
ifFalse: |
|
413 |
[Iterator on: |
|
414 |
[:whatToDo| |
|
415 |
self selection do:[:rule| whatToDo value: rule]]]. |
|
416 |
||
417 |
"Modified: / 16-04-2010 / 12:13:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
418 |
"Modified: / 25-08-2010 / 13:39:51 / Jan Vrany <enter your email here>" |
|
419 |
! ! |
|
420 |
||
421 |
!LintRuleList methodsFor:'hooks'! |
|
422 |
||
423 |
commonPostOpen |
|
424 |
||
425 |
self updateOutputGenerator. |
|
426 |
||
427 |
"Created: / 16-04-2010 / 11:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
428 |
! |
|
429 |
||
430 |
postBuildList: aView |
|
431 |
||
432 |
listView := aView scrolledView. |
|
433 |
listView delegate: self. |
|
434 |
||
435 |
"Created: / 08-12-2009 / 14:10:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
436 |
! ! |
|
437 |
||
438 |
!LintRuleList methodsFor:'initialization'! |
|
439 |
||
440 |
initialize |
|
441 |
||
442 |
super initialize. |
|
443 |
menuHolder := ValueHolder with: (Menu decodeFromLiteralArray: (self menuFor: #menu)). |
|
444 |
self selection: Set new. |
|
445 |
||
446 |
"Modified: / 25-08-2010 / 15:24:45 / Jan Vrany <enter your email here>" |
|
447 |
! ! |
|
448 |
||
449 |
!LintRuleList methodsFor:'menu actions'! |
|
450 |
||
451 |
menuInspect |
|
452 |
||
453 |
| selection | |
|
454 |
selection := self listSelection value. |
|
455 |
selection size = 1 ifTrue:[selection anyOne rule inspect]. |
|
456 |
selection size > 1 ifTrue:[(selection collect:[:e|e rule]) inspect]. |
|
457 |
||
458 |
"Modified: / 25-08-2010 / 14:25:24 / Jan Vrany <enter your email here>" |
|
459 |
! ! |
|
460 |
||
461 |
!LintRuleList methodsFor:'private'! |
|
462 |
||
463 |
listEntryFor: anRBLintRule |
|
464 |
||
465 |
| entry | |
|
466 |
entry := ListEntry new |
|
467 |
rule: anRBLintRule; |
|
468 |
application: self; |
|
469 |
expand; |
|
470 |
yourself. |
|
471 |
^entry |
|
472 |
||
473 |
"Created: / 15-04-2010 / 18:59:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
474 |
"Modified: / 25-08-2010 / 14:15:46 / Jan Vrany <enter your email here>" |
|
475 |
! |
|
476 |
||
477 |
makeDependent |
|
478 |
||
479 |
"nothing to do" |
|
480 |
||
481 |
"Created: / 02-02-2010 / 20:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
482 |
! |
|
483 |
||
484 |
makeIndependent |
|
485 |
||
486 |
"nothing to do" |
|
487 |
||
488 |
"Created: / 02-02-2010 / 20:23:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
489 |
! |
|
490 |
||
491 |
rules: rules includes: rule |
|
492 |
||
493 |
^rules contains: |
|
494 |
[:each| |
|
495 |
each class == rule class and: |
|
496 |
[each name = rule name]] |
|
497 |
||
498 |
"Created: / 26-08-2010 / 12:04:04 / Jan Vrany <enter your email here>" |
|
499 |
! |
|
500 |
||
501 |
updateList |
|
502 |
|generator filterS newList| |
|
503 |
||
504 |
generator := self inGeneratorHolder value. |
|
505 |
filterS := self filterHolder value. |
|
10455 | 506 |
filterS notEmptyOrNil ifTrue:[ |
507 |
(filterS startsWith: $*) ifFalse:[filterS := '*' , filterS]. |
|
508 |
(filterS endsWith: $*) ifFalse:[filterS := filterS , '*'] |
|
509 |
]. |
|
510 |
(generator isNil and:[self mode == #display]) ifTrue:[ |
|
511 |
generator := RBCompositeLintRule allRules flattened |
|
512 |
]. |
|
10000 | 513 |
newList := OrderedCollection new. |
514 |
generator do:[:rule | |
|
10455 | 515 |
rule flattened do: [:rule| |
516 |
(filterS isEmptyOrNil or:[rule name matches: filterS]) |
|
517 |
ifTrue:[ |
|
518 |
newList add: (self listEntryFor:rule) |
|
519 |
] |
|
520 |
] |
|
521 |
]. |
|
10000 | 522 |
self listHolder value:newList. |
523 |
listValid := true. |
|
524 |
||
525 |
"Modified: / 22-07-2009 / 15:58:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
526 |
"Modified: / 16-04-2010 / 11:38:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
527 |
"Modified: / 25-08-2010 / 13:35:58 / Jan Vrany <enter your email here>" |
|
10455 | 528 |
"Modified: / 04-08-2011 / 20:50:20 / cg" |
10000 | 529 |
! ! |
530 |
||
10499 | 531 |
!LintRuleList methodsFor:'queries'! |
532 |
||
533 |
supportsSearch |
|
534 |
||
535 |
^false |
|
536 |
||
537 |
"Created: / 04-08-2011 / 23:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
538 |
! ! |
|
539 |
||
10000 | 540 |
!LintRuleList methodsFor:'selection'! |
541 |
||
542 |
selectionAdd: rule |
|
543 |
||
544 |
self selection: |
|
545 |
(self selection addAll: rule flattened; yourself) |
|
546 |
||
547 |
"Created: / 25-08-2010 / 13:34:57 / Jan Vrany <enter your email here>" |
|
548 |
! |
|
549 |
||
550 |
selectionIncludes: rule |
|
551 |
||
552 |
^self rules: self selection includes: rule |
|
553 |
||
554 |
"Created: / 25-08-2010 / 13:30:14 / Jan Vrany <enter your email here>" |
|
555 |
"Modified: / 26-08-2010 / 12:04:19 / Jan Vrany <enter your email here>" |
|
556 |
! |
|
557 |
||
558 |
selectionRemove: rule |
|
559 |
||
560 |
| sel rules | |
|
561 |
sel := self selection. |
|
562 |
rules := rule flattened. |
|
563 |
sel := sel reject: |
|
564 |
[:each|self rules: rules includes: each]. |
|
565 |
self selection: sel |
|
566 |
||
567 |
"Created: / 25-08-2010 / 13:35:08 / Jan Vrany <enter your email here>" |
|
568 |
"Modified: / 26-08-2010 / 12:05:06 / Jan Vrany <enter your email here>" |
|
569 |
! ! |
|
570 |
||
571 |
!LintRuleList::ListEntry class methodsFor:'instance creation'! |
|
572 |
||
573 |
change: aChange |
|
574 |
||
575 |
^self new change: aChange |
|
576 |
||
577 |
"Created: / 24-07-2009 / 22:43:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
578 |
! |
|
579 |
||
580 |
change: aChange application: anApplicationModel |
|
581 |
||
582 |
^self new change: aChange; application: anApplicationModel |
|
583 |
||
584 |
"Created: / 05-12-2009 / 14:16:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
585 |
! |
|
586 |
||
587 |
change: aChange parent: aChangeList |
|
588 |
||
589 |
^self new change: aChange; parent: aChangeList |
|
590 |
||
591 |
"Created: / 25-07-2009 / 23:33:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
592 |
! ! |
|
593 |
||
594 |
!LintRuleList::ListEntry methodsFor:'accessing'! |
|
595 |
||
596 |
application |
|
597 |
^ application ifNil:[super application] |
|
598 |
||
599 |
"Modified: / 15-04-2010 / 19:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
600 |
! |
|
601 |
||
602 |
application:anApplicationModel |
|
603 |
application := anApplicationModel. |
|
604 |
! |
|
605 |
||
606 |
checked |
|
607 |
||
608 |
^rule isComposite |
|
609 |
ifTrue:[self children anySatisfy:[:each|each checked]] |
|
610 |
ifFalse:[self application selectionIncludes: rule] |
|
611 |
||
612 |
"Modified: / 15-04-2010 / 20:59:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
613 |
"Modified: / 25-08-2010 / 13:29:33 / Jan Vrany <enter your email here>" |
|
614 |
! |
|
615 |
||
616 |
checked:aBoolean |
|
617 |
||
618 |
| app | |
|
619 |
app := self application. |
|
620 |
aBoolean |
|
621 |
ifTrue: [app selectionAdd: rule] |
|
622 |
ifFalse:[app selectionRemove: rule] |
|
623 |
||
624 |
"Modified: / 15-04-2010 / 19:06:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
625 |
"Modified: / 25-08-2010 / 13:35:29 / Jan Vrany <enter your email here>" |
|
626 |
! |
|
627 |
||
628 |
checkedRule |
|
629 |
||
630 |
self checked ifFalse:[^nil]. |
|
631 |
||
632 |
rule isComposite |
|
633 |
ifTrue: |
|
634 |
[^rule copy |
|
635 |
rules: (self children |
|
636 |
collect:[:entry|entry checkedRule] |
|
637 |
thenReject:[:rule|rule isNil]); |
|
638 |
yourself] |
|
639 |
ifFalse: |
|
640 |
[^rule] |
|
641 |
||
642 |
"Created: / 16-04-2010 / 12:06:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
643 |
! |
|
644 |
||
645 |
children |
|
646 |
children ifNil: |
|
647 |
[| app | |
|
648 |
rule isComposite |
|
649 |
ifTrue: |
|
650 |
[app := self application. |
|
651 |
children := rule rules collect:[:rule | (app listEntryFor:rule) parent:self]] |
|
652 |
ifFalse: |
|
653 |
[children := #()]]. |
|
654 |
||
655 |
^ children |
|
656 |
||
657 |
"Created: / 25-07-2009 / 23:32:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
658 |
"Modified: / 15-04-2010 / 20:40:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
659 |
! |
|
660 |
||
661 |
failedClasses |
|
662 |
||
663 |
^rule failedClasses |
|
664 |
||
665 |
"Created: / 15-04-2010 / 19:10:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
666 |
! |
|
667 |
||
668 |
failedMethods |
|
669 |
||
670 |
^rule failedMethods |
|
671 |
||
672 |
"Created: / 15-04-2010 / 19:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
673 |
! |
|
674 |
||
675 |
failedMethodsInAnyOf: classes meta: meta |
|
676 |
||
677 |
^rule failedMethodsInAnyOf: classes meta: meta |
|
678 |
||
679 |
"Created: / 15-04-2010 / 19:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
680 |
! |
|
681 |
||
682 |
label |
|
683 |
||
684 |
^rule displayString. |
|
685 |
||
686 |
"Modified: / 15-04-2010 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
687 |
! |
|
688 |
||
689 |
name |
|
690 |
||
691 |
^rule name |
|
692 |
||
693 |
"Created: / 15-04-2010 / 19:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
694 |
! |
|
695 |
||
696 |
rationale |
|
697 |
||
11300
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
698 |
^ ' |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
699 |
<b>',rule name,'</b> |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
700 |
<p>', |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
701 |
rule rationale, |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
702 |
'<p> |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
703 |
Class: <A ACTION="',rule className,' browse">',rule className,'</A>' |
10000 | 704 |
|
705 |
"Created: / 15-04-2010 / 19:10:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11300
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
706 |
"Modified: / 01-03-2012 / 11:58:57 / cg" |
10000 | 707 |
! |
708 |
||
709 |
rule |
|
710 |
^ rule |
|
711 |
! |
|
712 |
||
713 |
rule:anRBLintRule |
|
714 |
rule := anRBLintRule. |
|
715 |
! |
|
716 |
||
717 |
x |
|
718 |
^ x ? 0 |
|
719 |
||
720 |
"Modified: / 15-04-2010 / 20:48:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
721 |
! ! |
|
722 |
||
723 |
!LintRuleList::ListEntry methodsFor:'displaying'! |
|
724 |
||
725 |
displayLabel:aLabel h:lH on:aGC x:newX y:y h:h |
|
726 |
||
727 |
| cx icon app | |
|
728 |
cx := x := newX. |
|
729 |
(app := self application) showCheckbox ifTrue: |
|
730 |
[icon := self checked ifTrue:[app class checkedIcon] ifFalse:[app class uncheckedIcon]. |
|
731 |
icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2). |
|
732 |
cx := cx + 22."experimental value - this looks good"]. |
|
733 |
||
734 |
super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h |
|
735 |
||
736 |
"Modified: / 15-04-2010 / 20:14:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
737 |
! |
|
738 |
||
739 |
displayString |
|
740 |
||
741 |
^rule displayString |
|
742 |
||
743 |
"Created: / 15-04-2010 / 19:13:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
744 |
! ! |
|
745 |
||
746 |
!LintRuleList class methodsFor:'documentation'! |
|
747 |
||
11300
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
748 |
version |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
749 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleList.st,v 1.6 2012-03-01 11:03:46 cg Exp $' |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
750 |
! |
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
751 |
|
10000 | 752 |
version_CVS |
11300
b9accf9080e4
better rationale (link to class)
Claus Gittinger <cg@exept.de>
parents:
11297
diff
changeset
|
753 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleList.st,v 1.6 2012-03-01 11:03:46 cg Exp $' |
10000 | 754 |
! |
755 |
||
756 |
version_SVN |
|
757 |
^ '§Id: Tools__LintRuleList.st 7619 2010-08-26 10:15:15Z vranyj1 §' |
|
758 |
! ! |