author | Claus Gittinger <cg@exept.de> |
Fri, 16 Jul 1999 19:26:38 +0200 | |
changeset 2271 | 0cf238543cb1 |
parent 2236 | 257f587ad7dc |
child 2627 | e633d9928ddd |
permissions | -rw-r--r-- |
370 | 1 |
InspectorView subclass:#SetInspectorView |
2 |
instanceVariableNames:'keys' |
|
3 |
classVariableNames:'' |
|
4 |
poolDictionaries:'' |
|
5 |
category:'Interface-Inspector' |
|
6 |
! |
|
7 |
||
794 | 8 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 9 |
|
10 |
documentation |
|
11 |
" |
|
12 |
A modified inspector for Sets |
|
510 | 13 |
|
14 |
[author:] |
|
15 |
Stefan Vogel |
|
370 | 16 |
" |
17 |
! |
|
18 |
||
19 |
examples |
|
20 |
" |
|
21 |
#(a b c d e) asSet inspect |
|
22 |
" |
|
23 |
! ! |
|
24 |
||
25 |
!SetInspectorView methodsFor:'initialization'! |
|
26 |
||
27 |
fieldMenu |
|
1361 | 28 |
<resource: #programMenu > |
29 |
||
370 | 30 |
|menu| |
31 |
||
32 |
menu := super fieldMenu. |
|
33 |
menu addLabels:#( |
|
34 |
'-' |
|
35 |
'remove element' |
|
36 |
) |
|
37 |
selectors:#( |
|
38 |
nil |
|
39 |
doRemoveKey |
|
40 |
). |
|
41 |
||
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
42 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
43 |
menu disableAll:#(doRemoveKey) |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
44 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
45 |
|
370 | 46 |
^ menu |
1361 | 47 |
|
48 |
"Modified: / 29.10.1997 / 03:41:47 / cg" |
|
370 | 49 |
! ! |
50 |
||
51 |
!SetInspectorView methodsFor:'private'! |
|
52 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
53 |
baseInspectedObjectClass |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
54 |
^ Set |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
55 |
|
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
56 |
! |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
57 |
|
647 | 58 |
defaultLabel |
59 |
^ 'contents' |
|
60 |
||
61 |
" |
|
62 |
(Set with:1 with:2 with:3) inspect |
|
63 |
" |
|
64 |
||
65 |
"Modified: 28.6.1996 / 16:05:42 / cg" |
|
66 |
! |
|
67 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
68 |
indexedFieldList |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
69 |
"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
|
70 |
Set hasMore to true, if a '...' entry should be added." |
370 | 71 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
72 |
|aList n cls| |
370 | 73 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
74 |
keys := inspectedObject asSortedCollection:[:a :b | a displayString < b displayString]. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
75 |
^ keys collect:[:k | k isSymbol ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
76 |
k printString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
77 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
78 |
k displayString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
79 |
] |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
80 |
]. |
370 | 81 |
|
2191
06957119a0ac
show named instvars - except for Set instvars
Claus Gittinger <cg@exept.de>
parents:
1361
diff
changeset
|
82 |
|
370 | 83 |
! |
84 |
||
85 |
release |
|
86 |
"release inspected object" |
|
87 |
||
88 |
keys := nil. |
|
89 |
super release |
|
90 |
||
91 |
"Created: 9.2.1996 / 12:04:30 / stefan" |
|
92 |
! ! |
|
93 |
||
94 |
!SetInspectorView methodsFor:'user interaction'! |
|
95 |
||
96 |
doRemoveKey |
|
97 |
"remove selected item from keys" |
|
98 |
||
2192 | 99 |
|key idx| |
370 | 100 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
101 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
102 |
idx notNil ifTrue:[ |
2192 | 103 |
key := keys at:idx. |
370 | 104 |
(inspectedObject includes:key) ifTrue:[ |
105 |
listView cursor:(Cursor wait). |
|
106 |
inspectedObject remove:key. |
|
107 |
keys := nil. |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
108 |
selectionIndex := selectedLine := nil. |
370 | 109 |
inspectedObject changed. |
110 |
listView cursor:(Cursor hand). |
|
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
111 |
self reinspect. |
370 | 112 |
]. |
113 |
] |
|
114 |
||
115 |
||
116 |
! |
|
117 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
118 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
119 |
^ keys at:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
120 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
121 |
! |
370 | 122 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
123 |
valueAtLine:lineNr put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
124 |
"store newValue; |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
125 |
For non-named instvars, we add the new value - ignoring the selection" |
370 | 126 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
127 |
|idx| |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
128 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
129 |
idx := self instVarIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
130 |
idx notNil ifTrue:[ |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
131 |
inspectedObject instVarAt:idx put:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
132 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
133 |
inspectedObject add:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
134 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
135 |
"/ inspectedObject changed. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
136 |
self reinspect. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
137 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
138 |
|
370 | 139 |
|
140 |
! ! |
|
141 |
||
794 | 142 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 143 |
|
144 |
version |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
145 |
^ '$Header: /cvs/stx/stx/libtool/SetInspectorView.st,v 1.13 1999-07-16 17:25:33 cg Exp $' |
370 | 146 |
! ! |