18
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1989 by Claus Gittinger
|
52
|
3 |
All Rights Reserved
|
18
|
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 |
InspectorView subclass:#OrderedCollectionInspectorView
|
52
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Inspector'
|
18
|
18 |
!
|
|
19 |
|
|
20 |
!OrderedCollectionInspectorView methodsFor:'user interaction'!
|
|
21 |
|
|
22 |
showSelection:lineNr
|
|
23 |
"user clicked on an instvar - show value in workspace"
|
|
24 |
|
|
25 |
|val string|
|
|
26 |
|
|
27 |
workspace contents:nil.
|
|
28 |
lineNr == 1 ifTrue:[
|
52
|
29 |
"selecting self also does a re-set, this allows updating the list"
|
|
30 |
self inspect:inspectedObject.
|
|
31 |
val := inspectedObject
|
18
|
32 |
] ifFalse:[
|
52
|
33 |
val := inspectedObject at:(lineNr - 1)
|
18
|
34 |
].
|
|
35 |
string := val displayString.
|
23
|
36 |
workspace paste:string.
|
18
|
37 |
selectedLine := lineNr
|
23
|
38 |
!
|
|
39 |
|
|
40 |
doAccept:theText
|
|
41 |
|value|
|
|
42 |
|
|
43 |
value := Compiler evaluate:theText
|
52
|
44 |
receiver:inspectedObject
|
|
45 |
notifying:workspace.
|
23
|
46 |
|
|
47 |
inspectedValues isNil ifTrue:[
|
52
|
48 |
selectedLine notNil ifTrue:[
|
|
49 |
selectedLine == 1 ifFalse:[
|
|
50 |
inspectedObject at:selectedLine - 1 put:value.
|
|
51 |
inspectedObject changed
|
|
52 |
]
|
|
53 |
]
|
23
|
54 |
].
|
|
55 |
!
|
|
56 |
|
|
57 |
doInspect
|
|
58 |
"user selected inspect-menu entry"
|
|
59 |
|
|
60 |
selectedLine notNil ifTrue:[
|
52
|
61 |
inspectedValues isNil ifTrue:[
|
|
62 |
(selectedLine == 1) ifTrue:[
|
|
63 |
inspectedObject inspect
|
|
64 |
] ifFalse:[
|
|
65 |
(inspectedObject at:selectedLine - 1) inspect
|
|
66 |
]
|
|
67 |
].
|
23
|
68 |
]
|
18
|
69 |
! !
|
|
70 |
|
|
71 |
!OrderedCollectionInspectorView methodsFor:'accessing'!
|
|
72 |
|
|
73 |
listOfNames
|
|
74 |
"return a list of names to show in the selectionList"
|
|
75 |
|
|
76 |
|aList n cut|
|
|
77 |
|
|
78 |
aList := Text new.
|
|
79 |
aList add:'self'.
|
|
80 |
n := inspectedObject size.
|
|
81 |
(n > nShown) ifTrue:[
|
52
|
82 |
n := nShown.
|
|
83 |
cut := true.
|
|
84 |
listView setMiddleButtonMenu:menu2.
|
18
|
85 |
] ifFalse:[
|
52
|
86 |
cut := false.
|
|
87 |
listView setMiddleButtonMenu:menu1.
|
18
|
88 |
].
|
|
89 |
1 to:n do:[:index |
|
52
|
90 |
aList add:(index printString)
|
18
|
91 |
].
|
|
92 |
cut ifTrue:[
|
52
|
93 |
aList add:' ... '
|
18
|
94 |
].
|
|
95 |
^ aList
|
|
96 |
! !
|