300
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
ApplicationModel subclass:#HierarchicalListEditor
|
|
17 |
instanceVariableNames:'didInstall treeView specClass specSelector'
|
|
18 |
classVariableNames:'CopyBuffer IconCreateChild IconCreateSister'
|
|
19 |
poolDictionaries:''
|
|
20 |
category:'Interface-UIPainter'
|
|
21 |
!
|
|
22 |
|
|
23 |
!HierarchicalListEditor class methodsFor:'documentation'!
|
|
24 |
|
|
25 |
copyright
|
|
26 |
"
|
|
27 |
COPYRIGHT (c) 1997 by eXept Software AG / Claus Gittinger
|
|
28 |
All Rights Reserved
|
|
29 |
|
|
30 |
This software is furnished under a license and may be used
|
|
31 |
only in accordance with the terms of that license and with the
|
|
32 |
inclusion of the above copyright notice. This software may not
|
|
33 |
be provided or otherwise made available to, or used by, any
|
|
34 |
other person. No title to or ownership of the software is
|
|
35 |
hereby transferred.
|
|
36 |
"
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
!
|
|
41 |
|
|
42 |
documentation
|
|
43 |
"
|
|
44 |
HierarchicalListEditor is used by the UIPainter to
|
|
45 |
create or maintain a hierarchical list.
|
|
46 |
|
|
47 |
[start with:]
|
|
48 |
HierarchicalListEditor open
|
|
49 |
|
|
50 |
[see also:]
|
|
51 |
UIPainter
|
|
52 |
|
|
53 |
[author:]
|
|
54 |
Claus Atzkern
|
|
55 |
"
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
! !
|
|
60 |
|
|
61 |
!HierarchicalListEditor class methodsFor:'icons'!
|
|
62 |
|
|
63 |
iconCreateChild
|
|
64 |
|
|
65 |
IconCreateChild isNil ifTrue:[
|
|
66 |
IconCreateChild := Image fromFile:'/home/ca/st/images/ui_hierListChild.xpm'.
|
|
67 |
|
|
68 |
IconCreateChild isNil ifTrue:[
|
|
69 |
IconCreateChild := MenuEditor iconCreateMenu
|
|
70 |
].
|
|
71 |
].
|
|
72 |
^ IconCreateChild.
|
|
73 |
|
|
74 |
"
|
|
75 |
IconCreateChild := nil
|
|
76 |
"
|
|
77 |
!
|
|
78 |
|
|
79 |
iconCreateSister
|
|
80 |
|
|
81 |
IconCreateSister isNil ifTrue:[
|
|
82 |
IconCreateSister := Image fromFile:'/home/ca/st/images/ui_hierListSister.xpm'.
|
|
83 |
|
|
84 |
IconCreateSister isNil ifTrue:[
|
|
85 |
IconCreateSister := MenuEditor iconCreateItem
|
|
86 |
]
|
|
87 |
].
|
|
88 |
^ IconCreateSister.
|
|
89 |
|
|
90 |
"
|
|
91 |
IconCreateSister := nil
|
|
92 |
"
|
|
93 |
! !
|
|
94 |
|
|
95 |
!HierarchicalListEditor class methodsFor:'interface specs'!
|
|
96 |
|
|
97 |
classAndMethodSpec
|
|
98 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
99 |
|
|
100 |
"do not manually edit this - the painter/builder may not be able to
|
|
101 |
handle the specification if its corrupted."
|
|
102 |
|
|
103 |
"
|
|
104 |
UIPainter new openOnClass:HierarchicalListEditor andSelector:#classAndMethodSpec
|
|
105 |
HierarchicalListEditor new openInterface:#classAndMethodSpec
|
|
106 |
"
|
|
107 |
|
|
108 |
<resource: #canvas>
|
|
109 |
|
|
110 |
^
|
|
111 |
|
|
112 |
#(#FullSpec
|
|
113 |
#'window:'
|
|
114 |
#(#WindowSpec
|
|
115 |
#'name:' 'Painter'
|
|
116 |
#'layout:' #(#LayoutFrame 199 0 167 0 589 0 336 0)
|
|
117 |
#'label:' 'Painter'
|
|
118 |
#'min:' #(#Point 10 10)
|
|
119 |
#'max:' #(#Point 1160 870)
|
|
120 |
#'bounds:' #(#Rectangle 199 167 590 337)
|
|
121 |
)
|
|
122 |
#'component:'
|
|
123 |
#(#SpecCollection
|
|
124 |
#'collection:'
|
|
125 |
#(
|
|
126 |
#(#LabelSpec
|
|
127 |
#'name:' 'boxLabel'
|
|
128 |
#'layout:' #(#Point 5 10)
|
|
129 |
#'label:' 'class & method for code:'
|
|
130 |
#'adjust:' #left
|
|
131 |
#'resizeForLabel:' true
|
|
132 |
)
|
|
133 |
#(#LabelSpec
|
|
134 |
#'name:' 'classLabel'
|
|
135 |
#'layout:' #(#AlignmentOrigin 45 0.11 51 0 1 0.5)
|
|
136 |
#'label:' 'class:'
|
|
137 |
#'adjust:' #right
|
|
138 |
#'resizeForLabel:' true
|
|
139 |
)
|
|
140 |
#(#InputFieldSpec
|
|
141 |
#'name:' 'classField'
|
|
142 |
#'layout:' #(#LayoutFrame 47 0.11 39 0 -2 1.0 61 0)
|
|
143 |
#'tabable:' true
|
|
144 |
#'model:' #specClassChannel
|
|
145 |
)
|
|
146 |
#(#LabelSpec
|
|
147 |
#'name:' 'methodLabel'
|
|
148 |
#'layout:' #(#AlignmentOrigin 45 0.11 74 0 1 0.5)
|
|
149 |
#'label:' 'method:'
|
|
150 |
#'adjust:' #right
|
|
151 |
#'resizeForLabel:' true
|
|
152 |
)
|
|
153 |
#(#InputFieldSpec
|
|
154 |
#'name:' 'methodField'
|
|
155 |
#'layout:' #(#LayoutFrame 47 0.11 64 0 -2 1.0 86 0)
|
|
156 |
#'tabable:' true
|
|
157 |
#'model:' #specSelectorChannel
|
|
158 |
#'type:' #string
|
|
159 |
)
|
|
160 |
#(#HorizontalPanelViewSpec
|
|
161 |
#'name:' 'commitPanel'
|
|
162 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0)
|
|
163 |
#'component:'
|
|
164 |
#(#SpecCollection
|
|
165 |
#'collection:'
|
|
166 |
#(
|
|
167 |
#(#ActionButtonSpec
|
|
168 |
#'name:' 'cancel'
|
|
169 |
#'label:' 'cancel'
|
|
170 |
#'tabable:' true
|
|
171 |
#'model:' #cancel
|
|
172 |
#'extent:' #(#Point 191 24)
|
|
173 |
)
|
|
174 |
#(#ActionButtonSpec
|
|
175 |
#'name:' 'accept'
|
|
176 |
#'label:' 'ok'
|
|
177 |
#'tabable:' true
|
|
178 |
#'isDefault:' true
|
|
179 |
#'model:' #accept
|
|
180 |
#'extent:' #(#Point 191 24)
|
|
181 |
)
|
|
182 |
)
|
|
183 |
)
|
|
184 |
#'horizontalLayout:' #fitSpace
|
|
185 |
#'verticalLayout:' #fit
|
|
186 |
#'horizontalSpace:' 3
|
|
187 |
#'verticalSpace:' 3
|
|
188 |
)
|
|
189 |
)
|
|
190 |
)
|
|
191 |
)
|
|
192 |
!
|
|
193 |
|
|
194 |
menuButtons
|
|
195 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
196 |
|
|
197 |
"do not manually edit this - the builder may not be able to
|
|
198 |
handle the specification if its corrupted."
|
|
199 |
|
|
200 |
"
|
|
201 |
MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menuButtons
|
|
202 |
(Menu new fromLiteralArrayEncoding:(HierarchicalListEditor menuButtons)) startUp
|
|
203 |
"
|
|
204 |
|
|
205 |
<resource: #menu>
|
|
206 |
|
|
207 |
^
|
|
208 |
|
|
209 |
#(#Menu
|
|
210 |
|
|
211 |
#(
|
|
212 |
#(#MenuItem
|
|
213 |
#'label:' 'createChild'
|
|
214 |
#'value:' #doCreateChild
|
|
215 |
#'enabled:' #canCreateChildChannel
|
|
216 |
#'labelImage:' #(#ResourceRetriever #HierarchicalListEditor #iconCreateChild)
|
|
217 |
)
|
|
218 |
#(#MenuItem
|
|
219 |
#'label:' 'createSister'
|
|
220 |
#'value:' #doCreateSister
|
|
221 |
#'enabled:' #canCreateSisterChannel
|
|
222 |
#'labelImage:' #(#ResourceRetriever #HierarchicalListEditor #iconCreateSister)
|
|
223 |
)
|
|
224 |
#(#MenuItem
|
|
225 |
#'label:' '-'
|
|
226 |
)
|
|
227 |
#(#MenuItem
|
|
228 |
#'label:' ''
|
|
229 |
)
|
|
230 |
#(#MenuItem
|
|
231 |
#'label:' '-'
|
|
232 |
)
|
|
233 |
#(#MenuItem
|
|
234 |
#'label:' 'stepUp'
|
|
235 |
#'value:' #doStepUp
|
|
236 |
#'enabled:' #canStepOverChannel
|
|
237 |
#'labelImage:' #(#ResourceRetriever #UIPainter #iconStepUp)
|
|
238 |
)
|
|
239 |
#(#MenuItem
|
|
240 |
#'label:' '-'
|
|
241 |
)
|
|
242 |
#(#MenuItem
|
|
243 |
#'label:' 'stepDown'
|
|
244 |
#'value:' #doStepDown
|
|
245 |
#'enabled:' #canStepOverChannel
|
|
246 |
#'labelImage:' #(#ResourceRetriever #UIPainter #iconStepDown)
|
|
247 |
)
|
|
248 |
#(#MenuItem
|
|
249 |
#'label:' '-'
|
|
250 |
)
|
|
251 |
#(#MenuItem
|
|
252 |
#'label:' 'stepIn'
|
|
253 |
#'value:' #doStepIn
|
|
254 |
#'enabled:' #canStepInChannel
|
|
255 |
#'labelImage:' #(#ResourceRetriever #UIPainter #iconStepIn)
|
|
256 |
)
|
|
257 |
#(#MenuItem
|
|
258 |
#'label:' '-'
|
|
259 |
)
|
|
260 |
#(#MenuItem
|
|
261 |
#'label:' 'stepOut'
|
|
262 |
#'value:' #doStepOut
|
|
263 |
#'enabled:' #canStepOutChannel
|
|
264 |
#'labelImage:' #(#ResourceRetriever #UIPainter #iconStepOut)
|
|
265 |
)
|
|
266 |
#(#MenuItem
|
|
267 |
#'label:' '-'
|
|
268 |
)
|
|
269 |
) nil
|
|
270 |
nil
|
|
271 |
)
|
|
272 |
!
|
|
273 |
|
|
274 |
menuMain
|
|
275 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
276 |
|
|
277 |
"do not manually edit this - the builder may not be able to
|
|
278 |
handle the specification if its corrupted."
|
|
279 |
|
|
280 |
"
|
|
281 |
MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menuMain
|
|
282 |
(Menu new fromLiteralArrayEncoding:(HierarchicalListEditor menuMain)) startUp
|
|
283 |
"
|
|
284 |
|
|
285 |
<resource: #menu>
|
|
286 |
|
|
287 |
^
|
|
288 |
|
|
289 |
#(#Menu
|
|
290 |
|
|
291 |
#(
|
|
292 |
#(#MenuItem
|
|
293 |
#'label:' 'file'
|
|
294 |
#'submenu:'
|
|
295 |
#(#Menu
|
|
296 |
|
|
297 |
#(
|
|
298 |
#(#MenuItem
|
|
299 |
#'label:' 'new'
|
|
300 |
#'value:' #doNew
|
|
301 |
)
|
|
302 |
#(#MenuItem
|
|
303 |
#'label:' 'reload'
|
|
304 |
#'value:' #doReload
|
|
305 |
)
|
|
306 |
#(#MenuItem
|
|
307 |
#'label:' '='
|
|
308 |
)
|
|
309 |
#(#MenuItem
|
|
310 |
#'label:' 'quit'
|
|
311 |
#'value:' #closeRequest
|
|
312 |
)
|
|
313 |
) nil
|
|
314 |
nil
|
|
315 |
)
|
|
316 |
)
|
|
317 |
#(#MenuItem
|
|
318 |
#'label:' 'code'
|
|
319 |
#'submenu:'
|
|
320 |
#(#Menu
|
|
321 |
|
|
322 |
#(
|
|
323 |
#(#MenuItem
|
|
324 |
#'label:' 'class && method'
|
|
325 |
#'value:' #doDefineClass
|
|
326 |
#'enabled:' #canChangeClassName
|
|
327 |
)
|
|
328 |
#(#MenuItem
|
|
329 |
#'label:' 'method'
|
|
330 |
#'value:' #doDefineSelector
|
|
331 |
#'enabled:' #hasValidClass
|
|
332 |
)
|
|
333 |
#(#MenuItem
|
|
334 |
#'label:' '-'
|
|
335 |
)
|
|
336 |
#(#MenuItem
|
|
337 |
#'label:' 'install spec.'
|
|
338 |
#'value:' #doInstall
|
|
339 |
#'enabled:' #hasValidClass
|
|
340 |
)
|
|
341 |
#(#MenuItem
|
|
342 |
#'label:' '-'
|
|
343 |
)
|
|
344 |
#(#MenuItem
|
|
345 |
#'label:' 'browse'
|
|
346 |
#'enabled:' #hasValidClass
|
|
347 |
#'submenu:'
|
|
348 |
#(#Menu
|
|
349 |
|
|
350 |
#(
|
|
351 |
#(#MenuItem
|
|
352 |
#'label:' 'class'
|
|
353 |
#'value:' #'doBrowse:'
|
|
354 |
#'argument:' #class
|
|
355 |
)
|
|
356 |
#(#MenuItem
|
|
357 |
#'label:' '-'
|
|
358 |
)
|
|
359 |
#(#MenuItem
|
|
360 |
#'label:' 'specification'
|
|
361 |
#'value:' #'doBrowse:'
|
|
362 |
#'enabled:' #hasValidSpecSelector
|
|
363 |
#'argument:' #spec
|
|
364 |
)
|
|
365 |
#(#MenuItem
|
|
366 |
#'label:' 'method'
|
|
367 |
#'value:' #'doBrowse:'
|
|
368 |
#'enabled:' #hasValidMethodSelector
|
|
369 |
#'argument:' #method
|
|
370 |
)
|
|
371 |
) nil
|
|
372 |
nil
|
|
373 |
)
|
|
374 |
)
|
|
375 |
) nil
|
|
376 |
nil
|
|
377 |
)
|
|
378 |
)
|
|
379 |
) nil
|
|
380 |
nil
|
|
381 |
)
|
|
382 |
!
|
|
383 |
|
|
384 |
menuTree
|
|
385 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
386 |
|
|
387 |
"do not manually edit this - the builder may not be able to
|
|
388 |
handle the specification if its corrupted."
|
|
389 |
|
|
390 |
"
|
|
391 |
MenuEditor new openOnClass:HierarchicalListEditor andSelector:#menuTree
|
|
392 |
(Menu new fromLiteralArrayEncoding:(HierarchicalListEditor menuTree)) startUp
|
|
393 |
"
|
|
394 |
|
|
395 |
<resource: #menu>
|
|
396 |
|
|
397 |
^
|
|
398 |
|
|
399 |
#(#Menu
|
|
400 |
|
|
401 |
#(
|
|
402 |
#(#MenuItem
|
|
403 |
#'label:' 'copy'
|
|
404 |
#'value:' #doCopy
|
|
405 |
#'enabled:' #canCopy
|
|
406 |
)
|
|
407 |
#(#MenuItem
|
|
408 |
#'label:' 'cut'
|
|
409 |
#'value:' #doCut
|
|
410 |
#'enabled:' #canCut
|
|
411 |
)
|
|
412 |
#(#MenuItem
|
|
413 |
#'label:' 'paste'
|
|
414 |
#'value:' #doPaste
|
|
415 |
#'enabled:' #canPaste
|
|
416 |
)
|
|
417 |
) nil
|
|
418 |
nil
|
|
419 |
)
|
|
420 |
!
|
|
421 |
|
|
422 |
methodSpec
|
|
423 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
424 |
|
|
425 |
"do not manually edit this - the painter/builder may not be able to
|
|
426 |
handle the specification if its corrupted."
|
|
427 |
|
|
428 |
"
|
|
429 |
UIPainter new openOnClass:HierarchicalListEditor andSelector:#methodSpec
|
|
430 |
HierarchicalListEditor new openInterface:#methodSpec
|
|
431 |
"
|
|
432 |
|
|
433 |
<resource: #canvas>
|
|
434 |
|
|
435 |
^
|
|
436 |
|
|
437 |
#(#FullSpec
|
|
438 |
#'window:'
|
|
439 |
#(#WindowSpec
|
|
440 |
#'name:' 'Painter'
|
|
441 |
#'layout:' #(#LayoutFrame 275 0 381 0 665 0 550 0)
|
|
442 |
#'label:' 'Painter'
|
|
443 |
#'min:' #(#Point 10 10)
|
|
444 |
#'max:' #(#Point 1160 870)
|
|
445 |
#'bounds:' #(#Rectangle 275 381 666 551)
|
|
446 |
)
|
|
447 |
#'component:'
|
|
448 |
#(#SpecCollection
|
|
449 |
#'collection:'
|
|
450 |
#(
|
|
451 |
#(#LabelSpec
|
|
452 |
#'name:' 'boxLabel'
|
|
453 |
#'layout:' #(#Point 5 10)
|
|
454 |
#'label:' 'class & method for code:'
|
|
455 |
#'adjust:' #left
|
|
456 |
#'resizeForLabel:' true
|
|
457 |
)
|
|
458 |
#(#LabelSpec
|
|
459 |
#'name:' 'methodLabel'
|
|
460 |
#'layout:' #(#AlignmentOrigin 45 0.11 74 0 1 0.5)
|
|
461 |
#'label:' 'method:'
|
|
462 |
#'adjust:' #right
|
|
463 |
#'resizeForLabel:' true
|
|
464 |
)
|
|
465 |
#(#InputFieldSpec
|
|
466 |
#'name:' 'methodField'
|
|
467 |
#'layout:' #(#LayoutFrame 47 0.11 64 0 -2 1.0 86 0)
|
|
468 |
#'tabable:' true
|
|
469 |
#'model:' #specSelectorChannel
|
|
470 |
#'type:' #string
|
|
471 |
)
|
|
472 |
#(#HorizontalPanelViewSpec
|
|
473 |
#'name:' 'commitPanel'
|
|
474 |
#'layout:' #(#LayoutFrame 0 0.0 -24 1.0 0 1.0 0 1.0)
|
|
475 |
#'component:'
|
|
476 |
#(#SpecCollection
|
|
477 |
#'collection:'
|
|
478 |
#(
|
|
479 |
#(#ActionButtonSpec
|
|
480 |
#'name:' 'cancel'
|
|
481 |
#'label:' 'cancel'
|
|
482 |
#'tabable:' true
|
|
483 |
#'model:' #cancel
|
|
484 |
#'extent:' #(#Point 191 24)
|
|
485 |
)
|
|
486 |
#(#ActionButtonSpec
|
|
487 |
#'name:' 'accept'
|
|
488 |
#'label:' 'ok'
|
|
489 |
#'tabable:' true
|
|
490 |
#'isDefault:' true
|
|
491 |
#'model:' #accept
|
|
492 |
#'extent:' #(#Point 191 24)
|
|
493 |
)
|
|
494 |
)
|
|
495 |
)
|
|
496 |
#'horizontalLayout:' #fitSpace
|
|
497 |
#'verticalLayout:' #fit
|
|
498 |
#'horizontalSpace:' 3
|
|
499 |
#'verticalSpace:' 3
|
|
500 |
)
|
|
501 |
)
|
|
502 |
)
|
|
503 |
)
|
|
504 |
!
|
|
505 |
|
|
506 |
windowSpec
|
|
507 |
"this window spec was automatically generated by the ST/X UIPainter"
|
|
508 |
|
|
509 |
"do not manually edit this - the painter/builder may not be able to
|
|
510 |
handle the specification if its corrupted."
|
|
511 |
|
|
512 |
"
|
|
513 |
UIPainter new openOnClass:HierarchicalListEditor andSelector:#windowSpec
|
|
514 |
HierarchicalListEditor new openInterface:#windowSpec
|
|
515 |
"
|
|
516 |
"HierarchicalListEditor open"
|
|
517 |
|
|
518 |
<resource: #canvas>
|
|
519 |
|
|
520 |
^
|
|
521 |
|
|
522 |
#(#FullSpec
|
|
523 |
#'window:'
|
|
524 |
#(#WindowSpec
|
|
525 |
#'name:' 'HierarchicalListEditor'
|
|
526 |
#'layout:' #(#LayoutFrame 437 0 260 0 1004 0 554 0)
|
|
527 |
#'label:' 'Hierarchical List Editor'
|
|
528 |
#'min:' #(#Point 10 10)
|
|
529 |
#'max:' #(#Point 1160 870)
|
|
530 |
#'bounds:' #(#Rectangle 437 260 1005 555)
|
|
531 |
)
|
|
532 |
#'component:'
|
|
533 |
#(#SpecCollection
|
|
534 |
#'collection:'
|
|
535 |
#(
|
|
536 |
#(#MenuPanelSpec
|
|
537 |
#'name:' 'menuMain'
|
|
538 |
#'layout:' #(#LayoutFrame 0 0.0 0 0 0 1.0 25 0)
|
|
539 |
#'menu:' #menuMain
|
|
540 |
)
|
|
541 |
#(#VariableHorizontalPanelSpec
|
|
542 |
#'name:' 'variableHorizontalPanel1'
|
|
543 |
#'layout:' #(#LayoutFrame 0 0.0 26 0.0 0 1.0 0 1.0)
|
|
544 |
#'component:'
|
|
545 |
#(#SpecCollection
|
|
546 |
#'collection:'
|
|
547 |
#(
|
|
548 |
#(#ViewSpec
|
|
549 |
#'name:' 'view1'
|
|
550 |
#'component:'
|
|
551 |
#(#SpecCollection
|
|
552 |
#'collection:'
|
|
553 |
#(
|
|
554 |
#(#MenuPanelSpec
|
|
555 |
#'name:' 'menuButtons'
|
|
556 |
#'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 28 0)
|
|
557 |
#'menu:' #menuButtons
|
|
558 |
)
|
|
559 |
#(#ArbitraryComponentSpec
|
|
560 |
#'name:' 'treeView'
|
|
561 |
#'layout:' #(#LayoutFrame 0 0.0 28 0.0 0 1.0 0 1.0)
|
|
562 |
#'menu:' #menuTree
|
|
563 |
#'hasHorizontalScrollBar:' true
|
|
564 |
#'hasVerticalScrollBar:' true
|
|
565 |
#'miniScrollerHorizontal:' true
|
|
566 |
#'miniScrollerVertical:' true
|
|
567 |
#'component:' #treeView
|
|
568 |
#'hasBorder:' false
|
|
569 |
)
|
|
570 |
)
|
|
571 |
)
|
|
572 |
)
|
|
573 |
#(#ViewSpec
|
|
574 |
#'name:' 'view2'
|
|
575 |
#'component:'
|
|
576 |
#(#SpecCollection
|
|
577 |
#'collection:'
|
|
578 |
#(
|
|
579 |
#(#ViewSpec
|
|
580 |
#'name:' 'viewSpec'
|
|
581 |
#'layout:' #(#LayoutFrame 0 0 0 0 0 0 0 0)
|
|
582 |
#'component:'
|
|
583 |
#(#SpecCollection
|
|
584 |
#'collection:'
|
|
585 |
#(
|
|
586 |
#(#LabelSpec
|
|
587 |
#'name:' 'nameLabel'
|
|
588 |
#'layout:' #(#AlignmentOrigin 75 0 36 0 1 0.5)
|
|
589 |
#'label:' 'Name:'
|
|
590 |
#'resizeForLabel:' true
|
|
591 |
)
|
|
592 |
#(#InputFieldSpec
|
|
593 |
#'name:' 'nameFiled'
|
|
594 |
#'layout:' #(#LayoutFrame 81 0 26 0 -5 1.0 48 0)
|
|
595 |
#'model:' #itemName
|
|
596 |
)
|
|
597 |
#(#LabelSpec
|
|
598 |
#'name:' 'valueLabel'
|
|
599 |
#'layout:' #(#AlignmentOrigin 75 0 71 0 1 0.5)
|
|
600 |
#'label:' 'Value:'
|
|
601 |
#'resizeForLabel:' true
|
|
602 |
)
|
|
603 |
#(#InputFieldSpec
|
|
604 |
#'name:' 'valueField'
|
|
605 |
#'layout:' #(#LayoutFrame 81 0 61 0 -5 1.0 83 0)
|
|
606 |
#'model:' #itemValue
|
|
607 |
#'type:' #symbolOrNil
|
|
608 |
)
|
|
609 |
#(#HorizontalPanelViewSpec
|
|
610 |
#'name:' 'commitPanel'
|
|
611 |
#'layout:' #(#LayoutFrame 0 0.0 -30 1.0 0 1.0 0 1.0)
|
|
612 |
#'component:'
|
|
613 |
#(#SpecCollection
|
|
614 |
#'collection:'
|
|
615 |
#(
|
|
616 |
#(#ActionButtonSpec
|
|
617 |
#'name:' 'cancelButton'
|
|
618 |
#'label:' 'cancel'
|
|
619 |
#'model:' #cancel
|
|
620 |
#'enableChannel:' #modifiedChannel
|
|
621 |
#'extent:' #(#Point 1 22)
|
|
622 |
)
|
|
623 |
#(#ActionButtonSpec
|
|
624 |
#'name:' 'acceptButton'
|
|
625 |
#'label:' 'ok'
|
|
626 |
#'model:' #accept
|
|
627 |
#'enableChannel:' #modifiedChannel
|
|
628 |
#'extent:' #(#Point 1 22)
|
|
629 |
)
|
|
630 |
)
|
|
631 |
)
|
|
632 |
#'horizontalLayout:' #fitSpace
|
|
633 |
#'verticalLayout:' #center
|
|
634 |
#'horizontalSpace:' 3
|
|
635 |
#'verticalSpace:' 3
|
|
636 |
)
|
|
637 |
)
|
|
638 |
)
|
|
639 |
)
|
|
640 |
)
|
|
641 |
)
|
|
642 |
#'borderWidth:' 1
|
|
643 |
)
|
|
644 |
)
|
|
645 |
)
|
|
646 |
#'handles:' #(#Any 0.5 1.0)
|
|
647 |
)
|
|
648 |
)
|
|
649 |
)
|
|
650 |
)
|
|
651 |
! !
|
|
652 |
|
|
653 |
!HierarchicalListEditor class methodsFor:'printing'!
|
|
654 |
|
|
655 |
prettyPrintArray:anArray on:aStream indent:anIndent
|
|
656 |
"print a literal array in a nice format
|
|
657 |
"
|
|
658 |
|arg sol|
|
|
659 |
|
|
660 |
sol := aStream position.
|
|
661 |
aStream spaces:anIndent.
|
|
662 |
aStream nextPutAll:'#('.
|
|
663 |
|
|
664 |
anArray first isSymbol ifTrue:[
|
|
665 |
arg := anArray first.
|
|
666 |
aStream nextPut:$#.
|
|
667 |
aStream nextPutAll:anArray first.
|
|
668 |
aStream cr.
|
|
669 |
anArray size == 2 ifTrue:[
|
|
670 |
self prettyPrintArray:(anArray last)
|
|
671 |
on:aStream
|
|
672 |
indent:(anIndent + 4).
|
|
673 |
].
|
|
674 |
aStream spaces:anIndent.
|
|
675 |
aStream nextPut:$).
|
|
676 |
^ self
|
|
677 |
].
|
|
678 |
|
|
679 |
aStream nextPut:$'.
|
|
680 |
aStream nextPutAll:(anArray at:1).
|
|
681 |
aStream nextPut:$'.
|
|
682 |
arg := anArray at:2 ifAbsent:nil.
|
|
683 |
|
|
684 |
arg isString ifTrue:[
|
|
685 |
aStream spaces:((50 - (aStream position - sol)) max:4).
|
|
686 |
|
|
687 |
arg isSymbol ifTrue:[
|
|
688 |
aStream nextPut:$#.
|
|
689 |
].
|
|
690 |
aStream nextPut:$'.
|
|
691 |
aStream nextPutAll:arg.
|
|
692 |
aStream nextPut:$'.
|
|
693 |
arg := anArray at:3 ifAbsent:nil.
|
|
694 |
].
|
|
695 |
arg isArray ifTrue:[
|
|
696 |
aStream nextPutAll:' #('.
|
|
697 |
aStream cr.
|
|
698 |
arg do:[:e|self prettyPrintArray:e on:aStream indent:(anIndent + 4)].
|
|
699 |
aStream spaces:anIndent.
|
|
700 |
aStream nextPut:$).
|
|
701 |
].
|
|
702 |
aStream nextPut:$).
|
|
703 |
aStream cr.
|
|
704 |
! !
|
|
705 |
|
|
706 |
!HierarchicalListEditor methodsFor:'accessing'!
|
|
707 |
|
|
708 |
didInstall
|
|
709 |
"returns true if spec was installed by operator
|
|
710 |
"
|
|
711 |
^ didInstall ? false
|
|
712 |
!
|
|
713 |
|
|
714 |
selectorName
|
|
715 |
"returns current spec. selector
|
|
716 |
"
|
|
717 |
^ specSelector
|
|
718 |
! !
|
|
719 |
|
|
720 |
!HierarchicalListEditor methodsFor:'actions'!
|
|
721 |
|
|
722 |
accept
|
|
723 |
"accept changes"
|
|
724 |
|
|
725 |
|node index|
|
|
726 |
|
|
727 |
(index := treeView selectedIndex) ~~ 0 ifTrue:[
|
|
728 |
node := treeView nodeAtIndex:index.
|
|
729 |
node name:(self itemName value).
|
|
730 |
node contents:(self itemValue value).
|
|
731 |
treeView redrawLine:index.
|
|
732 |
].
|
|
733 |
self modifiedChannel value:false.
|
|
734 |
|
|
735 |
!
|
|
736 |
|
|
737 |
cancel
|
|
738 |
"reload selected item and update channels
|
|
739 |
"
|
|
740 |
|node|
|
|
741 |
|
|
742 |
(node := treeView selectedNode) notNil ifTrue:[
|
|
743 |
self itemName value:node name.
|
|
744 |
self itemValue value:node contents.
|
|
745 |
(builder componentAt:#viewSpec) extent:1.0@1.0.
|
|
746 |
] ifFalse:[
|
|
747 |
(builder componentAt:#viewSpec) extent:0@0.
|
|
748 |
self itemName value:''.
|
|
749 |
self itemValue value:nil.
|
|
750 |
].
|
|
751 |
self modifiedChannel value:false.
|
|
752 |
! !
|
|
753 |
|
|
754 |
!HierarchicalListEditor methodsFor:'aspects'!
|
|
755 |
|
|
756 |
canCreateChildChannel
|
|
757 |
"automatically generated by UIPainter ..."
|
|
758 |
|
|
759 |
^ builder booleanValueAspectFor:#canCreateChildChannel
|
|
760 |
|
|
761 |
!
|
|
762 |
|
|
763 |
canCreateSisterChannel
|
|
764 |
"automatically generated by UIPainter ..."
|
|
765 |
|
|
766 |
^ builder booleanValueAspectFor:#canCreateSisterChannel
|
|
767 |
|
|
768 |
!
|
|
769 |
|
|
770 |
canStepInChannel
|
|
771 |
"automatically generated by UIPainter ..."
|
|
772 |
|
|
773 |
^ builder booleanValueAspectFor:#canStepInChannel
|
|
774 |
|
|
775 |
!
|
|
776 |
|
|
777 |
canStepOutChannel
|
|
778 |
"automatically generated by UIPainter ..."
|
|
779 |
|
|
780 |
^ builder booleanValueAspectFor:#canStepOutChannel
|
|
781 |
|
|
782 |
!
|
|
783 |
|
|
784 |
canStepOverChannel
|
|
785 |
"automatically generated by UIPainter ..."
|
|
786 |
|
|
787 |
^ builder booleanValueAspectFor:#canStepOverChannel
|
|
788 |
|
|
789 |
!
|
|
790 |
|
|
791 |
itemName
|
|
792 |
"automatically generated by UIPainter ..."
|
|
793 |
|
|
794 |
|holder|
|
|
795 |
|
|
796 |
(holder := builder bindingAt:#itemName) isNil ifTrue:[
|
|
797 |
builder aspectAt:#itemName put:(holder := ValueHolder new).
|
|
798 |
holder addDependent:self.
|
|
799 |
].
|
|
800 |
^ holder
|
|
801 |
!
|
|
802 |
|
|
803 |
itemValue
|
|
804 |
"automatically generated by UIPainter ..."
|
|
805 |
|
|
806 |
|holder|
|
|
807 |
|
|
808 |
(holder := builder bindingAt:#itemValue) isNil ifTrue:[
|
|
809 |
builder aspectAt:#itemValue put:(holder := ValueHolder new).
|
|
810 |
holder addDependent:self.
|
|
811 |
].
|
|
812 |
^ holder
|
|
813 |
!
|
|
814 |
|
|
815 |
modifiedChannel
|
|
816 |
"automatically generated by UIPainter ..."
|
|
817 |
|
|
818 |
^ builder booleanValueAspectFor:#modifiedChannel
|
|
819 |
|
|
820 |
!
|
|
821 |
|
|
822 |
treeView
|
|
823 |
"automatically generated by UIPainter ..."
|
|
824 |
|
|
825 |
^ treeView
|
|
826 |
! !
|
|
827 |
|
|
828 |
!HierarchicalListEditor methodsFor:'change & update'!
|
|
829 |
|
|
830 |
update:something with:aParameter from:someObject
|
|
831 |
"one of my models changed
|
|
832 |
"
|
|
833 |
self modifiedChannel value:true
|
|
834 |
! !
|
|
835 |
|
|
836 |
!HierarchicalListEditor methodsFor:'menu buttons'!
|
|
837 |
|
|
838 |
doCreateChild
|
|
839 |
"create a child within selected parent
|
|
840 |
"
|
|
841 |
|node|
|
|
842 |
|
|
843 |
(node := treeView selectedNode) notNil ifTrue:[
|
|
844 |
treeView model add:(self newItem) beforeIndex:1 below:node.
|
|
845 |
treeView selectedNodeExpand:true.
|
|
846 |
self updateChannels.
|
|
847 |
].
|
|
848 |
!
|
|
849 |
|
|
850 |
doCreateSister
|
|
851 |
"create a sister next to selected item
|
|
852 |
"
|
|
853 |
|node|
|
|
854 |
|
|
855 |
(node := treeView selectedNode) notNil ifTrue:[
|
|
856 |
node parent notNil ifTrue:[
|
|
857 |
treeView model add:(self newItem) after:node
|
|
858 |
] ifFalse:[
|
|
859 |
treeView model add:(self newItem) beforeIndex:1 below:node
|
|
860 |
].
|
|
861 |
self updateChannels
|
|
862 |
].
|
|
863 |
!
|
|
864 |
|
|
865 |
doStepDown
|
|
866 |
"move selected item after next item
|
|
867 |
"
|
|
868 |
treeView selectedNodeChangeSequenceOrder:1.
|
|
869 |
self updateChannels.
|
|
870 |
!
|
|
871 |
|
|
872 |
doStepIn
|
|
873 |
"lets become the selected item a child of its next sister
|
|
874 |
"
|
|
875 |
treeView selectedNodeBecomeChildOfNext.
|
|
876 |
self updateChannels.
|
|
877 |
!
|
|
878 |
|
|
879 |
doStepOut
|
|
880 |
"let selected node become a sister of its current parent
|
|
881 |
"
|
|
882 |
treeView selectedNodeBecomeSisterOfParent.
|
|
883 |
self updateChannels.
|
|
884 |
!
|
|
885 |
|
|
886 |
doStepUp
|
|
887 |
"move selected item before previous item
|
|
888 |
"
|
|
889 |
treeView selectedNodeChangeSequenceOrder:-1.
|
|
890 |
self updateChannels.
|
|
891 |
!
|
|
892 |
|
|
893 |
menuButtons
|
|
894 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
895 |
|
|
896 |
^ self class menuButtons
|
|
897 |
|
|
898 |
|
|
899 |
! !
|
|
900 |
|
|
901 |
!HierarchicalListEditor methodsFor:'menu main'!
|
|
902 |
|
|
903 |
doBrowse:what
|
|
904 |
"open a system browser
|
|
905 |
"
|
|
906 |
|cls sel|
|
|
907 |
|
|
908 |
(cls := specClass) notNil ifTrue:[
|
|
909 |
what == #class ifFalse:[
|
|
910 |
(sel := specSelector) isNil ifTrue:[
|
|
911 |
^ self
|
|
912 |
].
|
|
913 |
what == #spec ifTrue:[cls := cls class]
|
|
914 |
].
|
|
915 |
|
|
916 |
SystemBrowser openInClass:cls selector:sel
|
|
917 |
]
|
|
918 |
!
|
|
919 |
|
|
920 |
doDefineClass
|
|
921 |
"define class and selector
|
|
922 |
"
|
|
923 |
|sel cls bindings accepted|
|
|
924 |
|
|
925 |
masterApplication notNil ifTrue:[
|
|
926 |
^ self information:'only selector could be changed.'
|
|
927 |
].
|
|
928 |
accepted := true.
|
|
929 |
bindings := IdentityDictionary new.
|
|
930 |
|
|
931 |
specClass notNil ifTrue:[cls := specClass name asString]
|
|
932 |
ifFalse:[cls := ''].
|
|
933 |
|
|
934 |
specSelector notNil ifTrue:[sel := specSelector asString]
|
|
935 |
ifFalse:[sel := ''].
|
|
936 |
|
|
937 |
bindings at:#specSelectorChannel put:(sel asValue).
|
|
938 |
bindings at:#specClassChannel put:(cls asValue).
|
|
939 |
|
|
940 |
[accepted] whileTrue:[
|
|
941 |
accepted := self openDialogInterface:#classAndMethodSpec withBindings:bindings.
|
|
942 |
|
|
943 |
accepted ifTrue:[
|
|
944 |
cls := Smalltalk at:(bindings at:#specClassChannel) value asSymbol.
|
|
945 |
|
|
946 |
cls notNil ifTrue:[
|
|
947 |
sel := (bindings at:#specSelectorChannel) value withoutSeparators.
|
|
948 |
|
|
949 |
sel size ~~ 0 ifTrue:[
|
|
950 |
specClass := cls.
|
|
951 |
specSelector := sel asSymbol.
|
|
952 |
^ self
|
|
953 |
]
|
|
954 |
]
|
|
955 |
]
|
|
956 |
]
|
|
957 |
|
|
958 |
!
|
|
959 |
|
|
960 |
doDefineSelector
|
|
961 |
"define selector only
|
|
962 |
"
|
|
963 |
|sel cls bindings accepted|
|
|
964 |
|
|
965 |
accepted := true.
|
|
966 |
bindings := IdentityDictionary new.
|
|
967 |
|
|
968 |
specSelector notNil ifTrue:[sel := specSelector asString]
|
|
969 |
ifFalse:[sel := ''].
|
|
970 |
|
|
971 |
bindings at:#specSelectorChannel put:(sel asValue).
|
|
972 |
|
|
973 |
[accepted] whileTrue:[
|
|
974 |
accepted := self openDialogInterface:#methodSpec withBindings:bindings.
|
|
975 |
|
|
976 |
accepted ifTrue:[
|
|
977 |
sel := (bindings at:#specSelectorChannel) value withoutSeparators.
|
|
978 |
|
|
979 |
sel size ~~ 0 ifTrue:[
|
|
980 |
specSelector := sel asSymbol.
|
|
981 |
^ self
|
|
982 |
]
|
|
983 |
]
|
|
984 |
]
|
|
985 |
|
|
986 |
!
|
|
987 |
|
|
988 |
doInstall
|
|
989 |
"install code
|
|
990 |
"
|
|
991 |
|code spec category mthd stream|
|
|
992 |
|
|
993 |
(specClass notNil and:[specSelector notNil]) ifFalse:[
|
|
994 |
^ self information:'no valid class & method defined'.
|
|
995 |
].
|
|
996 |
|
|
997 |
spec := (treeView nodeAtIndex:1) literalArrayEncoding.
|
|
998 |
stream := WriteStream on:String new.
|
|
999 |
self class prettyPrintArray:spec on:stream indent:4.
|
|
1000 |
spec := stream contents.
|
|
1001 |
category := 'interface specs'.
|
|
1002 |
didInstall := true.
|
|
1003 |
|
|
1004 |
(mthd := specClass class compiledMethodAt:specSelector) notNil ifTrue:[
|
|
1005 |
category := mthd category.
|
|
1006 |
].
|
|
1007 |
|
|
1008 |
code := Character excla asString
|
|
1009 |
, specClass name , ' class methodsFor:' , category storeString
|
|
1010 |
, Character excla asString , '\\'
|
|
1011 |
|
|
1012 |
, specSelector , '\'
|
|
1013 |
, ' "this window spec was automatically generated by the ST/X HierarchicalListEditor"\\'
|
|
1014 |
, ' "do not manually edit this - the builder may not be able to\'
|
|
1015 |
, ' handle the specification if its corrupted."\\'
|
|
1016 |
, ' "\'
|
|
1017 |
, ' HierarchicalListEditor new openOnClass:' , specClass name , ' andSelector:#' , specSelector , '\'
|
|
1018 |
, ' "\'.
|
|
1019 |
|
|
1020 |
code := code
|
|
1021 |
, '\'
|
|
1022 |
, ' <resource: #hierarchicalList>\\'
|
|
1023 |
, ' ^\'
|
|
1024 |
, spec
|
|
1025 |
, ' decodeAsLiteralArray\'
|
|
1026 |
, Character excla asString
|
|
1027 |
, ' '
|
|
1028 |
, Character excla asString
|
|
1029 |
, '\\'.
|
|
1030 |
|
|
1031 |
code := code withCRs.
|
|
1032 |
(ReadStream on:code) fileIn.
|
|
1033 |
|
|
1034 |
(specClass compiledMethodAt:specSelector) isNil ifTrue:[
|
|
1035 |
category := 'aspects'.
|
|
1036 |
|
|
1037 |
code := Character excla asString
|
|
1038 |
, specClass name , ' methodsFor:' , category storeString
|
|
1039 |
, Character excla asString , '\\'
|
|
1040 |
|
|
1041 |
, specSelector , '\'
|
|
1042 |
, ' "this window spec was automatically generated by the ST/X HierarchicalListEditor"\\'
|
306
|
1043 |
, ' ^ self class ', specSelector
|
300
|
1044 |
, '\'
|
|
1045 |
, Character excla asString
|
|
1046 |
, ' '
|
|
1047 |
, Character excla asString
|
|
1048 |
, '\\'.
|
|
1049 |
|
|
1050 |
code := code withCRs.
|
|
1051 |
(ReadStream on:code) fileIn.
|
|
1052 |
].
|
|
1053 |
|
|
1054 |
|
|
1055 |
!
|
|
1056 |
|
|
1057 |
doNew
|
|
1058 |
"remove all items; restart
|
|
1059 |
"
|
306
|
1060 |
treeView root:(TreeItem name:'Anchor' contents:#anchor).
|
300
|
1061 |
treeView selection:0.
|
|
1062 |
|
|
1063 |
!
|
|
1064 |
|
|
1065 |
doReload
|
|
1066 |
"reload spec from current class and selector
|
|
1067 |
"
|
|
1068 |
self buildFrom:specClass andSelector:specSelector
|
|
1069 |
|
|
1070 |
!
|
|
1071 |
|
|
1072 |
menuMain
|
|
1073 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
1074 |
|
|
1075 |
^ self class menuMain
|
|
1076 |
|
|
1077 |
|
|
1078 |
! !
|
|
1079 |
|
|
1080 |
!HierarchicalListEditor methodsFor:'menu tree'!
|
|
1081 |
|
|
1082 |
doCopy
|
|
1083 |
"copy current selected nodes into copy buffer
|
|
1084 |
"
|
|
1085 |
CopyBuffer := OrderedCollection new.
|
|
1086 |
treeView selectedNodesDo:[:aNode| CopyBuffer add:(aNode copy)].
|
|
1087 |
|
|
1088 |
!
|
|
1089 |
|
|
1090 |
doCut
|
|
1091 |
"cut current selected nodes
|
|
1092 |
"
|
|
1093 |
treeView hasSelection ifTrue:[
|
|
1094 |
self doCopy.
|
|
1095 |
treeView selectedNodesRemove.
|
|
1096 |
self updateChannels.
|
|
1097 |
]
|
|
1098 |
!
|
|
1099 |
|
|
1100 |
doPaste
|
|
1101 |
"paste after current selected item
|
|
1102 |
"
|
|
1103 |
treeView selectedNodeAdd:CopyBuffer.
|
|
1104 |
self updateChannels.
|
|
1105 |
!
|
|
1106 |
|
|
1107 |
menuTree
|
|
1108 |
"this window spec was automatically generated by the ST/X MenuEditor"
|
|
1109 |
|
|
1110 |
^ self class menuTree
|
|
1111 |
|
|
1112 |
|
|
1113 |
! !
|
|
1114 |
|
|
1115 |
!HierarchicalListEditor methodsFor:'private'!
|
|
1116 |
|
|
1117 |
newItem
|
|
1118 |
"creates and returns a new default item
|
|
1119 |
"
|
|
1120 |
^ TreeItem name:'undefined' contents:nil
|
|
1121 |
!
|
|
1122 |
|
|
1123 |
updateChannels
|
|
1124 |
"update channels
|
|
1125 |
"
|
|
1126 |
|node parent chnStepIn chnStepOut chnStepOvr chnChild chnSister|
|
|
1127 |
|
|
1128 |
chnStepIn := chnStepOut := chnStepOvr := chnChild := chnSister := false.
|
|
1129 |
|
|
1130 |
(node := treeView selectedNode) notNil ifTrue:[
|
|
1131 |
chnChild := true.
|
|
1132 |
|
|
1133 |
(parent := node parent) notNil ifTrue:[
|
|
1134 |
chnSister := true.
|
|
1135 |
chnStepOvr := parent numberOfChildren > 1.
|
|
1136 |
chnStepOut := parent parent notNil.
|
|
1137 |
chnStepIn := node ~~ parent lastChild.
|
|
1138 |
]
|
|
1139 |
].
|
|
1140 |
self canCreateChildChannel value:chnChild.
|
|
1141 |
self canCreateSisterChannel value:chnSister.
|
|
1142 |
self canStepOverChannel value:chnStepOvr.
|
|
1143 |
self canStepOutChannel value:chnStepOut.
|
|
1144 |
self canStepInChannel value:chnStepIn.
|
|
1145 |
! !
|
|
1146 |
|
|
1147 |
!HierarchicalListEditor methodsFor:'queries'!
|
|
1148 |
|
|
1149 |
canChangeClassName
|
|
1150 |
"returns true if current class could be changed which is dependent on
|
|
1151 |
the mode: standalone or started by UIPainter
|
|
1152 |
"
|
|
1153 |
^ masterApplication isNil
|
|
1154 |
!
|
|
1155 |
|
|
1156 |
canCopy
|
|
1157 |
"returns true if any selection exists
|
|
1158 |
"
|
|
1159 |
^ treeView selection notNil
|
|
1160 |
!
|
|
1161 |
|
|
1162 |
canCut
|
|
1163 |
"returns true if any selection exists and not includes
|
|
1164 |
the anchor (first element into list).
|
|
1165 |
"
|
|
1166 |
treeView selection notNil ifTrue:[
|
|
1167 |
^ (treeView isInSelection:1) not
|
|
1168 |
].
|
|
1169 |
^ false
|
|
1170 |
!
|
|
1171 |
|
|
1172 |
canPaste
|
|
1173 |
"returns true if something to be paste exists and a
|
|
1174 |
single selection exists
|
|
1175 |
"
|
|
1176 |
^ (CopyBuffer notNil and:[treeView selectedNode notNil])
|
|
1177 |
!
|
|
1178 |
|
|
1179 |
hasValidClass
|
|
1180 |
"returns true if the class defined allready exists
|
|
1181 |
"
|
|
1182 |
^ specClass isBehavior
|
|
1183 |
!
|
|
1184 |
|
|
1185 |
hasValidMethodSelector
|
|
1186 |
"returns true if the class and the instance selector defined
|
|
1187 |
allready exists.
|
|
1188 |
"
|
|
1189 |
(specSelector notNil and:[self hasValidClass]) ifTrue:[
|
|
1190 |
^ (specClass compiledMethodAt:specSelector) notNil
|
|
1191 |
].
|
|
1192 |
^ false
|
|
1193 |
!
|
|
1194 |
|
|
1195 |
hasValidSpecSelector
|
|
1196 |
"returns true if the class and the class selector defined
|
|
1197 |
allready exists.
|
|
1198 |
"
|
|
1199 |
(specSelector notNil and:[self hasValidClass]) ifTrue:[
|
|
1200 |
^ (specClass class compiledMethodAt:specSelector) notNil
|
|
1201 |
].
|
|
1202 |
! !
|
|
1203 |
|
|
1204 |
!HierarchicalListEditor methodsFor:'startup/release'!
|
|
1205 |
|
|
1206 |
buildFrom:aClass andSelector:aSelector
|
|
1207 |
"rebuild window from a class and selector
|
|
1208 |
"
|
|
1209 |
|sel anchor stream|
|
|
1210 |
|
|
1211 |
(specClass := aClass) isBehavior ifFalse:[
|
|
1212 |
specClass notNil ifTrue:[
|
|
1213 |
specClass := Smalltalk at:aClass asSymbol
|
|
1214 |
]
|
|
1215 |
].
|
|
1216 |
specSelector := nil.
|
|
1217 |
|
|
1218 |
aSelector size ~~ 0 ifTrue:[
|
|
1219 |
sel := aSelector asString withoutSeparators.
|
|
1220 |
sel size ~~ 0 ifTrue:[
|
|
1221 |
specSelector := sel asSymbol
|
|
1222 |
]
|
|
1223 |
].
|
|
1224 |
treeView selection:nil.
|
|
1225 |
|
|
1226 |
(specSelector notNil and:[specClass notNil]) ifTrue:[
|
|
1227 |
(specClass respondsTo:specSelector) ifTrue:[
|
|
1228 |
anchor := specClass perform:specSelector.
|
|
1229 |
|
|
1230 |
anchor isArray ifTrue:[
|
|
1231 |
anchor := anchor decodeAsLiteralArray.
|
|
1232 |
]
|
|
1233 |
]
|
|
1234 |
].
|
|
1235 |
anchor notNil ifTrue:[
|
|
1236 |
anchor expand.
|
306
|
1237 |
treeView root:anchor.
|
300
|
1238 |
] ifFalse:[
|
|
1239 |
self doNew
|
|
1240 |
].
|
|
1241 |
!
|
|
1242 |
|
|
1243 |
initialize
|
|
1244 |
"setup default values
|
|
1245 |
"
|
|
1246 |
super initialize.
|
|
1247 |
|
|
1248 |
treeView := SelectionInTreeView new.
|
|
1249 |
treeView multipleSelectOk:true.
|
|
1250 |
treeView action:[:aNr| self updateChannels. self cancel ].
|
|
1251 |
self doNew.
|
|
1252 |
!
|
|
1253 |
|
|
1254 |
openModalOnClass:aClass andSelector:aSelector
|
|
1255 |
"open modal on class and selector
|
|
1256 |
"
|
|
1257 |
specClass := Association key:aClass value:aSelector.
|
|
1258 |
super openInterfaceModal.
|
|
1259 |
|
|
1260 |
|
|
1261 |
!
|
|
1262 |
|
|
1263 |
openOnClass:aClass andSelector:aSelector
|
|
1264 |
"open on class and selector
|
|
1265 |
"
|
|
1266 |
specClass := Association key:aClass value:aSelector.
|
|
1267 |
super openInterface.
|
|
1268 |
|
|
1269 |
!
|
|
1270 |
|
|
1271 |
postBuildWith:builder
|
|
1272 |
"setup view
|
|
1273 |
"
|
|
1274 |
|cls sel|
|
|
1275 |
|
|
1276 |
specClass isAssociation ifTrue:[
|
|
1277 |
cls := specClass key.
|
|
1278 |
sel := specClass value.
|
|
1279 |
].
|
|
1280 |
self buildFrom:cls andSelector:sel.
|
|
1281 |
|
|
1282 |
! !
|
|
1283 |
|
|
1284 |
!HierarchicalListEditor class methodsFor:'documentation'!
|
|
1285 |
|
|
1286 |
version
|
|
1287 |
^ '$Header$'
|
|
1288 |
! !
|