88
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1993 by 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 |
"
|
18
|
12 |
|
|
13 |
InspectorView subclass:#OrderedCollectionInspectorView
|
52
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Inspector'
|
18
|
18 |
!
|
|
19 |
|
88
|
20 |
!OrderedCollectionInspectorView class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
25 |
All Rights Reserved
|
|
26 |
|
|
27 |
This software is furnished under a license and may be used
|
|
28 |
only in accordance with the terms of that license and with the
|
|
29 |
inclusion of the above copyright notice. This software may not
|
|
30 |
be provided or otherwise made available to, or used by, any
|
|
31 |
other person. No title to or ownership of the software is
|
|
32 |
hereby transferred.
|
|
33 |
"
|
|
34 |
!
|
|
35 |
|
|
36 |
version
|
|
37 |
"
|
|
38 |
$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.8 1995-03-26 17:35:34 claus Exp $
|
|
39 |
"
|
|
40 |
! !
|
|
41 |
|
73
|
42 |
!OrderedCollectionInspectorView methodsFor:'private'!
|
|
43 |
|
|
44 |
fieldMenu
|
|
45 |
|labels selectors|
|
18
|
46 |
|
73
|
47 |
hasMore ifTrue:[
|
88
|
48 |
labels := #(
|
|
49 |
'inspect'
|
|
50 |
'basicInspect'
|
|
51 |
'-'
|
|
52 |
'remove'
|
|
53 |
'-'
|
|
54 |
'show more'
|
|
55 |
).
|
18
|
56 |
|
88
|
57 |
selectors := #(
|
|
58 |
doInspect
|
|
59 |
doBasicInspect
|
|
60 |
nil
|
|
61 |
removeIndex
|
|
62 |
nil
|
|
63 |
showMore
|
|
64 |
).
|
18
|
65 |
] ifFalse:[
|
88
|
66 |
labels := #(
|
|
67 |
'inspect'
|
|
68 |
'basicInspect'
|
|
69 |
'-'
|
|
70 |
'remove'
|
73
|
71 |
"/ '-'
|
|
72 |
"/ 'owners'
|
88
|
73 |
).
|
73
|
74 |
|
88
|
75 |
selectors := #(
|
|
76 |
doInspect
|
|
77 |
doBasicInspect
|
|
78 |
nil
|
|
79 |
removeIndex
|
73
|
80 |
"/ nil
|
|
81 |
"/ inspectOwners
|
88
|
82 |
).
|
18
|
83 |
].
|
73
|
84 |
|
|
85 |
^ PopUpMenu
|
88
|
86 |
labels:(resources array:labels)
|
|
87 |
selectors:selectors
|
23
|
88 |
!
|
|
89 |
|
73
|
90 |
fieldList
|
56
|
91 |
"return a list of names for the selectionlist. Leave hasMore as
|
|
92 |
true, if a '...' entry should be added."
|
18
|
93 |
|
56
|
94 |
|aList n|
|
18
|
95 |
|
|
96 |
n := inspectedObject size.
|
|
97 |
(n > nShown) ifTrue:[
|
52
|
98 |
n := nShown.
|
56
|
99 |
hasMore := true.
|
18
|
100 |
].
|
59
|
101 |
aList := OrderedCollection new:n+1.
|
|
102 |
aList add:'self'.
|
18
|
103 |
1 to:n do:[:index |
|
52
|
104 |
aList add:(index printString)
|
18
|
105 |
].
|
|
106 |
^ aList
|
|
107 |
! !
|
73
|
108 |
|
|
109 |
!OrderedCollectionInspectorView methodsFor:'user interaction'!
|
|
110 |
|
|
111 |
removeIndex
|
|
112 |
"remove selected item from the collection"
|
|
113 |
|
|
114 |
selectedLine == 1 ifFalse:[
|
88
|
115 |
inspectedObject removeIndex:selectedLine -1.
|
|
116 |
selectedLine := nil.
|
|
117 |
inspectedObject changed.
|
|
118 |
self inspect:inspectedObject. "force list update"
|
73
|
119 |
]
|
|
120 |
!
|
|
121 |
|
|
122 |
valueAtLine:lineNr
|
|
123 |
"helper - return the value of the selected entry"
|
|
124 |
|
|
125 |
|index|
|
|
126 |
|
|
127 |
lineNr == 1 ifTrue:[
|
88
|
128 |
^ inspectedObject
|
73
|
129 |
].
|
|
130 |
index := lineNr - 1. "/ skip self
|
|
131 |
^ inspectedObject at:index
|
|
132 |
|
|
133 |
!
|
|
134 |
|
|
135 |
doInspect
|
|
136 |
"user selected inspect-menu entry"
|
|
137 |
|
|
138 |
selectedLine notNil ifTrue:[
|
88
|
139 |
(selectedLine == 1) ifTrue:[
|
|
140 |
inspectedObject inspect
|
|
141 |
] ifFalse:[
|
|
142 |
(inspectedObject at:selectedLine - 1) inspect
|
|
143 |
].
|
73
|
144 |
]
|
|
145 |
!
|
|
146 |
|
|
147 |
doAccept:theText
|
|
148 |
|value|
|
|
149 |
|
|
150 |
value := Compiler evaluate:theText
|
88
|
151 |
receiver:inspectedObject
|
|
152 |
notifying:workspace.
|
73
|
153 |
|
|
154 |
selectedLine notNil ifTrue:[
|
88
|
155 |
selectedLine == 1 ifFalse:[
|
|
156 |
inspectedObject at:selectedLine - 1 put:value.
|
|
157 |
inspectedObject changed
|
|
158 |
]
|
73
|
159 |
].
|
|
160 |
! !
|