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