author | Claus Gittinger <cg@exept.de> |
Wed, 07 Jul 1999 02:26:33 +0200 | |
changeset 2236 | 257f587ad7dc |
parent 2193 | 3d7b1044e8c8 |
child 2271 | 0cf238543cb1 |
permissions | -rw-r--r-- |
88 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
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 |
" |
|
18 | 12 |
|
13 |
InspectorView subclass:#OrderedCollectionInspectorView |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
14 |
instanceVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
15 |
classVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
16 |
poolDictionaries:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
17 |
category:'Interface-Inspector' |
18 | 18 |
! |
19 |
||
1040 | 20 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
88 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
34 |
! |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
35 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
36 |
documentation |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
37 |
" |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
38 |
a modified Inspector for orderedCollections |
510 | 39 |
|
40 |
[author:] |
|
41 |
Claus Gittinger |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
42 |
" |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
43 |
|
88 | 44 |
! ! |
45 |
||
73 | 46 |
!OrderedCollectionInspectorView methodsFor:'private'! |
47 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
48 |
baseInspectedObjectClass |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
49 |
^ OrderedCollection |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
50 |
|
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
51 |
! |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
52 |
|
647 | 53 |
defaultLabel |
54 |
^ 'contents' |
|
55 |
||
56 |
" |
|
57 |
(OrderedCollection with:1 with:2 with:3) inspect |
|
58 |
" |
|
59 |
||
60 |
"Modified: 28.6.1996 / 16:06:24 / cg" |
|
61 |
! |
|
62 |
||
200 | 63 |
fieldList |
64 |
"return a list of names for the selectionlist. Leave hasMore as |
|
65 |
true, if a '...' entry should be added." |
|
66 |
||
67 |
|aList n| |
|
68 |
||
69 |
n := inspectedObject size. |
|
70 |
(n > nShown) ifTrue:[ |
|
645 | 71 |
n := nShown. |
72 |
hasMore := true. |
|
200 | 73 |
]. |
74 |
aList := OrderedCollection new:n+1. |
|
645 | 75 |
hideReceiver ifFalse:[aList add:'self']. |
200 | 76 |
1 to:n do:[:index | |
645 | 77 |
aList add:(index printString) |
200 | 78 |
]. |
79 |
^ aList |
|
645 | 80 |
|
81 |
"Modified: 28.6.1996 / 15:09:24 / cg" |
|
200 | 82 |
! |
83 |
||
73 | 84 |
fieldMenu |
1040 | 85 |
"return the menu for the field-list" |
86 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1040
diff
changeset
|
87 |
<resource: #programMenu> |
1040 | 88 |
|
1666 | 89 |
|items m| |
18 | 90 |
|
73 | 91 |
hasMore ifTrue:[ |
1666 | 92 |
items := #( |
93 |
('inspect' doInspect ) |
|
94 |
('basicInspect' doBasicInspect ) |
|
95 |
('inspect hierarchical' doNewInspect ) |
|
2085 | 96 |
('-') |
1743 | 97 |
('ref chains' showReferences ) |
2085 | 98 |
('-') |
1666 | 99 |
('browse' browse ) |
100 |
('browse class hierarchy' browseClassHierarchy ) |
|
101 |
('browse full class protocol' browseFullClassProtocol) |
|
2085 | 102 |
('-') |
1666 | 103 |
('remove' removeIndex ) |
2085 | 104 |
('-') |
1666 | 105 |
('show more' showMore ) |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
106 |
). |
18 | 107 |
] ifFalse:[ |
1666 | 108 |
items := #( |
109 |
('inspect' doInspect ) |
|
110 |
('basicInspect' doBasicInspect ) |
|
111 |
('inspect hierarchical' doNewInspect ) |
|
2085 | 112 |
('-') |
1743 | 113 |
('ref chains' showReferences ) |
2085 | 114 |
('-') |
1666 | 115 |
('browse' browse ) |
116 |
('browse class hierarchy' browseClassHierarchy ) |
|
117 |
('browse full class protocol' browseFullClassProtocol) |
|
2085 | 118 |
('-') |
119 |
('remove' removeIndex ) |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
120 |
). |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
121 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
122 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
123 |
monitorProcess isNil ifTrue:[ |
2085 | 124 |
items := items , #( ('-') ('start monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
125 |
] ifFalse:[ |
2085 | 126 |
items := items , #( ('-') ('stop monitor' doStopMonitor)). |
18 | 127 |
]. |
73 | 128 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
129 |
m := PopUpMenu |
1666 | 130 |
itemList:items |
131 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
132 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
133 |
selectionIndex isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
134 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
135 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
136 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
137 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
138 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
139 |
m disable:#removeIndex |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
140 |
]. |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
141 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
142 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
143 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
144 |
|
1666 | 145 |
"Modified: / 21.5.1998 / 13:32:09 / cg" |
18 | 146 |
! ! |
73 | 147 |
|
148 |
!OrderedCollectionInspectorView methodsFor:'user interaction'! |
|
149 |
||
200 | 150 |
doAccept:theText |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
151 |
|value idx| |
200 | 152 |
|
153 |
value := Compiler evaluate:theText |
|
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
154 |
receiver:inspectedObject |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
155 |
notifying:workspace. |
200 | 156 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
157 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
158 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
159 |
inspectedObject at:idx put:value. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
160 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
161 |
idx := self instVarIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
162 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
163 |
inspectedObject instVarAt:idx put:value. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
164 |
] ifFalse:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
165 |
^ self "/ self selected |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
166 |
] |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
167 |
]. |
200 | 168 |
! |
169 |
||
73 | 170 |
removeIndex |
171 |
"remove selected item from the collection" |
|
172 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
173 |
|idx| |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
174 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
175 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
176 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
177 |
inspectedObject removeIndex:idx. |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
178 |
selectionIndex := selectedLine := nil. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
179 |
inspectedObject changed. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
180 |
self reinspect. |
73 | 181 |
] |
182 |
! |
|
183 |
||
184 |
valueAtLine:lineNr |
|
185 |
"helper - return the value of the selected entry" |
|
186 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
187 |
|key idx| |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
188 |
|
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
189 |
idx := self keyIndexForLine:lineNr. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
190 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
191 |
^ inspectedObject at:idx ifAbsent:nil. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
192 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
193 |
idx := self instVarIndexForLine:lineNr. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
194 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
195 |
^ inspectedObject instVarAt:idx. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
196 |
]. |
73 | 197 |
|
645 | 198 |
hideReceiver ifFalse:[ |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
199 |
(lineNr == 1 or:[lineNr isNil]) ifTrue:[ |
645 | 200 |
^ inspectedObject |
201 |
]. |
|
73 | 202 |
]. |
203 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
204 |
^ nil |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
205 |
|
200 | 206 |
! ! |
73 | 207 |
|
1040 | 208 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 209 |
|
200 | 210 |
version |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
211 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.26 1999-07-07 00:26:27 cg Exp $' |
73 | 212 |
! ! |