author | Claus Gittinger <cg@exept.de> |
Fri, 06 Jun 2014 14:54:22 +0200 | |
changeset 14471 | 213f46a27124 |
parent 12833 | eaceca8a5fb0 |
child 13170 | c9b815af5777 |
child 15801 | 693e2bc2b0e1 |
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 |
11894 | 99 |
^ super derivedFields |
100 |
"/ |
|
101 |
"/ size is already there |
|
102 |
"/ ^ Dictionary new |
|
103 |
"/ declareAllNewFrom:(super derivedFields ? #()); |
|
104 |
"/ add:('-size' -> [ object size ]); |
|
105 |
"/ yourself |
|
6943 | 106 |
|
7379 | 107 |
"Modified: / 09-10-2006 / 12:27:21 / cg" |
6943 | 108 |
! |
109 |
||
3875 | 110 |
indexList |
111 |
"return a list of indexes to show in the selectionList. |
|
112 |
Set hasMore to true, if a '...' entry should be added." |
|
113 |
||
8526
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
114 |
inspectedObject size > nShown ifTrue:[ |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
115 |
|coll| |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
116 |
|
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
117 |
coll := (SortedCollection new:nShown) sortBlock:[:a :b | a displayString < b displayString]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
118 |
inspectedObject do:[:el | |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
119 |
coll add:el. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
120 |
coll size >= nShown ifTrue:[ |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
121 |
hasMore := true. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
122 |
^ coll |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
123 |
]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
124 |
]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
125 |
]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
126 |
|
3875 | 127 |
^ inspectedObject asSortedCollection:[:a :b | a displayString < b displayString]. |
128 |
! |
|
129 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
130 |
indexedFieldList |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
131 |
"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
|
132 |
Set hasMore to true, if a '...' entry should be added." |
370 | 133 |
|
3875 | 134 |
keys := self indexList. |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
135 |
^ keys collect:[:k | k isSymbol ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
136 |
k printString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
137 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
138 |
k displayString |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
139 |
] |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
140 |
]. |
370 | 141 |
! |
142 |
||
12833 | 143 |
numIndexedFields |
144 |
^ inspectedObject size |
|
145 |
! |
|
146 |
||
370 | 147 |
release |
148 |
"release inspected object" |
|
149 |
||
150 |
keys := nil. |
|
151 |
super release |
|
152 |
||
153 |
"Created: 9.2.1996 / 12:04:30 / stefan" |
|
3884 | 154 |
! |
155 |
||
156 |
showAllIndexedVarsInFieldList |
|
157 |
^ false |
|
370 | 158 |
! ! |
159 |
||
160 |
!SetInspectorView methodsFor:'user interaction'! |
|
161 |
||
162 |
doRemoveKey |
|
163 |
"remove selected item from keys" |
|
164 |
||
2192 | 165 |
|key idx| |
370 | 166 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
167 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
168 |
idx notNil ifTrue:[ |
2192 | 169 |
key := keys at:idx. |
370 | 170 |
(inspectedObject includes:key) ifTrue:[ |
171 |
listView cursor:(Cursor wait). |
|
172 |
inspectedObject remove:key. |
|
173 |
keys := nil. |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
174 |
selectionIndex := selectedLine := nil. |
370 | 175 |
inspectedObject changed. |
176 |
listView cursor:(Cursor hand). |
|
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
177 |
self reinspect. |
370 | 178 |
]. |
179 |
] |
|
180 |
||
181 |
||
182 |
! |
|
183 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
184 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
185 |
^ keys at:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
186 |
! |
370 | 187 |
|
3884 | 188 |
indexedValueAtKey:idx |
189 |
^ keys at:idx |
|
190 |
! |
|
191 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
192 |
valueAtLine:lineNr put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
193 |
"store newValue; |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
194 |
For non-named instvars, we add the new value - ignoring the selection" |
370 | 195 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
196 |
|idx| |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
197 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
198 |
idx := self instVarIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
199 |
idx notNil ifTrue:[ |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
200 |
inspectedObject instVarAt:idx put:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
201 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
202 |
inspectedObject add:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
203 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
204 |
"/ inspectedObject changed. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
205 |
self reinspect. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
206 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
207 |
|
370 | 208 |
|
209 |
! ! |
|
210 |
||
794 | 211 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 212 |
|
213 |
version |
|
12833 | 214 |
^ '$Header: /cvs/stx/stx/libtool/SetInspectorView.st,v 1.27 2013-06-04 13:02:54 cg Exp $' |
370 | 215 |
! ! |
12833 | 216 |