author | Claus Gittinger <cg@exept.de> |
Tue, 15 Aug 2000 16:19:12 +0200 | |
changeset 2699 | dcb83b594b14 |
parent 2627 | e633d9928ddd |
child 2717 | dc997032a34e |
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 |
" |
|
12 |
||
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 |
||
53 |
!SetInspectorView methodsFor:'initialization'! |
|
54 |
||
55 |
fieldMenu |
|
1361 | 56 |
<resource: #programMenu > |
57 |
||
370 | 58 |
|menu| |
59 |
||
60 |
menu := super fieldMenu. |
|
61 |
menu addLabels:#( |
|
62 |
'-' |
|
63 |
'remove element' |
|
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 |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
82 |
^ Set |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
83 |
|
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
84 |
! |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
85 |
|
647 | 86 |
defaultLabel |
87 |
^ 'contents' |
|
88 |
||
89 |
" |
|
90 |
(Set with:1 with:2 with:3) inspect |
|
91 |
" |
|
92 |
||
93 |
"Modified: 28.6.1996 / 16:05:42 / cg" |
|
94 |
! |
|
95 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
96 |
indexedFieldList |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
97 |
"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
|
98 |
Set hasMore to true, if a '...' entry should be added." |
370 | 99 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
100 |
|aList n cls| |
370 | 101 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
102 |
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
|
103 |
^ keys collect:[:k | k isSymbol ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
104 |
k printString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
105 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
106 |
k displayString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
107 |
] |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
108 |
]. |
370 | 109 |
|
2191
06957119a0ac
show named instvars - except for Set instvars
Claus Gittinger <cg@exept.de>
parents:
1361
diff
changeset
|
110 |
|
370 | 111 |
! |
112 |
||
113 |
release |
|
114 |
"release inspected object" |
|
115 |
||
116 |
keys := nil. |
|
117 |
super release |
|
118 |
||
119 |
"Created: 9.2.1996 / 12:04:30 / stefan" |
|
120 |
! ! |
|
121 |
||
122 |
!SetInspectorView methodsFor:'user interaction'! |
|
123 |
||
124 |
doRemoveKey |
|
125 |
"remove selected item from keys" |
|
126 |
||
2192 | 127 |
|key idx| |
370 | 128 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
129 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
130 |
idx notNil ifTrue:[ |
2192 | 131 |
key := keys at:idx. |
370 | 132 |
(inspectedObject includes:key) ifTrue:[ |
133 |
listView cursor:(Cursor wait). |
|
134 |
inspectedObject remove:key. |
|
135 |
keys := nil. |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
136 |
selectionIndex := selectedLine := nil. |
370 | 137 |
inspectedObject changed. |
138 |
listView cursor:(Cursor hand). |
|
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
139 |
self reinspect. |
370 | 140 |
]. |
141 |
] |
|
142 |
||
143 |
||
144 |
! |
|
145 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
146 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
147 |
^ keys at:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
148 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
149 |
! |
370 | 150 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
151 |
valueAtLine:lineNr put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
152 |
"store newValue; |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
153 |
For non-named instvars, we add the new value - ignoring the selection" |
370 | 154 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
155 |
|idx| |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
156 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
157 |
idx := self instVarIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
158 |
idx notNil ifTrue:[ |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
159 |
inspectedObject instVarAt:idx put:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
160 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
161 |
inspectedObject add:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
162 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
163 |
"/ inspectedObject changed. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
164 |
self reinspect. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
165 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
166 |
|
370 | 167 |
|
168 |
! ! |
|
169 |
||
794 | 170 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 171 |
|
172 |
version |
|
2627 | 173 |
^ '$Header: /cvs/stx/stx/libtool/SetInspectorView.st,v 1.14 2000-02-18 14:37:00 cg Exp $' |
370 | 174 |
! ! |