author | Stefan Vogel <sv@exept.de> |
Fri, 17 May 2019 17:11:44 +0200 | |
changeset 18767 | 0478d93cdb75 |
parent 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 |
^ |
17976 | 130 |
#(FullSpec |
131 |
name: windowSpec |
|
132 |
uuid: '632f51ca-06ca-11e8-8563-b8f6b1108e05' |
|
133 |
window: |
|
134 |
(WindowSpec |
|
135 |
label: 'SmalllintRuleDetail' |
|
136 |
name: 'SmalllintRuleDetail' |
|
137 |
uuid: '632f54f4-06ca-11e8-8563-b8f6b1108e05' |
|
138 |
min: (Point 10 10) |
|
139 |
bounds: (Rectangle 0 0 560 300) |
|
140 |
) |
|
141 |
component: |
|
142 |
(SpecCollection |
|
143 |
collection: ( |
|
144 |
(VerticalPanelViewSpec |
|
145 |
name: 'Panel' |
|
146 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
147 |
uuid: '632f577e-06ca-11e8-8563-b8f6b1108e05' |
|
148 |
horizontalLayout: fit |
|
149 |
verticalLayout: topSpaceFit |
|
150 |
horizontalSpace: 0 |
|
151 |
verticalSpace: 0 |
|
152 |
ignoreInvisibleComponents: true |
|
153 |
component: |
|
154 |
(SpecCollection |
|
155 |
collection: ( |
|
156 |
(ViewSpec |
|
157 |
name: 'Label' |
|
158 |
uuid: '632f5968-06ca-11e8-8563-b8f6b1108e05' |
|
159 |
visibilityChannel: false |
|
160 |
component: |
|
161 |
(SpecCollection |
|
162 |
collection: ( |
|
163 |
(LinkButtonSpec |
|
164 |
name: 'Button1' |
|
165 |
layout: (LayoutFrame 0 0 0 0 -150 1 30 0) |
|
166 |
activeHelpKey: ruleName |
|
167 |
uuid: '632f5a3a-06ca-11e8-8563-b8f6b1108e05' |
|
168 |
translateLabel: true |
|
169 |
labelChannel: ruleNameAspect |
|
170 |
adjust: left |
|
171 |
model: browseLintRule |
|
10500 | 172 |
) |
17976 | 173 |
(CheckBoxSpec |
174 |
label: 'Show Rationale' |
|
175 |
name: 'CheckBox1' |
|
176 |
layout: (LayoutFrame -150 1 0 0 0 1 30 0) |
|
177 |
uuid: '632f5ce2-06ca-11e8-8563-b8f6b1108e05' |
|
178 |
model: rationaleVisibleHolder |
|
179 |
translateLabel: true |
|
180 |
) |
|
181 |
) |
|
182 |
||
183 |
) |
|
184 |
extent: (Point 560 30) |
|
10500 | 185 |
) |
17976 | 186 |
(HTMLViewSpec |
187 |
name: 'Rationale' |
|
188 |
uuid: '632f5ea4-06ca-11e8-8563-b8f6b1108e05' |
|
189 |
level: 0 |
|
190 |
visibilityChannel: rationaleVisibleHolder |
|
191 |
hasHorizontalScrollBar: true |
|
192 |
hasVerticalScrollBar: true |
|
193 |
backgroundColor: (Color 87.0 87.0 87.0) |
|
194 |
htmlText: ruleRationaleAspect |
|
195 |
extent: (Point 560 270) |
|
196 |
postBuildCallback: setupHTMLView: |
|
197 |
) |
|
198 |
) |
|
199 |
||
200 |
) |
|
10500 | 201 |
) |
17976 | 202 |
) |
203 |
||
204 |
) |
|
205 |
) |
|
9999 | 206 |
! ! |
207 |
||
208 |
!LintRuleDetail class methodsFor:'plugIn spec'! |
|
209 |
||
210 |
aspectSelectors |
|
211 |
"This resource specification was automatically generated |
|
212 |
by the UIPainter of ST/X." |
|
213 |
||
214 |
"Do not manually edit this. If it is corrupted, |
|
215 |
the UIPainter may not be able to read the specification." |
|
216 |
||
217 |
"Return a description of exported aspects; |
|
218 |
these can be connected to aspects of an embedding application |
|
219 |
(if this app is embedded in a subCanvas)." |
|
220 |
||
221 |
^ #( |
|
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
222 |
#ruleHolder |
11306 | 223 |
#ruleRationaleAspect |
17976 | 224 |
#selectedClassesHolder |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
225 |
#selectedMethodsHolder |
9999 | 226 |
). |
227 |
||
228 |
! ! |
|
229 |
||
10672 | 230 |
!LintRuleDetail methodsFor:'actions'! |
231 |
||
232 |
browseLintRule |
|
233 |
|rule ruleClass sel| |
|
234 |
||
235 |
rule := self ruleHolder value. |
|
236 |
rule isNil ifTrue:[^ self]. |
|
17290 | 237 |
|
10672 | 238 |
ruleClass := rule class. |
239 |
(ruleClass implements:#rationale) ifTrue:[ |
|
240 |
sel := #rationale. |
|
241 |
]. |
|
17657 | 242 |
SystemBrowser default openInClass:ruleClass selector:sel |
10672 | 243 |
|
244 |
"Created: / 07-09-2011 / 04:09:38 / cg" |
|
17657 | 245 |
"Modified: / 01-09-2017 / 14:22:47 / cg" |
10672 | 246 |
! ! |
247 |
||
9999 | 248 |
!LintRuleDetail methodsFor:'aspects'! |
249 |
||
10473 | 250 |
rationaleVisibleHolder |
251 |
"return/create the 'rationaleVisibleHolder' value holder (automatically generated)" |
|
252 |
||
253 |
rationaleVisibleHolder isNil ifTrue:[ |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
254 |
rationaleVisibleHolder := ValueHolder with: true "false". |
10500 | 255 |
rationaleVisibleHolder addDependent:self. |
10473 | 256 |
]. |
257 |
^ rationaleVisibleHolder |
|
258 |
||
259 |
"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
|
260 |
"Modified: / 01-03-2012 / 08:50:20 / cg" |
10473 | 261 |
! |
262 |
||
17290 | 263 |
rationaleVisibleHolder:aValueHolder |
10473 | 264 |
"set the 'rationaleVisibleHolder' value holder (automatically generated)" |
265 |
||
266 |
|oldValue newValue| |
|
267 |
||
268 |
rationaleVisibleHolder notNil ifTrue:[ |
|
10500 | 269 |
oldValue := rationaleVisibleHolder value. |
270 |
rationaleVisibleHolder removeDependent:self. |
|
10473 | 271 |
]. |
17290 | 272 |
rationaleVisibleHolder := aValueHolder. |
10473 | 273 |
rationaleVisibleHolder notNil ifTrue:[ |
10500 | 274 |
rationaleVisibleHolder addDependent:self. |
10473 | 275 |
]. |
276 |
newValue := rationaleVisibleHolder value. |
|
277 |
oldValue ~~ newValue ifTrue:[ |
|
10500 | 278 |
self update:#value with:newValue from:rationaleVisibleHolder. |
10473 | 279 |
]. |
280 |
! |
|
281 |
||
9999 | 282 |
ruleHolder |
283 |
"return/create the 'ruleHolder' value holder (automatically generated)" |
|
284 |
||
285 |
ruleHolder isNil ifTrue:[ |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
286 |
ruleHolder := ValueHolder new. |
9999 | 287 |
]. |
288 |
^ ruleHolder |
|
11299
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
289 |
|
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
290 |
"Modified: / 01-03-2012 / 08:51:03 / cg" |
9999 | 291 |
! |
292 |
||
17290 | 293 |
ruleHolder:aValueHolder |
9999 | 294 |
"set the 'ruleHolder' value holder (automatically generated)" |
295 |
||
10473 | 296 |
|oldValue newValue| |
297 |
||
298 |
ruleHolder notNil ifTrue:[ |
|
11306 | 299 |
oldValue := ruleHolder value. |
300 |
ruleHolder removeDependent:self. |
|
10473 | 301 |
]. |
17290 | 302 |
ruleHolder := aValueHolder. |
10473 | 303 |
ruleHolder notNil ifTrue:[ |
11306 | 304 |
ruleHolder addDependent:self. |
10473 | 305 |
]. |
306 |
newValue := ruleHolder value. |
|
307 |
oldValue ~~ newValue ifTrue:[ |
|
11306 | 308 |
self update:#value with:newValue from:ruleHolder. |
10473 | 309 |
]. |
11306 | 310 |
|
311 |
"Modified: / 01-03-2012 / 15:29:30 / cg" |
|
9999 | 312 |
! |
313 |
||
314 |
ruleNameAspect |
|
315 |
<resource: #uiAspect> |
|
316 |
||
317 |
|holder| |
|
318 |
||
319 |
(holder := builder bindingAt:#ruleNameAspect) isNil ifTrue:[ |
|
10672 | 320 |
holder := BlockValue |
10673 | 321 |
with:[:h | |
322 |
"/ h displayString , ' ' , (('[browse]' actionForAll:[ self browseLintRule]) colorizeAllWith:Color blue) |
|
16526 | 323 |
(h ? '') displayString asActionLinkTo:[ self browseLintRule ] |
10673 | 324 |
] |
10672 | 325 |
argument: self ruleHolder. |
326 |
builder aspectAt:#ruleNameAspect put:holder. |
|
9999 | 327 |
]. |
328 |
^ holder. |
|
329 |
||
330 |
"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
|
331 |
"Modified: / 01-03-2012 / 08:44:23 / cg" |
9999 | 332 |
! |
333 |
||
334 |
ruleRationaleAspect |
|
335 |
<resource: #uiAspect> |
|
336 |
||
337 |
|holder| |
|
338 |
||
339 |
(holder := builder bindingAt:#ruleRationaleAspect) isNil ifTrue:[ |
|
11306 | 340 |
"cannot use a BlockValue linked on the ruleHolder for the |
17297 | 341 |
ruleRationaleAspect, because the ruleHolder might be changed dynamically |
11306 | 342 |
via the aspect-linking mechanism" |
343 |
"/ holder := (AspectAdaptor forAspect: #rationale) subjectChannel: self ruleHolder. |
|
344 |
holder := '' asValue. |
|
10672 | 345 |
builder aspectAt:#ruleRationaleAspect put:holder. |
9999 | 346 |
]. |
347 |
^ holder. |
|
348 |
||
349 |
"Modified: / 05-02-2010 / 12:51:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11306 | 350 |
"Modified: / 01-03-2012 / 15:29:16 / cg" |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
351 |
! |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
352 |
|
17290 | 353 |
selectedClassesHolder |
354 |
"return/create the 'selectedClassesHolder' value holder (automatically generated)" |
|
355 |
||
356 |
selectedClassesHolder isNil ifTrue:[ |
|
357 |
selectedClassesHolder := #() asValue. |
|
358 |
selectedClassesHolder addDependent:self. |
|
359 |
]. |
|
360 |
^ selectedClassesHolder |
|
361 |
! |
|
362 |
||
363 |
selectedClassesHolder:aValueHolder |
|
364 |
"set the 'selectedClassesHolder' value holder (automatically generated)" |
|
365 |
||
366 |
|oldValue newValue| |
|
367 |
||
368 |
selectedClassesHolder notNil ifTrue:[ |
|
369 |
oldValue := selectedClassesHolder value. |
|
370 |
selectedClassesHolder removeDependent:self. |
|
371 |
]. |
|
372 |
selectedClassesHolder := aValueHolder. |
|
373 |
selectedClassesHolder notNil ifTrue:[ |
|
374 |
selectedClassesHolder addDependent:self. |
|
375 |
]. |
|
376 |
newValue := selectedClassesHolder value. |
|
377 |
oldValue ~= newValue ifTrue:[ |
|
378 |
self update:#value with:newValue from:selectedClassesHolder. |
|
379 |
]. |
|
380 |
! |
|
381 |
||
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
382 |
selectedMethodsHolder |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
383 |
"return/create the 'selectedMethodsHolder' value holder (automatically generated)" |
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 |
selectedMethodsHolder isNil ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
386 |
selectedMethodsHolder := #() asValue. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
387 |
selectedMethodsHolder addDependent:self. |
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 |
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 |
|
17290 | 392 |
selectedMethodsHolder:aValueHolder |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
393 |
"set the 'selectedMethodsHolder' value holder (automatically generated)" |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
394 |
|
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
395 |
|oldValue newValue| |
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 |
selectedMethodsHolder notNil ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
398 |
oldValue := selectedMethodsHolder value. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
399 |
selectedMethodsHolder removeDependent:self. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
400 |
]. |
17290 | 401 |
selectedMethodsHolder := aValueHolder. |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
402 |
selectedMethodsHolder notNil ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
403 |
selectedMethodsHolder addDependent:self. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
404 |
]. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
405 |
newValue := selectedMethodsHolder value. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
406 |
oldValue ~= newValue ifTrue:[ |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
407 |
self update:#value with:newValue from:selectedMethodsHolder. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
408 |
]. |
9999 | 409 |
! ! |
410 |
||
10473 | 411 |
!LintRuleDetail methodsFor:'change & update'! |
412 |
||
413 |
update:something with:aParameter from:changedObject |
|
414 |
"Invoked when an object that I depend upon sends a change notification." |
|
415 |
||
416 |
changedObject == ruleHolder ifTrue:[ |
|
10500 | 417 |
self updateVisibility. |
11306 | 418 |
self updateRule. |
10500 | 419 |
^ self. |
10473 | 420 |
]. |
421 |
changedObject == rationaleVisibleHolder ifTrue:[ |
|
10500 | 422 |
self updateVisibility. |
423 |
^ self. |
|
10473 | 424 |
]. |
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
425 |
changedObject == selectedMethodsHolder ifTrue:[ |
17290 | 426 |
"/ cg: preparations to show method-specific text in rationale/detail view |
427 |
"/ Not yet done... |
|
428 |
self updateRule. |
|
429 |
^ self |
|
430 |
]. |
|
431 |
||
432 |
changedObject == selectedClassesHolder ifTrue:[ |
|
433 |
"/ cg: preparations to show class-specific text in rationale/detail view |
|
434 |
"/ Not yet done... |
|
435 |
self updateRule. |
|
436 |
^ self |
|
14898
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
437 |
]. |
c786afd145ce
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
13014
diff
changeset
|
438 |
|
10473 | 439 |
super update:something with:aParameter from:changedObject |
440 |
||
441 |
"Modified: / 04-08-2011 / 21:31:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
11306 | 442 |
"Modified: / 01-03-2012 / 15:27:38 / cg" |
443 |
! |
|
444 |
||
445 |
updateRule |
|
446 |
"cannot use a BlockValue linked on the ruleHolder for the |
|
447 |
ruleRationaleAspect, because the ruleHolder maight be changed dynamically |
|
448 |
via the aspect-linking mechanism" |
|
449 |
||
17290 | 450 |
|rule text| |
11306 | 451 |
|
17290 | 452 |
text := ''. |
453 |
||
11306 | 454 |
rule := self ruleHolder value. |
17290 | 455 |
rule notNil ifTrue:[ |
456 |
selectedMethodsHolder value size == 1 ifTrue:[ |
|
457 |
text := rule rationaleWithAnchorForMethod:(selectedMethodsHolder value first). |
|
458 |
] ifFalse:[ |
|
459 |
selectedClassesHolder value size == 1 ifTrue:[ |
|
460 |
text := rule rationaleWithAnchorForClass:(selectedClassesHolder value first). |
|
461 |
] ifFalse:[ |
|
462 |
text := rule rationaleWithAnchor. |
|
463 |
] |
|
464 |
] |
|
465 |
]. |
|
17976 | 466 |
rationalView selfInDoitExpressions:rule. |
17290 | 467 |
self ruleRationaleAspect value:text. |
11306 | 468 |
|
469 |
"Created: / 01-03-2012 / 15:28:18 / cg" |
|
10473 | 470 |
! |
471 |
||
472 |
updateVisibility |
|
473 |
||
10480 | 474 |
self ruleHolder value notNil |
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
475 |
ifTrue:[self show] |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
476 |
ifFalse:[self hide]. |
10473 | 477 |
|
478 |
"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
|
479 |
"Modified: / 04-09-2011 / 20:18:48 / cg" |
10473 | 480 |
! ! |
481 |
||
10500 | 482 |
!LintRuleDetail methodsFor:'initialization'! |
483 |
||
484 |
setupHTMLView:aView |
|
17976 | 485 |
"callback, when htmlView shoing the rationale is created" |
486 |
||
10671 | 487 |
rationalView := aView. |
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
488 |
rationalView linkActionPerformer:self. |
10500 | 489 |
aView painter |
10671 | 490 |
leftMargin:20; |
491 |
topMargin:5. |
|
10500 | 492 |
|
493 |
"Created: / 04-08-2011 / 18:00:36 / cg" |
|
494 |
! ! |
|
495 |
||
10473 | 496 |
!LintRuleDetail methodsFor:'private'! |
497 |
||
10671 | 498 |
heightWhenNotShowingRationale |
499 |
^ 30 |
|
500 |
||
501 |
"Created: / 07-09-2011 / 04:02:34 / cg" |
|
502 |
! |
|
503 |
||
504 |
heightWhenShowingRationale |
|
505 |
^ 100 |
|
506 |
||
507 |
"Created: / 07-09-2011 / 04:02:24 / cg" |
|
508 |
! |
|
509 |
||
10473 | 510 |
hide |
511 |
||
512 |
self visibility: false height: 0 |
|
513 |
||
514 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
515 |
! |
|
516 |
||
517 |
show |
|
10671 | 518 |
self |
519 |
visibility: true |
|
520 |
height: (self rationaleVisibleHolder value |
|
521 |
ifTrue:[ self heightWhenShowingRationale ] |
|
522 |
ifFalse:[ self heightWhenNotShowingRationale ]) |
|
10473 | 523 |
|
524 |
"Created: / 11-03-2010 / 09:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
10671 | 525 |
"Modified: / 07-09-2011 / 04:03:07 / cg" |
10473 | 526 |
! |
527 |
||
528 |
visibility: visibility height: height |
|
529 |
| container list detail h | |
|
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
530 |
|
17521 | 531 |
"/ 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
|
532 |
"/ 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
|
533 |
"/ I disabled the whole visibility stuff. |
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
534 |
^ self. |
3e8397061396
fix: visibility switch and rationale did not work
Claus Gittinger <cg@exept.de>
parents:
10673
diff
changeset
|
535 |
|
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
536 |
(container := self window container) isNil ifTrue:[^self]. |
10473 | 537 |
h := visibility ifFalse:[0] ifTrue:[height]. |
538 |
||
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
539 |
container isVisible == visibility ifFalse: [ |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
540 |
container isVisible: visibility |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
541 |
]. |
10473 | 542 |
|
543 |
list := container container subViews first. |
|
544 |
detail := container container subViews second. |
|
545 |
||
10663
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
546 |
(list layout bottomOffset ~= height negated) ifTrue:[ |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
547 |
list layout: (list layout bottomOffset: height negated; yourself) |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
548 |
]. |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
549 |
(detail layout topOffset ~= height negated) ifTrue:[ |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
550 |
detail layout: (detail layout topOffset: height negated; yourself) |
32e84728c885
comment/format in: #updateVisibility
Claus Gittinger <cg@exept.de>
parents:
10500
diff
changeset
|
551 |
]. |
10473 | 552 |
|
553 |
"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
|
554 |
"Modified: / 01-03-2012 / 10:35:51 / cg" |
17521 | 555 |
"Modified (format): / 29-05-2017 / 15:53:20 / mawalch" |
10480 | 556 |
! ! |
10473 | 557 |
|
9999 | 558 |
!LintRuleDetail class methodsFor:'documentation'! |
559 |
||
10672 | 560 |
version |
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
561 |
^ '$Header$' |
10672 | 562 |
! |
563 |
||
9999 | 564 |
version_CVS |
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
565 |
^ '$Header$' |
9999 | 566 |
! |
567 |
||
568 |
version_SVN |
|
15837
95f2b67f68e8
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
14898
diff
changeset
|
569 |
^ '$Id$' |
9999 | 570 |
! ! |
13014
64e77f92badd
class: Tools::LintRuleDetail
Claus Gittinger <cg@exept.de>
parents:
11314
diff
changeset
|
571 |