author | Claus Gittinger <cg@exept.de> |
Mon, 09 Oct 2006 12:48:55 +0200 | |
changeset 7379 | 55d5b77c7136 |
parent 6943 | ba2398a0e68f |
child 8526 | 5ecd6ffcfa6c |
permissions | -rw-r--r-- |
2627 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by Claus Gittinger / eXept Software AG |
|
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 |
" |
|
2717 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
370 | 14 |
InspectorView subclass:#SetInspectorView |
15 |
instanceVariableNames:'keys' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Inspector' |
|
19 |
! |
|
20 |
||
794 | 21 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 22 |
|
2627 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1996 by Claus Gittinger / eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
||
36 |
! |
|
37 |
||
370 | 38 |
documentation |
39 |
" |
|
40 |
A modified inspector for Sets |
|
510 | 41 |
|
42 |
[author:] |
|
43 |
Stefan Vogel |
|
370 | 44 |
" |
45 |
! |
|
46 |
||
47 |
examples |
|
48 |
" |
|
49 |
#(a b c d e) asSet inspect |
|
50 |
" |
|
51 |
! ! |
|
52 |
||
6491 | 53 |
!SetInspectorView methodsFor:'menu'! |
370 | 54 |
|
55 |
fieldMenu |
|
1361 | 56 |
<resource: #programMenu > |
57 |
||
370 | 58 |
|menu| |
59 |
||
60 |
menu := super fieldMenu. |
|
61 |
menu addLabels:#( |
|
62 |
'-' |
|
3200 | 63 |
'Remove element' |
370 | 64 |
) |
65 |
selectors:#( |
|
66 |
nil |
|
67 |
doRemoveKey |
|
68 |
). |
|
69 |
||
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
70 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
71 |
menu disableAll:#(doRemoveKey) |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
72 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
73 |
|
370 | 74 |
^ menu |
1361 | 75 |
|
76 |
"Modified: / 29.10.1997 / 03:41:47 / cg" |
|
370 | 77 |
! ! |
78 |
||
79 |
!SetInspectorView methodsFor:'private'! |
|
80 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
81 |
baseInspectedObjectClass |
6324 | 82 |
(inspectedObject class inheritsFrom:Set) ifFalse:[ |
83 |
^ Object |
|
84 |
]. |
|
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
85 |
^ Set |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
86 |
! |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
87 |
|
647 | 88 |
defaultLabel |
4095
5bd36b14723d
labels; added suppressPseudoVars & dereferenceValueHolders
Claus Gittinger <cg@exept.de>
parents:
3884
diff
changeset
|
89 |
^ 'Contents' |
647 | 90 |
|
91 |
" |
|
92 |
(Set with:1 with:2 with:3) inspect |
|
93 |
" |
|
94 |
||
95 |
"Modified: 28.6.1996 / 16:05:42 / cg" |
|
96 |
! |
|
97 |
||
6943 | 98 |
derivedFields |
7379 | 99 |
^ Dictionary new |
100 |
declareAllNewFrom:(super derivedFields ? #()); |
|
101 |
add:('-size' -> [ object size ]); |
|
102 |
yourself |
|
6943 | 103 |
|
7379 | 104 |
"Modified: / 09-10-2006 / 12:27:21 / cg" |
6943 | 105 |
! |
106 |
||
3875 | 107 |
indexList |
108 |
"return a list of indexes to show in the selectionList. |
|
109 |
Set hasMore to true, if a '...' entry should be added." |
|
110 |
||
111 |
^ inspectedObject asSortedCollection:[:a :b | a displayString < b displayString]. |
|
112 |
! |
|
113 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
114 |
indexedFieldList |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
115 |
"return a list of indexed-variable names to show in the selectionList. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
116 |
Set hasMore to true, if a '...' entry should be added." |
370 | 117 |
|
3875 | 118 |
keys := self indexList. |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
119 |
^ keys collect:[:k | k isSymbol ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
120 |
k printString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
121 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
122 |
k displayString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
123 |
] |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
124 |
]. |
370 | 125 |
! |
126 |
||
127 |
release |
|
128 |
"release inspected object" |
|
129 |
||
130 |
keys := nil. |
|
131 |
super release |
|
132 |
||
133 |
"Created: 9.2.1996 / 12:04:30 / stefan" |
|
3884 | 134 |
! |
135 |
||
136 |
showAllIndexedVarsInFieldList |
|
137 |
^ false |
|
370 | 138 |
! ! |
139 |
||
140 |
!SetInspectorView methodsFor:'user interaction'! |
|
141 |
||
142 |
doRemoveKey |
|
143 |
"remove selected item from keys" |
|
144 |
||
2192 | 145 |
|key idx| |
370 | 146 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
147 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
148 |
idx notNil ifTrue:[ |
2192 | 149 |
key := keys at:idx. |
370 | 150 |
(inspectedObject includes:key) ifTrue:[ |
151 |
listView cursor:(Cursor wait). |
|
152 |
inspectedObject remove:key. |
|
153 |
keys := nil. |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
154 |
selectionIndex := selectedLine := nil. |
370 | 155 |
inspectedObject changed. |
156 |
listView cursor:(Cursor hand). |
|
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
157 |
self reinspect. |
370 | 158 |
]. |
159 |
] |
|
160 |
||
161 |
||
162 |
! |
|
163 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
164 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
165 |
^ keys at:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
166 |
! |
370 | 167 |
|
3884 | 168 |
indexedValueAtKey:idx |
169 |
^ keys at:idx |
|
170 |
! |
|
171 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
172 |
valueAtLine:lineNr put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
173 |
"store newValue; |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
174 |
For non-named instvars, we add the new value - ignoring the selection" |
370 | 175 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
176 |
|idx| |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
177 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
178 |
idx := self instVarIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
179 |
idx notNil ifTrue:[ |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
180 |
inspectedObject instVarAt:idx put:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
181 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
182 |
inspectedObject add:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
183 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
184 |
"/ inspectedObject changed. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
185 |
self reinspect. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
186 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
187 |
|
370 | 188 |
|
189 |
! ! |
|
190 |
||
794 | 191 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 192 |
|
193 |
version |
|
7379 | 194 |
^ '$Header: /cvs/stx/stx/libtool/SetInspectorView.st,v 1.24 2006-10-09 10:48:55 cg Exp $' |
370 | 195 |
! ! |