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