author | Stefan Vogel <sv@exept.de> |
Fri, 09 May 2014 14:57:45 +0200 | |
changeset 14340 | 015e211830cc |
parent 14153 | 9164af5ffe74 |
child 14773 | 27ac58346f25 |
permissions | -rw-r--r-- |
13810 | 1 |
" |
2 |
Copyright (c) 2007-2010 Jan Vrany, SWING Research Group, Czech Technical University in Prague |
|
3 |
Copyright (c) 2009-2010 eXept Software AG |
|
4 |
||
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. |
|
25 |
" |
|
26 |
"{ Package: 'stx:libtool' }" |
|
27 |
||
28 |
"{ NameSpace: Tools }" |
|
29 |
||
30 |
SimpleDialog subclass:#LintRuleEditDialog |
|
31 |
instanceVariableNames:'ruleHolder nameHolder selectionHolder variablePanel |
|
32 |
relativeCorners detailsShown listSelection' |
|
33 |
classVariableNames:'' |
|
34 |
poolDictionaries:'' |
|
35 |
category:'Interface-Lint' |
|
36 |
! |
|
37 |
||
38 |
!LintRuleEditDialog class methodsFor:'documentation'! |
|
39 |
||
40 |
copyright |
|
41 |
" |
|
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: |
|
53 |
||
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. |
|
65 |
" |
|
66 |
! |
|
67 |
||
68 |
documentation |
|
69 |
" |
|
70 |
documentation to be added. |
|
71 |
||
72 |
[author:] |
|
73 |
Jan Vrany (jv@neso) |
|
74 |
||
75 |
[instance variables:] |
|
76 |
||
77 |
[class variables:] |
|
78 |
||
79 |
[see also:] |
|
80 |
||
81 |
" |
|
82 |
! |
|
83 |
||
84 |
examples |
|
85 |
" |
|
86 |
Starting the application: |
|
87 |
[exBegin] |
|
88 |
Tools::LintRuleSelectionDialog open |
|
89 |
||
90 |
[exEnd] |
|
91 |
||
92 |
more examples to be added: |
|
93 |
[exBegin] |
|
94 |
... add code fragment for |
|
95 |
... executable example here ... |
|
96 |
[exEnd] |
|
97 |
" |
|
98 |
! ! |
|
99 |
||
100 |
!LintRuleEditDialog class methodsFor:'interface specs'! |
|
101 |
||
102 |
windowSpec |
|
103 |
"This resource specification was automatically generated |
|
104 |
by the UIPainter of ST/X." |
|
105 |
||
106 |
"Do not manually edit this!! If it is corrupted, |
|
107 |
the UIPainter may not be able to read the specification." |
|
108 |
||
109 |
" |
|
110 |
UIPainter new openOnClass:Tools::LintRuleEditDialog andSelector:#windowSpec |
|
111 |
Tools::LintRuleEditDialog new openInterface:#windowSpec |
|
112 |
Tools::LintRuleEditDialog open |
|
113 |
" |
|
114 |
||
115 |
<resource: #canvas> |
|
116 |
||
117 |
^ |
|
118 |
#(FullSpec |
|
119 |
name: windowSpec |
|
120 |
window: |
|
121 |
(WindowSpec |
|
122 |
label: 'Select Lint Rules' |
|
123 |
name: 'Select Lint Rules' |
|
124 |
min: (Point 10 10) |
|
125 |
bounds: (Rectangle 0 0 600 400) |
|
126 |
) |
|
127 |
component: |
|
128 |
(SpecCollection |
|
129 |
collection: ( |
|
130 |
(VerticalPanelViewSpec |
|
131 |
name: 'Content' |
|
132 |
layout: (LayoutFrame 0 0 0 0 0 1 -30 1) |
|
133 |
horizontalLayout: fit |
|
134 |
verticalLayout: topFit |
|
135 |
horizontalSpace: 3 |
|
136 |
verticalSpace: 3 |
|
137 |
component: |
|
138 |
(SpecCollection |
|
139 |
collection: ( |
|
140 |
(ViewSpec |
|
141 |
name: 'NameBox' |
|
142 |
component: |
|
143 |
(SpecCollection |
|
144 |
collection: ( |
|
145 |
(LabelSpec |
|
146 |
label: 'Name:' |
|
147 |
name: 'Label1' |
|
148 |
layout: (LayoutFrame 0 0 0 0 60 0 0 1) |
|
149 |
translateLabel: true |
|
150 |
adjust: left |
|
151 |
) |
|
152 |
(InputFieldSpec |
|
153 |
name: 'EntryField1' |
|
154 |
layout: (LayoutFrame 60 0 3 0 0 1 -2 1) |
|
155 |
model: nameHolder |
|
156 |
acceptOnReturn: true |
|
157 |
acceptOnTab: true |
|
158 |
acceptOnPointerLeave: true |
|
159 |
) |
|
160 |
) |
|
161 |
||
162 |
) |
|
163 |
extent: (Point 600 25) |
|
164 |
) |
|
165 |
(ViewSpec |
|
166 |
name: 'Spacer' |
|
167 |
extent: (Point 600 7) |
|
168 |
) |
|
169 |
(LabelSpec |
|
170 |
label: 'Rules' |
|
171 |
name: 'Label2' |
|
172 |
translateLabel: true |
|
173 |
adjust: left |
|
174 |
extent: (Point 600 25) |
|
175 |
) |
|
176 |
(VariableVerticalPanelSpec |
|
177 |
name: 'VariableVerticalPanel1' |
|
178 |
component: |
|
179 |
(SpecCollection |
|
180 |
collection: ( |
|
181 |
(SubCanvasSpec |
|
182 |
name: 'RuleList' |
|
183 |
hasHorizontalScrollBar: false |
|
184 |
hasVerticalScrollBar: false |
|
185 |
majorKey: #'Tools::HierarchicalLintRuleList' |
|
186 |
subAspectHolders: |
|
187 |
(Array |
|
188 |
||
189 |
(SubChannelInfoSpec |
|
190 |
subAspect: inGeneratorHolder |
|
191 |
aspect: allRulesHolder |
|
192 |
) |
|
193 |
(SubChannelInfoSpec |
|
194 |
subAspect: listSelection |
|
195 |
aspect: listSelection |
|
196 |
) |
|
197 |
||
198 |
(SubChannelInfoSpec |
|
199 |
subAspect: modeHolder |
|
200 |
aspect: modeHolder |
|
201 |
) |
|
202 |
(SubChannelInfoSpec |
|
203 |
subAspect: outGeneratorHolder |
|
204 |
aspect: selectedRulesHolder |
|
205 |
) |
|
206 |
||
207 |
(SubChannelInfoSpec |
|
208 |
subAspect: selectionHolder |
|
209 |
aspect: selectionHolder |
|
210 |
) |
|
211 |
) |
|
212 |
createNewApplication: true |
|
213 |
createNewBuilder: true |
|
214 |
) |
|
215 |
(SubCanvasSpec |
|
216 |
name: 'RuleDesc' |
|
217 |
hasHorizontalScrollBar: false |
|
218 |
hasVerticalScrollBar: false |
|
219 |
majorKey: #'Tools::LintRuleDetail' |
|
220 |
subAspectHolders: |
|
221 |
(Array |
|
222 |
||
223 |
(SubChannelInfoSpec |
|
224 |
subAspect: ruleHolder |
|
225 |
aspect: listSelection |
|
226 |
) |
|
227 |
) |
|
228 |
createNewApplication: true |
|
229 |
createNewBuilder: true |
|
230 |
) |
|
231 |
) |
|
232 |
||
233 |
) |
|
234 |
extent: (Point 600 304) |
|
235 |
handles: (Any 0.75 1.0) |
|
236 |
) |
|
237 |
) |
|
238 |
||
239 |
) |
|
240 |
) |
|
241 |
(HorizontalPanelViewSpec |
|
242 |
name: 'BottonPanel' |
|
243 |
layout: (LayoutFrame 0 0 -30 1 0 1 0 1) |
|
244 |
horizontalLayout: fitSpace |
|
245 |
verticalLayout: center |
|
246 |
horizontalSpace: 3 |
|
247 |
verticalSpace: 3 |
|
248 |
reverseOrderIfOKAtLeft: true |
|
249 |
component: |
|
250 |
(SpecCollection |
|
251 |
collection: ( |
|
252 |
(ActionButtonSpec |
|
253 |
label: 'Cancel' |
|
254 |
name: 'CancelButton' |
|
255 |
translateLabel: true |
|
256 |
model: doCancel |
|
257 |
extent: (Point 295 22) |
|
258 |
) |
|
259 |
(ActionButtonSpec |
|
260 |
label: 'OK' |
|
261 |
name: 'OKButton' |
|
262 |
translateLabel: true |
|
263 |
model: doAccept |
|
264 |
isDefault: true |
|
265 |
defaultable: true |
|
266 |
extent: (Point 296 22) |
|
267 |
) |
|
268 |
) |
|
269 |
||
270 |
) |
|
271 |
) |
|
272 |
) |
|
273 |
||
274 |
) |
|
275 |
) |
|
276 |
! ! |
|
277 |
||
278 |
!LintRuleEditDialog methodsFor:'accessing'! |
|
279 |
||
280 |
rule: anRBCompositeLintRule |
|
281 |
self ruleHolder value: anRBCompositeLintRule |
|
282 |
||
283 |
"Created: / 27-02-2013 / 11:53:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
284 |
! |
|
285 |
||
286 |
selection |
|
287 |
||
288 |
^self selectionHolder value |
|
289 |
||
290 |
"Created: / 25-08-2010 / 14:10:03 / Jan Vrany <enter your email here>" |
|
291 |
! |
|
292 |
||
293 |
selection: anObject |
|
294 |
||
295 |
self selectionHolder value: anObject |
|
296 |
||
297 |
"Created: / 25-08-2010 / 14:09:40 / Jan Vrany <enter your email here>" |
|
298 |
! ! |
|
299 |
||
300 |
!LintRuleEditDialog methodsFor:'actions'! |
|
301 |
||
302 |
hideResultView |
|
303 |
||
304 |
detailsShown == true ifFalse:[^self]. |
|
305 |
||
306 |
variablePanel shown ifFalse:[^self]. |
|
307 |
||
308 |
relativeCorners := variablePanel relativeCorners. |
|
309 |
||
310 |
variablePanel |
|
311 |
relativeCorners:#( 0.99 1.0 ); |
|
312 |
resizeSubviews. |
|
313 |
detailsShown := false. |
|
314 |
||
315 |
"Created: / 10-02-2007 / 11:39:10 / janfrog" |
|
316 |
"Modified: / 24-07-2010 / 15:30:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
317 |
! |
|
318 |
||
319 |
showResultView |
|
320 |
detailsShown == true ifTrue:[^self]. |
|
321 |
variablePanel |
|
322 |
relativeCorners:relativeCorners ? #(0.5 1.0); |
|
323 |
resizeSubviews. |
|
324 |
detailsShown := true. |
|
325 |
||
326 |
"Created: / 10-02-2007 / 11:38:26 / janfrog" |
|
327 |
"Modified: / 24-07-2010 / 15:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
328 |
! ! |
|
329 |
||
330 |
!LintRuleEditDialog methodsFor:'aspects'! |
|
331 |
||
332 |
allRulesHolder |
|
333 |
||
334 |
^[(RBCompositeLintRule allRules) rules] |
|
335 |
||
336 |
"Created: / 15-04-2010 / 20:09:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
337 |
! |
|
338 |
||
339 |
listSelection |
|
340 |
"return/create the 'listSelection' value holder (automatically generated)" |
|
341 |
||
342 |
listSelection isNil ifTrue:[ |
|
343 |
listSelection := ValueHolder new. |
|
344 |
]. |
|
345 |
^ listSelection |
|
346 |
! |
|
347 |
||
348 |
listSelection:something |
|
349 |
"set the 'listSelection' value holder (automatically generated)" |
|
350 |
||
351 |
listSelection := something. |
|
352 |
! |
|
353 |
||
354 |
modeHolder |
|
355 |
||
356 |
^[#select] |
|
357 |
||
358 |
"Created: / 15-04-2010 / 20:13:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
359 |
! |
|
360 |
||
361 |
nameHolder |
|
362 |
"return/create the 'nameHolder' value holder (automatically generated)" |
|
363 |
||
364 |
nameHolder isNil ifTrue:[ |
|
365 |
nameHolder := ValueHolder new. |
|
366 |
]. |
|
367 |
^ nameHolder |
|
368 |
! |
|
369 |
||
370 |
ruleHolder |
|
371 |
"return/create the 'ruleHolder' value holder (automatically generated)" |
|
372 |
||
373 |
ruleHolder isNil ifTrue:[ |
|
374 |
ruleHolder := ValueHolder new. |
|
375 |
ruleHolder addDependent:self. |
|
376 |
]. |
|
377 |
^ ruleHolder |
|
378 |
! |
|
379 |
||
380 |
ruleHolder:something |
|
381 |
"set the 'ruleHolder' value holder (automatically generated)" |
|
382 |
||
383 |
|oldValue newValue| |
|
384 |
||
385 |
ruleHolder notNil ifTrue:[ |
|
386 |
oldValue := ruleHolder value. |
|
387 |
ruleHolder removeDependent:self. |
|
388 |
]. |
|
389 |
ruleHolder := something. |
|
390 |
ruleHolder notNil ifTrue:[ |
|
391 |
ruleHolder addDependent:self. |
|
392 |
]. |
|
393 |
newValue := ruleHolder value. |
|
394 |
oldValue ~~ newValue ifTrue:[ |
|
395 |
self update:#value with:newValue from:ruleHolder. |
|
396 |
]. |
|
397 |
! |
|
398 |
||
399 |
selectionHolder |
|
400 |
"return/create the 'selectionHolder' value holder (automatically generated)" |
|
401 |
||
402 |
selectionHolder isNil ifTrue:[ |
|
403 |
selectionHolder := ValueHolder new. |
|
404 |
]. |
|
405 |
^ selectionHolder |
|
406 |
! ! |
|
407 |
||
408 |
!LintRuleEditDialog methodsFor:'callbacks - post build'! |
|
409 |
||
410 |
postBuildVariablePanel: aPanel |
|
411 |
||
412 |
variablePanel := aPanel. |
|
413 |
||
414 |
"Created: / 24-07-2010 / 15:05:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
415 |
! ! |
|
416 |
||
417 |
!LintRuleEditDialog methodsFor:'change & update'! |
|
418 |
||
419 |
update:something with:aParameter from:changedObject |
|
420 |
"Invoked when an object that I depend upon sends a change notification." |
|
421 |
||
422 |
"stub code automatically generated - please change as required" |
|
423 |
||
424 |
changedObject == ruleHolder ifTrue:[ |
|
425 |
self updateSelection. |
|
426 |
self updateName. |
|
427 |
^ self. |
|
428 |
]. |
|
429 |
changedObject == accept ifTrue:[ |
|
430 |
self ruleHolder value name: self nameHolder value. |
|
431 |
self ruleHolder value rules: self selectionHolder value. |
|
14153
9164af5ffe74
class: Tools::LintRuleEditDialog
Stefan Vogel <sv@exept.de>
parents:
13810
diff
changeset
|
432 |
self acceptValue:self ruleHolder value. |
13810 | 433 |
]. |
434 |
super update:something with:aParameter from:changedObject |
|
435 |
||
436 |
"Modified: / 27-02-2013 / 11:52:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
437 |
! |
|
438 |
||
439 |
updateName |
|
440 |
self nameHolder value: (self ruleHolder value name) |
|
441 |
||
442 |
"Created: / 27-02-2013 / 11:46:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
443 |
! |
|
444 |
||
445 |
updateSelection |
|
446 |
self selectionHolder value: (self ruleHolder value flattened) |
|
447 |
||
448 |
"Created: / 27-02-2013 / 11:42:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
449 |
! ! |
|
450 |
||
451 |
!LintRuleEditDialog methodsFor:'initialization'! |
|
452 |
||
453 |
initialize |
|
454 |
super initialize. |
|
455 |
accept addDependent: self. |
|
456 |
||
457 |
"Created: / 27-02-2013 / 11:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
458 |
! ! |
|
459 |
||
460 |
!LintRuleEditDialog class methodsFor:'documentation'! |
|
461 |
||
462 |
version |
|
14153
9164af5ffe74
class: Tools::LintRuleEditDialog
Stefan Vogel <sv@exept.de>
parents:
13810
diff
changeset
|
463 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleEditDialog.st,v 1.2 2014-03-24 09:08:10 stefan Exp $' |
13810 | 464 |
! |
465 |
||
466 |
version_CVS |
|
14153
9164af5ffe74
class: Tools::LintRuleEditDialog
Stefan Vogel <sv@exept.de>
parents:
13810
diff
changeset
|
467 |
^ '$Header: /cvs/stx/stx/libtool/Tools__LintRuleEditDialog.st,v 1.2 2014-03-24 09:08:10 stefan Exp $' |
13810 | 468 |
! ! |
469 |