author | Claus Gittinger <cg@exept.de> |
Mon, 11 Sep 2017 09:08:06 +0200 | |
changeset 17686 | c6fc2da19287 |
parent 17657 | 26bce9240711 |
child 17898 | f5f921c1e9c1 |
permissions | -rw-r--r-- |
9999 | 1 |
" |
10094 | 2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
9999 | 4 |
|
10094 | 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. |
|
9999 | 25 |
" |
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
ApplicationModel subclass:#LintRuleDetail |
|
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
31 |
instanceVariableNames:'ruleHolder rationaleVisibleHolder rationalView |
17290 | 32 |
selectedMethodsHolder selectedClassesHolder' |
10480 | 33 |
classVariableNames:'' |
34 |
poolDictionaries:'' |
|
35 |
category:'Interface-Lint' |
|
9999 | 36 |
! |
37 |
||
38 |
!LintRuleDetail class methodsFor:'documentation'! |
|
39 |
||
40 |
copyright |
|
41 |
" |
|
10094 | 42 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
43 |
Copyright (c) 2009-2010 eXept Software AG |
|
44 |
||
45 |
Permission is hereby granted, free of charge, to any person |
|
46 |
obtaining a copy of this software and associated documentation |
|
47 |
files (the 'Software'), to deal in the Software without |
|
48 |
restriction, including without limitation the rights to use, |
|
49 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
50 |
copies of the Software, and to permit persons to whom the |
|
51 |
Software is furnished to do so, subject to the following |
|
52 |
conditions: |
|
9999 | 53 |
|
10094 | 54 |
The above copyright notice and this permission notice shall be |
55 |
included in all copies or substantial portions of the Software. |
|
56 |
||
57 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
58 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
59 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
60 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
61 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
62 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
63 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
64 |
OTHER DEALINGS IN THE SOFTWARE. |
|
9999 | 65 |
" |
17297 | 66 |
! |
67 |
||
68 |
documentation |
|
69 |
" |
|
70 |
Embeddable list to display affected methods from a selected SmallLint rules. |
|
71 |
(this is embedded in the browser when showing lint check outcomes) |
|
72 |
||
73 |
[author:] |
|
74 |
Jan Vrany <jan.vrany@fit.cvut.cz> |
|
75 |
||
76 |
[instance variables:] |
|
77 |
||
78 |
[class variables:] |
|
79 |
||
80 |
[see also:] |
|
81 |
||
82 |
" |
|
9999 | 83 |
! ! |
84 |
||
10672 | 85 |
!LintRuleDetail class methodsFor:'help specs'! |
86 |
||
87 |
flyByHelpSpec |
|
88 |
"This resource specification was automatically generated |
|
89 |
by the UIHelpTool of ST/X." |
|
90 |
||
91 |
"Do not manually edit this!! If it is corrupted, |
|
92 |
the UIHelpTool may not be able to read the specification." |
|
93 |
||
94 |
" |
|
95 |
UIHelpTool openOnClass:Tools::LintRuleDetail |
|
96 |
" |
|
97 |
||
98 |
<resource: #help> |
|
99 |
||
100 |
^ super flyByHelpSpec addPairsFrom:#( |
|
101 |
||
102 |
#ruleName |
|
103 |
'Click to browse the lint rule' |
|
104 |
||
105 |
) |
|
106 |
||
107 |
"Created: / 07-09-2011 / 04:08:11 / cg" |
|
108 |
! ! |
|
109 |
||
9999 | 110 |
!LintRuleDetail class methodsFor:'interface specs'! |
111 |
||
112 |
windowSpec |
|
113 |
"This resource specification was automatically generated |
|
114 |
by the UIPainter of ST/X." |
|
115 |
||
116 |
"Do not manually edit this!! If it is corrupted, |
|
117 |
the UIPainter may not be able to read the specification." |
|
118 |
||
119 |
" |
|
120 |
UIPainter new openOnClass:Tools::LintRuleDetail andSelector:#windowSpec |
|
121 |
Tools::LintRuleDetail new openInterface:#windowSpec |
|
122 |
Tools::LintRuleDetail open |
|
123 |
" |
|
124 |
||
125 |
<resource: #canvas> |
|
126 |
||
10500 | 127 |
^ |
9999 | 128 |
#(FullSpec |
10500 | 129 |
name: windowSpec |
130 |
window: |
|
9999 | 131 |
(WindowSpec |
10500 | 132 |
label: 'SmalllintRuleDetail' |
133 |
name: 'SmalllintRuleDetail' |
|
134 |
min: (Point 10 10) |
|
135 |
bounds: (Rectangle 0 0 560 300) |
|
136 |
) |
|
137 |
component: |
|
9999 | 138 |
(SpecCollection |
10500 | 139 |
collection: ( |
140 |
(VerticalPanelViewSpec |
|
141 |
name: 'Panel' |
|
142 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
143 |
horizontalLayout: fit |
|
144 |
verticalLayout: topSpaceFit |
|
145 |
horizontalSpace: 0 |
|
146 |
verticalSpace: 0 |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
147 |
ignoreInvisibleComponents: true |
10500 | 148 |
component: |
149 |
(SpecCollection |
|
150 |
collection: ( |
|
151 |
(ViewSpec |
|
152 |
name: 'Label' |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
153 |
visibilityChannel: false |
10500 | 154 |
component: |
155 |
(SpecCollection |
|
156 |
collection: ( |
|
10672 | 157 |
(LinkButtonSpec |
158 |
name: 'Button1' |
|
159 |
layout: (LayoutFrame 0 0 0 0 -150 1 30 0) |
|
160 |
activeHelpKey: ruleName |
|
10500 | 161 |
translateLabel: true |
162 |
labelChannel: ruleNameAspect |
|
163 |
adjust: left |
|
10672 | 164 |
model: browseLintRule |
10500 | 165 |
) |
166 |
(CheckBoxSpec |
|
167 |
label: 'Show Rationale' |
|
168 |
name: 'CheckBox1' |
|
169 |
layout: (LayoutFrame -150 1 0 0 0 1 30 0) |
|
170 |
model: rationaleVisibleHolder |
|
171 |
translateLabel: true |
|
172 |
) |
|
173 |
) |
|
174 |
||
175 |
) |
|
176 |
extent: (Point 560 30) |
|
177 |
) |
|
178 |
(HTMLViewSpec |
|
179 |
name: 'Rationale' |
|
180 |
level: 0 |
|
181 |
visibilityChannel: rationaleVisibleHolder |
|
182 |
hasHorizontalScrollBar: true |
|
183 |
hasVerticalScrollBar: true |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
184 |
backgroundColor: (Color 86.9993133440147 86.9993133440147 86.9993133440147) |
10500 | 185 |
htmlText: ruleRationaleAspect |
186 |
extent: (Point 560 270) |
|
187 |
postBuildCallback: setupHTMLView: |
|
188 |
) |
|
189 |
) |
|
190 |
||
191 |
) |
|
192 |
) |
|
193 |
) |
|
194 |
||
195 |
) |
|
9999 | 196 |
) |
197 |
! ! |
|
198 |
||
199 |
!LintRuleDetail class methodsFor:'plugIn spec'! |
|
200 |
||
201 |
aspectSelectors |
|
202 |
"This resource specification was automatically generated |
|
203 |
by the UIPainter of ST/X." |
|
204 |
||
205 |
"Do not manually edit this. If it is corrupted, |
|
206 |
the UIPainter may not be able to read the specification." |
|
207 |
||
208 |
"Return a description of exported aspects; |
|
209 |
these can be connected to aspects of an embedding application |
|
210 |
(if this app is embedded in a subCanvas)." |
|
211 |
||
212 |
^ #( |
|
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
213 |
#ruleHolder |
11306 | 214 |
#ruleRationaleAspect |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
215 |
#selectedMethodsHolder |
17290 | 216 |
#selectedClassesHolder |
9999 | 217 |
). |
218 |
||
11306 | 219 |
"Modified: / 01-03-2012 / 16:31:04 / cg" |
9999 | 220 |
! ! |
221 |
||
10672 | 222 |
!LintRuleDetail methodsFor:'actions'! |
223 |
||
224 |
browseLintRule |
|
225 |
|rule ruleClass sel| |
|
226 |
||
227 |
rule := self ruleHolder value. |
|
228 |
rule isNil ifTrue:[^ self]. |
|
17290 | 229 |
|
10672 | 230 |
ruleClass := rule class. |
231 |
(ruleClass implements:#rationale) ifTrue:[ |
|
232 |
sel := #rationale. |
|
233 |
]. |
|
17657 | 234 |
SystemBrowser default openInClass:ruleClass selector:sel |
10672 | 235 |
|
236 |
"Created: / 07-09-2011 / 04:09:38 / cg" |
|
17657 | 237 |
"Modified: / 01-09-2017 / 14:22:47 / cg" |
10672 | 238 |
! ! |
239 |
||
9999 | 240 |
!LintRuleDetail methodsFor:'aspects'! |
241 |
||
10473 | 242 |
rationaleVisibleHolder |
243 |
"return/create the 'rationaleVisibleHolder' value holder (automatically generated)" |
|
244 |
||
245 |
rationaleVisibleHolder isNil ifTrue:[ |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
246 |
rationaleVisibleHolder := ValueHolder with: true "false". |
10500 | 247 |
rationaleVisibleHolder addDependent:self. |
10473 | 248 |
]. |
249 |
^ rationaleVisibleHolder |
|
250 |
||
251 |
"Modified: / 04-08-2011 / 21:39:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
252 |
"Modified: / 01-03-2012 / 08:50:20 / cg" |
10473 | 253 |
! |
254 |
||
17290 | 255 |
rationaleVisibleHolder:aValueHolder |
10473 | 256 |
"set the 'rationaleVisibleHolder' value holder (automatically generated)" |
257 |
||
258 |
|oldValue newValue| |
|
259 |
||
260 |
rationaleVisibleHolder notNil ifTrue:[ |
|
10500 | 261 |
oldValue := rationaleVisibleHolder value. |
262 |
rationaleVisibleHolder removeDependent:self. |
|
10473 | 263 |
]. |
17290 | 264 |
rationaleVisibleHolder := aValueHolder. |
10473 | 265 |
rationaleVisibleHolder notNil ifTrue:[ |
10500 | 266 |
rationaleVisibleHolder addDependent:self. |
10473 | 267 |
]. |
268 |
newValue := rationaleVisibleHolder value. |
|
269 |
oldValue ~~ newValue ifTrue:[ |
|
10500 | 270 |
self update:#value with:newValue from:rationaleVisibleHolder. |
10473 | 271 |
]. |
272 |
! |
|
273 |
||
9999 | 274 |
ruleHolder |
275 |
"return/create the 'ruleHolder' value holder (automatically generated)" |
|
276 |
||
277 |
ruleHolder isNil ifTrue:[ |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
278 |
ruleHolder := ValueHolder new. |
9999 | 279 |
]. |
280 |
^ ruleHolder |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
281 |
|
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
282 |
"Modified: / 01-03-2012 / 08:51:03 / cg" |
9999 | 283 |
! |
284 |
||
17290 | 285 |
ruleHolder:aValueHolder |
9999 | 286 |
"set the 'ruleHolder' value holder (automatically generated)" |
287 |
||
10473 | 288 |
|oldValue newValue| |
289 |
||
290 |
ruleHolder notNil ifTrue:[ |
|
11306 | 291 |
oldValue := ruleHolder value. |
292 |
ruleHolder removeDependent:self. |
|
10473 | 293 |
]. |
17290 | 294 |
ruleHolder := aValueHolder. |
10473 | 295 |
ruleHolder notNil ifTrue:[ |
11306 | 296 |
ruleHolder addDependent:self. |
10473 | 297 |
]. |
298 |
newValue := ruleHolder value. |
|
299 |
oldValue ~~ newValue ifTrue:[ |
|
11306 | 300 |
self update:#value with:newValue from:ruleHolder. |
10473 | 301 |
]. |
11306 | 302 |
|
303 |
"Modified: / 01-03-2012 / 15:29:30 / cg" |
|
9999 | 304 |
! |
305 |
||
306 |
ruleNameAspect |
|
307 |
<resource: #uiAspect> |
|
308 |
||
309 |
|holder| |
|
310 |
||
311 |
(holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[ |
|
10672 | 312 |
holder := BlockValue |
10673 | 313 |
with:[:h | |
314 |
"/ h displayString , ' ' , (('[browse]' actionForAll:[ self browseLintRule]) colorizeAllWith:Color blue) |
|
16526 | 315 |
(h ? '') displayString asActionLinkTo:[ self browseLintRule ] |
10673 | 316 |
] |
10672 | 317 |
argument: self ruleHolder. |
318 |
builder aspectAt:#ruleNameAspect put:holder. |
|
9999 | 319 |
]. |
320 |
^ holder. |
|
321 |
||
322 |
"Modified: / 05-02-2010 / 12:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
323 |
"Modified: / 01-03-2012 / 08:44:23 / cg" |
9999 | 324 |
! |
325 |
||
326 |
ruleRationaleAspect |
|
327 |
<resource: #uiAspect> |
|
328 |
||
329 |
|holder| |
|
330 |
||
331 |
(holder := builder bindingAt:#ruleRationaleAspect) isNil ifTrue:[ |
|
11306 | 332 |
"cannot use a BlockValue linked on the ruleHolder for the |
17297 | 333 |
ruleRationaleAspect, because the ruleHolder might be changed dynamically |
11306 | 334 |
via the aspect-linking mechanism" |
335 |
"/ holder := (AspectAdaptor forAspect: #rationale) subjectChannel: self ruleHolder. |
|
336 |
holder := '' asValue. |
|
10672 | 337 |
builder aspectAt:#ruleRationaleAspect put:holder. |
9999 | 338 |
]. |
339 |
^ holder. |
|
340 |
||
341 |
"Modified: / 05-02-2010 / 12:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11306 | 342 |
"Modified: / 01-03-2012 / 15:29:16 / cg" |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
343 |
! |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
344 |
|
17290 | 345 |
selectedClassesHolder |
346 |
"return/create the 'selectedClassesHolder' value holder (automatically generated)" |
|
347 |
||
348 |
selectedClassesHolder isNil ifTrue:[ |
|
349 |
selectedClassesHolder := #() asValue. |
|
350 |
selectedClassesHolder addDependent:self. |
|
351 |
]. |
|
352 |
^ selectedClassesHolder |
|
353 |
! |
|
354 |
||
355 |
selectedClassesHolder:aValueHolder |
|
356 |
"set the 'selectedClassesHolder' value holder (automatically generated)" |
|
357 |
||
358 |
|oldValue newValue| |
|
359 |
||
360 |
selectedClassesHolder notNil ifTrue:[ |
|
361 |
oldValue := selectedClassesHolder value. |
|
362 |
selectedClassesHolder removeDependent:self. |
|
363 |
]. |
|
364 |
selectedClassesHolder := aValueHolder. |
|
365 |
selectedClassesHolder notNil ifTrue:[ |
|
366 |
selectedClassesHolder addDependent:self. |
|
367 |
]. |
|
368 |
newValue := selectedClassesHolder value. |
|
369 |
oldValue ~= newValue ifTrue:[ |
|
370 |
self update:#value with:newValue from:selectedClassesHolder. |
|
371 |
]. |
|
372 |
! |
|
373 |
||
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
374 |
selectedMethodsHolder |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
375 |
"return/create the 'selectedMethodsHolder' value holder (automatically generated)" |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
376 |
|
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
377 |
selectedMethodsHolder isNil ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
378 |
selectedMethodsHolder := #() asValue. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
379 |
selectedMethodsHolder addDependent:self. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
380 |
]. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
381 |
^ selectedMethodsHolder |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
382 |
! |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
383 |
|
17290 | 384 |
selectedMethodsHolder:aValueHolder |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
385 |
"set the 'selectedMethodsHolder' value holder (automatically generated)" |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
386 |
|
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
387 |
|oldValue newValue| |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
388 |
|
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
389 |
selectedMethodsHolder notNil ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
390 |
oldValue := selectedMethodsHolder value. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
391 |
selectedMethodsHolder removeDependent:self. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
392 |
]. |
17290 | 393 |
selectedMethodsHolder := aValueHolder. |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
394 |
selectedMethodsHolder notNil ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
395 |
selectedMethodsHolder addDependent:self. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
396 |
]. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
397 |
newValue := selectedMethodsHolder value. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
398 |
oldValue ~= newValue ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
399 |
self update:#value with:newValue from:selectedMethodsHolder. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
400 |
]. |
9999 | 401 |
! ! |
402 |
||
10473 | 403 |
!LintRuleDetail methodsFor:'change & update'! |
404 |
||
405 |
update:something with:aParameter from:changedObject |
|
406 |
"Invoked when an object that I depend upon sends a change notification." |
|
407 |
||
408 |
changedObject == ruleHolder ifTrue:[ |
|
10500 | 409 |
self updateVisibility. |
11306 | 410 |
self updateRule. |
10500 | 411 |
^ self. |
10473 | 412 |
]. |
413 |
changedObject == rationaleVisibleHolder ifTrue:[ |
|
10500 | 414 |
self updateVisibility. |
415 |
^ self. |
|
10473 | 416 |
]. |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
417 |
changedObject == selectedMethodsHolder ifTrue:[ |
17290 | 418 |
"/ cg: preparations to show method-specific text in rationale/detail view |
419 |
"/ Not yet done... |
|
420 |
self updateRule. |
|
421 |
^ self |
|
422 |
]. |
|
423 |
||
424 |
changedObject == selectedClassesHolder ifTrue:[ |
|
425 |
"/ cg: preparations to show class-specific text in rationale/detail view |
|
426 |
"/ Not yet done... |
|
427 |
self updateRule. |
|
428 |
^ self |
|
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
429 |
]. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
430 |
|
10473 | 431 |
super update:something with:aParameter from:changedObject |
432 |
||
433 |
"Modified: / 04-08-2011 / 21:31:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11306 | 434 |
"Modified: / 01-03-2012 / 15:27:38 / cg" |
435 |
! |
|
436 |
||
437 |
updateRule |
|
438 |
"cannot use a BlockValue linked on the ruleHolder for the |
|
439 |
ruleRationaleAspect, because the ruleHolder maight be changed dynamically |
|
440 |
via the aspect-linking mechanism" |
|
441 |
||
17290 | 442 |
|rule text| |
11306 | 443 |
|
17290 | 444 |
text := ''. |
445 |
||
11306 | 446 |
rule := self ruleHolder value. |
17290 | 447 |
rule notNil ifTrue:[ |
448 |
selectedMethodsHolder value size == 1 ifTrue:[ |
|
449 |
text := rule rationaleWithAnchorForMethod:(selectedMethodsHolder value first). |
|
450 |
] ifFalse:[ |
|
451 |
selectedClassesHolder value size == 1 ifTrue:[ |
|
452 |
text := rule rationaleWithAnchorForClass:(selectedClassesHolder value first). |
|
453 |
] ifFalse:[ |
|
454 |
text := rule rationaleWithAnchor. |
|
455 |
] |
|
456 |
] |
|
457 |
]. |
|
458 |
self ruleRationaleAspect value:text. |
|
11306 | 459 |
|
460 |
"Created: / 01-03-2012 / 15:28:18 / cg" |
|
10473 | 461 |
! |
462 |
||
463 |
updateVisibility |
|
464 |
||
10480 | 465 |
self ruleHolder value notNil |
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
466 |
ifTrue:[self show] |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
467 |
ifFalse:[self hide]. |
10473 | 468 |
|
469 |
"Created: / 04-08-2011 / 16:39:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
470 |
"Modified: / 04-09-2011 / 20:18:48 / cg" |
10473 | 471 |
! ! |
472 |
||
10500 | 473 |
!LintRuleDetail methodsFor:'initialization'! |
474 |
||
475 |
setupHTMLView:aView |
|
10671 | 476 |
rationalView := aView. |
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
477 |
rationalView linkActionPerformer:self. |
10500 | 478 |
aView painter |
10671 | 479 |
leftMargin:20; |
480 |
topMargin:5. |
|
10500 | 481 |
|
482 |
"Created: / 04-08-2011 / 18:00:36 / cg" |
|
483 |
! ! |
|
484 |
||
10473 | 485 |
!LintRuleDetail methodsFor:'private'! |
486 |
||
10671 | 487 |
heightWhenNotShowingRationale |
488 |
^ 30 |
|
489 |
||
490 |
"Created: / 07-09-2011 / 04:02:34 / cg" |
|
491 |
! |
|
492 |
||
493 |
heightWhenShowingRationale |
|
494 |
^ 100 |
|
495 |
||
496 |
"Created: / 07-09-2011 / 04:02:24 / cg" |
|
497 |
! |
|
498 |
||
10473 | 499 |
hide |
500 |
||
501 |
self visibility: false height: 0 |
|
502 |
||
503 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
504 |
! |
|
505 |
||
506 |
show |
|
10671 | 507 |
self |
508 |
visibility: true |
|
509 |
height: (self rationaleVisibleHolder value |
|
510 |
ifTrue:[ self heightWhenShowingRationale ] |
|
511 |
ifFalse:[ self heightWhenNotShowingRationale ]) |
|
10473 | 512 |
|
513 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10671 | 514 |
"Modified: / 07-09-2011 / 04:03:07 / cg" |
10473 | 515 |
! |
516 |
||
517 |
visibility: visibility height: height |
|
518 |
| container list detail h | |
|
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
519 |
|
17521 | 520 |
"/ cg: the whole container-container access chain below is ugly - use a name to access components. |
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
521 |
"/ and also: there is no layout in list, so the code does crash. |
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
522 |
"/ I disabled the whole visibility stuff. |
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
523 |
^ self. |
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
524 |
|
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
525 |
(container := self window container) isNil ifTrue:[^self]. |
10473 | 526 |
h := visibility ifFalse:[0] ifTrue:[height]. |
527 |
||
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
528 |
container isVisible == visibility ifFalse: [ |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
529 |
container isVisible: visibility |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
530 |
]. |
10473 | 531 |
|
532 |
list := container container subViews first. |
|
533 |
detail := container container subViews second. |
|
534 |
||
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
535 |
(list layout bottomOffset ~= height negated) ifTrue:[ |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
536 |
list layout: (list layout bottomOffset: height negated; yourself) |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
537 |
]. |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
538 |
(detail layout topOffset ~= height negated) ifTrue:[ |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
539 |
detail layout: (detail layout topOffset: height negated; yourself) |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
540 |
]. |
10473 | 541 |
|
542 |
"Created: / 11-03-2010 / 09:51:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
543 |
"Modified: / 01-03-2012 / 10:35:51 / cg" |
17521 | 544 |
"Modified (format): / 29-05-2017 / 15:53:20 / mawalch" |
10480 | 545 |
! ! |
10473 | 546 |
|
9999 | 547 |
!LintRuleDetail class methodsFor:'documentation'! |
548 |
||
10672 | 549 |
version |
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
550 |
^ '$Header$' |
10672 | 551 |
! |
552 |
||
9999 | 553 |
version_CVS |
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
554 |
^ '$Header$' |
9999 | 555 |
! |
556 |
||
557 |
version_SVN |
|
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
558 |
^ '$Id$' |
9999 | 559 |
! ! |
13014
64e77f92badd
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
11314
diff
changeset
|
560 |