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