author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sun, 29 Jan 2012 12:53:39 +0000 | |
branch | jv |
changeset 12123 | 4bde08cebd48 |
parent 10499 | 8b80e5841210 |
child 12128 | a7ff7d66ee85 |
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 |
|
185 |
). |
|
186 |
||
10499 | 187 |
"Modified: / 05-08-2011 / 00:09:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
10000 | 188 |
! ! |
189 |
||
190 |
!LintRuleList methodsFor:'accessing'! |
|
191 |
||
192 |
mode |
|
193 |
||
194 |
^self modeHolder value |
|
195 |
||
196 |
"Created: / 25-08-2010 / 11:33:51 / Jan Vrany <enter your email here>" |
|
197 |
! |
|
198 |
||
199 |
selection |
|
200 |
||
201 |
| sel | |
|
202 |
sel := self selectionHolder value. |
|
203 |
sel ifNil:[sel := Set new]. |
|
204 |
^sel |
|
205 |
||
206 |
"Created: / 25-08-2010 / 13:26:58 / Jan Vrany <enter your email here>" |
|
207 |
! |
|
208 |
||
209 |
selection: aCollectionOrNil |
|
210 |
||
211 |
| sel | |
|
212 |
sel := aCollectionOrNil |
|
213 |
ifNil:[Set new] |
|
214 |
ifNotNil:[aCollectionOrNil asSet]. |
|
215 |
||
216 |
self selectionHolder value: sel |
|
217 |
||
218 |
"Created: / 25-08-2010 / 13:28:43 / Jan Vrany <enter your email here>" |
|
219 |
"Modified: / 25-08-2010 / 15:29:35 / Jan Vrany <enter your email here>" |
|
220 |
! |
|
221 |
||
222 |
showCheckbox |
|
223 |
"return the value in 'showCheckboxHolder'" |
|
224 |
||
225 |
^ self modeHolder value == #select |
|
226 |
||
227 |
"Modified: / 15-04-2010 / 20:56:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
228 |
! ! |
|
229 |
||
230 |
!LintRuleList methodsFor:'aspects'! |
|
231 |
||
232 |
filterHolder |
|
233 |
"return/create the 'filterHolder' value holder (automatically generated)" |
|
234 |
||
235 |
filterHolder isNil ifTrue:[ |
|
236 |
filterHolder := ValueHolder new. |
|
237 |
filterHolder addDependent:self. |
|
238 |
]. |
|
239 |
^ filterHolder |
|
240 |
! |
|
241 |
||
242 |
filterHolder:something |
|
243 |
"set the 'filterHolder' value holder (automatically generated)" |
|
244 |
||
245 |
|oldValue newValue| |
|
246 |
||
247 |
filterHolder notNil ifTrue:[ |
|
248 |
oldValue := filterHolder value. |
|
249 |
filterHolder removeDependent:self. |
|
250 |
]. |
|
251 |
filterHolder := something. |
|
252 |
filterHolder notNil ifTrue:[ |
|
253 |
filterHolder addDependent:self. |
|
254 |
]. |
|
255 |
newValue := filterHolder value. |
|
256 |
oldValue ~~ newValue ifTrue:[ |
|
257 |
self update:#value with:newValue from:filterHolder. |
|
258 |
]. |
|
259 |
! |
|
260 |
||
261 |
listHolder |
|
262 |
"return/create the 'ruleList' value holder (automatically generated)" |
|
263 |
||
264 |
listHolder isNil ifTrue:[ |
|
265 |
listHolder := ValueHolder new. |
|
266 |
]. |
|
267 |
^ listHolder |
|
268 |
! |
|
269 |
||
270 |
listSelection |
|
271 |
"return/create the 'listSelection' value holder (automatically generated)" |
|
272 |
||
273 |
listSelection isNil ifTrue:[ |
|
274 |
listSelection := ValueHolder new. |
|
275 |
listSelection addDependent:self. |
|
276 |
]. |
|
277 |
^ listSelection |
|
278 |
! |
|
279 |
||
280 |
listSelection:something |
|
281 |
"set the 'listSelection' value holder (automatically generated)" |
|
282 |
||
283 |
|oldValue newValue| |
|
284 |
||
285 |
listSelection notNil ifTrue:[ |
|
286 |
oldValue := listSelection value. |
|
287 |
listSelection removeDependent:self. |
|
288 |
]. |
|
289 |
listSelection := something. |
|
290 |
listSelection notNil ifTrue:[ |
|
291 |
listSelection addDependent:self. |
|
292 |
]. |
|
293 |
newValue := listSelection value. |
|
294 |
oldValue ~~ newValue ifTrue:[ |
|
295 |
self update:#value with:newValue from:listSelection. |
|
296 |
]. |
|
297 |
! |
|
298 |
||
299 |
modeHolder |
|
300 |
||
301 |
modeHolder ifNil: |
|
302 |
[modeHolder := ValueHolder with: #display]. |
|
303 |
^modeHolder |
|
304 |
||
305 |
"Modified: / 15-04-2010 / 20:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
306 |
! |
|
307 |
||
308 |
modeHolder:aValueModel |
|
309 |
modeHolder := aValueModel. |
|
310 |
! |
|
311 |
||
312 |
selectedLintRules |
|
313 |
^ self selectionHolder |
|
314 |
||
315 |
"Created: / 02-02-2010 / 20:43:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
316 |
! |
|
317 |
||
318 |
selectedLintRules: anObject |
|
319 |
^ self selectionHolder: anObject |
|
320 |
||
321 |
"Created: / 02-02-2010 / 20:43:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
322 |
! ! |
|
323 |
||
324 |
!LintRuleList methodsFor:'change & update'! |
|
325 |
||
326 |
delayedUpdate:something with:aParameter from:changedObject |
|
327 |
"Invoked when an object that I depend upon sends a change notification." |
|
328 |
||
329 |
changedObject == filterHolder ifTrue:[ |
|
330 |
self updateList. |
|
331 |
^ self. |
|
332 |
]. |
|
333 |
||
334 |
(changedObject == listSelection) ifTrue:[ |
|
335 |
listValid ifFalse:[ |
|
336 |
self updateList. |
|
337 |
]. |
|
338 |
^ self selectionChanged |
|
339 |
]. |
|
340 |
||
10499 | 341 |
(changedObject == selectionHolder) ifTrue:[ |
342 |
^self. |
|
343 |
]. |
|
344 |
||
345 |
||
10000 | 346 |
super delayedUpdate:something with:aParameter from:changedObject |
347 |
||
348 |
"Created: / 26-08-2010 / 11:43:33 / Jan Vrany <enter your email here>" |
|
10499 | 349 |
"Modified: / 05-08-2011 / 00:17:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
350 |
! |
|
351 |
||
352 |
selectionChanged |
|
353 |
||
354 |
| selection | |
|
355 |
||
356 |
super selectionChanged. |
|
357 |
selection := self listSelection value. |
|
358 |
selection isEmptyOrNil ifTrue:[ |
|
359 |
self selectionHolder value: selection |
|
360 |
] ifFalse:[ |
|
361 |
self selectionHolder value: (selection collect:[:entry|entry rule]) |
|
362 |
] |
|
363 |
||
364 |
"Created: / 05-08-2011 / 00:10:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10000 | 365 |
! ! |
366 |
||
367 |
!LintRuleList methodsFor:'event processing'! |
|
368 |
||
369 |
buttonPress:button x:x y:y view:aView |
|
370 |
||
371 |
| itemIndex item | |
|
372 |
||
373 |
button ~= 1 ifTrue:[^aView buttonPress:button x:x y:y]. |
|
374 |
self modeHolder value == #display ifTrue:[^aView buttonPress:button x:x y:y]. |
|
375 |
||
376 |
itemIndex := aView yVisibleToLineNr:y. |
|
377 |
itemIndex ifNil:[^self]. |
|
378 |
itemIndex == 0 ifTrue:[^self]. |
|
379 |
itemIndex > aView list size ifTrue:[^self]. |
|
380 |
item := aView list at: itemIndex. |
|
381 |
||
382 |
((aView left + x) between: (item x) and: (item x + 16)) |
|
383 |
ifFalse:[^aView buttonPress:button x:x y:y]. |
|
384 |
||
385 |
item checked: item checked not. |
|
386 |
aView invalidate |
|
387 |
||
388 |
"Created: / 08-12-2009 / 14:12:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
389 |
"Modified: / 15-04-2010 / 21:05:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
390 |
! |
|
391 |
||
392 |
handlesButtonPress:button inView:aView |
|
393 |
||
394 |
^listView == aView |
|
395 |
||
396 |
"Created: / 08-12-2009 / 14:08:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
397 |
"Modified: / 15-04-2010 / 20:19:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
398 |
! ! |
|
399 |
||
400 |
!LintRuleList methodsFor:'generators'! |
|
401 |
||
402 |
makeGenerator |
|
403 |
||
404 |
^self modeHolder value == #display |
|
405 |
ifTrue: |
|
406 |
[Iterator on: |
|
407 |
[:whatToDo| |
|
408 |
self listSelection value ? #() do: |
|
409 |
[:each|each failedClasses do:whatToDo]]] |
|
410 |
ifFalse: |
|
411 |
[Iterator on: |
|
412 |
[:whatToDo| |
|
413 |
self selection do:[:rule| whatToDo value: rule]]]. |
|
414 |
||
415 |
"Modified: / 16-04-2010 / 12:13:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
416 |
"Modified: / 25-08-2010 / 13:39:51 / Jan Vrany <enter your email here>" |
|
417 |
! ! |
|
418 |
||
419 |
!LintRuleList methodsFor:'hooks'! |
|
420 |
||
421 |
commonPostOpen |
|
422 |
||
423 |
self updateOutputGenerator. |
|
424 |
||
425 |
"Created: / 16-04-2010 / 11:53:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
426 |
! |
|
427 |
||
428 |
postBuildList: aView |
|
429 |
||
430 |
listView := aView scrolledView. |
|
431 |
listView delegate: self. |
|
432 |
||
433 |
"Created: / 08-12-2009 / 14:10:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
434 |
! ! |
|
435 |
||
436 |
!LintRuleList methodsFor:'initialization'! |
|
437 |
||
438 |
initialize |
|
439 |
||
440 |
super initialize. |
|
441 |
menuHolder := ValueHolder with: (Menu decodeFromLiteralArray: (self menuFor: #menu)). |
|
442 |
self selection: Set new. |
|
443 |
||
444 |
"Modified: / 25-08-2010 / 15:24:45 / Jan Vrany <enter your email here>" |
|
445 |
! ! |
|
446 |
||
447 |
!LintRuleList methodsFor:'menu actions'! |
|
448 |
||
449 |
menuInspect |
|
450 |
||
451 |
| selection | |
|
452 |
selection := self listSelection value. |
|
453 |
selection size = 1 ifTrue:[selection anyOne rule inspect]. |
|
454 |
selection size > 1 ifTrue:[(selection collect:[:e|e rule]) inspect]. |
|
455 |
||
456 |
"Modified: / 25-08-2010 / 14:25:24 / Jan Vrany <enter your email here>" |
|
457 |
! ! |
|
458 |
||
459 |
!LintRuleList methodsFor:'private'! |
|
460 |
||
461 |
listEntryFor: anRBLintRule |
|
462 |
||
463 |
| entry | |
|
464 |
entry := ListEntry new |
|
465 |
rule: anRBLintRule; |
|
466 |
application: self; |
|
467 |
expand; |
|
468 |
yourself. |
|
469 |
^entry |
|
470 |
||
471 |
"Created: / 15-04-2010 / 18:59:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
472 |
"Modified: / 25-08-2010 / 14:15:46 / Jan Vrany <enter your email here>" |
|
473 |
! |
|
474 |
||
475 |
makeDependent |
|
476 |
||
477 |
"nothing to do" |
|
478 |
||
479 |
"Created: / 02-02-2010 / 20:23:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
480 |
! |
|
481 |
||
482 |
makeIndependent |
|
483 |
||
484 |
"nothing to do" |
|
485 |
||
486 |
"Created: / 02-02-2010 / 20:23:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
487 |
! |
|
488 |
||
489 |
rules: rules includes: rule |
|
490 |
||
491 |
^rules contains: |
|
492 |
[:each| |
|
493 |
each class == rule class and: |
|
494 |
[each name = rule name]] |
|
495 |
||
496 |
"Created: / 26-08-2010 / 12:04:04 / Jan Vrany <enter your email here>" |
|
497 |
! |
|
498 |
||
499 |
updateList |
|
500 |
|generator filterS newList| |
|
501 |
||
502 |
generator := self inGeneratorHolder value. |
|
503 |
filterS := self filterHolder value. |
|
10455 | 504 |
filterS notEmptyOrNil ifTrue:[ |
505 |
(filterS startsWith: $*) ifFalse:[filterS := '*' , filterS]. |
|
506 |
(filterS endsWith: $*) ifFalse:[filterS := filterS , '*'] |
|
507 |
]. |
|
508 |
(generator isNil and:[self mode == #display]) ifTrue:[ |
|
509 |
generator := RBCompositeLintRule allRules flattened |
|
510 |
]. |
|
10000 | 511 |
newList := OrderedCollection new. |
512 |
generator do:[:rule | |
|
10455 | 513 |
rule flattened do: [:rule| |
514 |
(filterS isEmptyOrNil or:[rule name matches: filterS]) |
|
515 |
ifTrue:[ |
|
516 |
newList add: (self listEntryFor:rule) |
|
517 |
] |
|
518 |
] |
|
519 |
]. |
|
10000 | 520 |
self listHolder value:newList. |
521 |
listValid := true. |
|
522 |
||
523 |
"Modified: / 22-07-2009 / 15:58:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
524 |
"Modified: / 16-04-2010 / 11:38:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
525 |
"Modified: / 25-08-2010 / 13:35:58 / Jan Vrany <enter your email here>" |
|
10455 | 526 |
"Modified: / 04-08-2011 / 20:50:20 / cg" |
10000 | 527 |
! ! |
528 |
||
10499 | 529 |
!LintRuleList methodsFor:'queries'! |
530 |
||
531 |
supportsSearch |
|
532 |
||
533 |
^false |
|
534 |
||
535 |
"Created: / 04-08-2011 / 23:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
536 |
! ! |
|
537 |
||
10000 | 538 |
!LintRuleList methodsFor:'selection'! |
539 |
||
540 |
selectionAdd: rule |
|
541 |
||
542 |
self selection: |
|
543 |
(self selection addAll: rule flattened; yourself) |
|
544 |
||
545 |
"Created: / 25-08-2010 / 13:34:57 / Jan Vrany <enter your email here>" |
|
546 |
! |
|
547 |
||
548 |
selectionIncludes: rule |
|
549 |
||
550 |
^self rules: self selection includes: rule |
|
551 |
||
552 |
"Created: / 25-08-2010 / 13:30:14 / Jan Vrany <enter your email here>" |
|
553 |
"Modified: / 26-08-2010 / 12:04:19 / Jan Vrany <enter your email here>" |
|
554 |
! |
|
555 |
||
556 |
selectionRemove: rule |
|
557 |
||
558 |
| sel rules | |
|
559 |
sel := self selection. |
|
560 |
rules := rule flattened. |
|
561 |
sel := sel reject: |
|
562 |
[:each|self rules: rules includes: each]. |
|
563 |
self selection: sel |
|
564 |
||
565 |
"Created: / 25-08-2010 / 13:35:08 / Jan Vrany <enter your email here>" |
|
566 |
"Modified: / 26-08-2010 / 12:05:06 / Jan Vrany <enter your email here>" |
|
567 |
! ! |
|
568 |
||
569 |
!LintRuleList::ListEntry class methodsFor:'instance creation'! |
|
570 |
||
571 |
change: aChange |
|
572 |
||
573 |
^self new change: aChange |
|
574 |
||
575 |
"Created: / 24-07-2009 / 22:43:41 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
576 |
! |
|
577 |
||
578 |
change: aChange application: anApplicationModel |
|
579 |
||
580 |
^self new change: aChange; application: anApplicationModel |
|
581 |
||
582 |
"Created: / 05-12-2009 / 14:16:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
583 |
! |
|
584 |
||
585 |
change: aChange parent: aChangeList |
|
586 |
||
587 |
^self new change: aChange; parent: aChangeList |
|
588 |
||
589 |
"Created: / 25-07-2009 / 23:33:00 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
590 |
! ! |
|
591 |
||
592 |
!LintRuleList::ListEntry methodsFor:'accessing'! |
|
593 |
||
594 |
application |
|
595 |
^ application ifNil:[super application] |
|
596 |
||
597 |
"Modified: / 15-04-2010 / 19:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
598 |
! |
|
599 |
||
600 |
application:anApplicationModel |
|
601 |
application := anApplicationModel. |
|
602 |
! |
|
603 |
||
604 |
checked |
|
605 |
||
606 |
^rule isComposite |
|
607 |
ifTrue:[self children anySatisfy:[:each|each checked]] |
|
608 |
ifFalse:[self application selectionIncludes: rule] |
|
609 |
||
610 |
"Modified: / 15-04-2010 / 20:59:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
611 |
"Modified: / 25-08-2010 / 13:29:33 / Jan Vrany <enter your email here>" |
|
612 |
! |
|
613 |
||
614 |
checked:aBoolean |
|
615 |
||
616 |
| app | |
|
617 |
app := self application. |
|
618 |
aBoolean |
|
619 |
ifTrue: [app selectionAdd: rule] |
|
620 |
ifFalse:[app selectionRemove: rule] |
|
621 |
||
622 |
"Modified: / 15-04-2010 / 19:06:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
623 |
"Modified: / 25-08-2010 / 13:35:29 / Jan Vrany <enter your email here>" |
|
624 |
! |
|
625 |
||
626 |
checkedRule |
|
627 |
||
628 |
self checked ifFalse:[^nil]. |
|
629 |
||
630 |
rule isComposite |
|
631 |
ifTrue: |
|
632 |
[^rule copy |
|
633 |
rules: (self children |
|
634 |
collect:[:entry|entry checkedRule] |
|
635 |
thenReject:[:rule|rule isNil]); |
|
636 |
yourself] |
|
637 |
ifFalse: |
|
638 |
[^rule] |
|
639 |
||
640 |
"Created: / 16-04-2010 / 12:06:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
641 |
! |
|
642 |
||
643 |
children |
|
644 |
children ifNil: |
|
645 |
[| app | |
|
646 |
rule isComposite |
|
647 |
ifTrue: |
|
648 |
[app := self application. |
|
649 |
children := rule rules collect:[:rule | (app listEntryFor:rule) parent:self]] |
|
650 |
ifFalse: |
|
651 |
[children := #()]]. |
|
652 |
||
653 |
^ children |
|
654 |
||
655 |
"Created: / 25-07-2009 / 23:32:39 / Jan Vrany <vranyj1@fel.cvut.cz>" |
|
656 |
"Modified: / 15-04-2010 / 20:40:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
657 |
! |
|
658 |
||
659 |
failedClasses |
|
660 |
||
661 |
^rule failedClasses |
|
662 |
||
663 |
"Created: / 15-04-2010 / 19:10:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
664 |
! |
|
665 |
||
666 |
failedMethods |
|
667 |
||
668 |
^rule failedMethods |
|
669 |
||
670 |
"Created: / 15-04-2010 / 19:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
671 |
! |
|
672 |
||
673 |
failedMethodsInAnyOf: classes meta: meta |
|
674 |
||
675 |
^rule failedMethodsInAnyOf: classes meta: meta |
|
676 |
||
677 |
"Created: / 15-04-2010 / 19:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
678 |
! |
|
679 |
||
680 |
label |
|
681 |
||
682 |
^rule displayString. |
|
683 |
||
684 |
"Modified: / 15-04-2010 / 18:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
685 |
! |
|
686 |
||
687 |
name |
|
688 |
||
689 |
^rule name |
|
690 |
||
691 |
"Created: / 15-04-2010 / 19:12:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
692 |
! |
|
693 |
||
694 |
rationale |
|
695 |
||
696 |
^rule rationale |
|
697 |
||
698 |
"Created: / 15-04-2010 / 19:10:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
699 |
! |
|
700 |
||
701 |
rule |
|
702 |
^ rule |
|
703 |
! |
|
704 |
||
705 |
rule:anRBLintRule |
|
706 |
rule := anRBLintRule. |
|
707 |
! |
|
708 |
||
709 |
x |
|
710 |
^ x ? 0 |
|
711 |
||
712 |
"Modified: / 15-04-2010 / 20:48:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
713 |
! ! |
|
714 |
||
715 |
!LintRuleList::ListEntry methodsFor:'displaying'! |
|
716 |
||
717 |
displayLabel:aLabel h:lH on:aGC x:newX y:y h:h |
|
718 |
||
719 |
| cx icon app | |
|
720 |
cx := x := newX. |
|
721 |
(app := self application) showCheckbox ifTrue: |
|
722 |
[icon := self checked ifTrue:[app class checkedIcon] ifFalse:[app class uncheckedIcon]. |
|
723 |
icon displayOn: aGC x: cx y: y + (h / 2) - (icon height / 2). |
|
724 |
cx := cx + 22."experimental value - this looks good"]. |
|
725 |
||
726 |
super displayLabel:aLabel h:lH on:aGC x:cx y:y h:h |
|
727 |
||
728 |
"Modified: / 15-04-2010 / 20:14:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
729 |
! |
|
730 |
||
731 |
displayString |
|
732 |
||
733 |
^rule displayString |
|
734 |
||
735 |
"Created: / 15-04-2010 / 19:13:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
736 |
! ! |
|
737 |
||
738 |
!LintRuleList class methodsFor:'documentation'! |
|
739 |
||
740 |
version_CVS |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10499
diff
changeset
|
741 |
^ '§Header: /cvs/stx/stx/libtool/Tools__LintRuleList.st,v 1.4 2011/08/05 12:35:54 vrany Exp §' |
10000 | 742 |
! |
743 |
||
744 |
version_SVN |
|
12123
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10499
diff
changeset
|
745 |
^ '$Id: Tools__LintRuleList.st 7619 2010-08-26 10:15:15Z vranyj1 $' |
4bde08cebd48
trunk branched into /branches/jv
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
10499
diff
changeset
|
746 |
! ! |