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