author | Claus Gittinger <cg@exept.de> |
Mon, 14 Feb 2011 18:16:36 +0100 | |
branch | initialV |
changeset 9777 | 82d9e1236f1f |
parent 9702 | da6868fa3692 |
child 11404 | 4872471e104d |
child 12123 | 4bde08cebd48 |
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 |
" |
|
2717 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
18 | 14 |
InspectorView subclass:#OrderedCollectionInspectorView |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
15 |
instanceVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
16 |
classVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
17 |
poolDictionaries:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
18 |
category:'Interface-Inspector' |
18 | 19 |
! |
20 |
||
1040 | 21 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
88 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
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 |
" |
|
473
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 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
37 |
documentation |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
38 |
" |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
39 |
a modified Inspector for orderedCollections |
510 | 40 |
|
41 |
[author:] |
|
42 |
Claus Gittinger |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
43 |
" |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
44 |
|
88 | 45 |
! ! |
46 |
||
6491 | 47 |
!OrderedCollectionInspectorView methodsFor:'menu'! |
647 | 48 |
|
73 | 49 |
fieldMenu |
1040 | 50 |
"return the menu for the field-list" |
51 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1040
diff
changeset
|
52 |
<resource: #programMenu> |
1040 | 53 |
|
5473 | 54 |
|items m sel| |
18 | 55 |
|
4983 | 56 |
items := #( |
57 |
('Inspect' doInspect ) |
|
58 |
('BasicInspect' doBasicInspect ) |
|
9352
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
59 |
). |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
60 |
NewInspector::NewInspectorView notNil ifTrue:[ |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
61 |
items := items , #( |
9702
da6868fa3692
comment/format in: #fieldMenu
Claus Gittinger <cg@exept.de>
parents:
9556
diff
changeset
|
62 |
('Inspect Hierarchical' #doNewInspect ) |
da6868fa3692
comment/format in: #fieldMenu
Claus Gittinger <cg@exept.de>
parents:
9556
diff
changeset
|
63 |
). |
9352
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
64 |
]. |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
65 |
items := items , #( |
4983 | 66 |
('-') |
7949 | 67 |
('Owners' showOwners ) |
4983 | 68 |
('Ref chains' showReferences ) |
69 |
('-') |
|
70 |
('Browse' browse ) |
|
3200 | 71 |
"/ ('Browse class hierarchy' browseClassHierarchy ) |
72 |
"/ ('Browse full class protocol' browseFullClassProtocol) |
|
5473 | 73 |
). |
74 |
||
75 |
sel := self selection. |
|
76 |
(sel isBlock or:[sel isContext]) ifTrue:[ |
|
77 |
items := items , #( |
|
78 |
('Browse Blocks Home' #browseHome) |
|
79 |
). |
|
80 |
]. |
|
81 |
||
82 |
items := items , #( |
|
4983 | 83 |
('-') |
84 |
('Remove' removeIndex ) |
|
85 |
). |
|
5473 | 86 |
|
4983 | 87 |
(hasMore) ifTrue:[ |
88 |
items := items , #( |
|
2085 | 89 |
('-') |
3200 | 90 |
('Show more' showMore ) |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
91 |
). |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
92 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
93 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
94 |
monitorProcess isNil ifTrue:[ |
3200 | 95 |
items := items , #( ('-') ('Start monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
96 |
] ifFalse:[ |
3200 | 97 |
items := items , #( ('-') ('Stop monitor' doStopMonitor)). |
18 | 98 |
]. |
9556
65d673dd5ef3
can now display values and indices in binary and hex.
Claus Gittinger <cg@exept.de>
parents:
9352
diff
changeset
|
99 |
items := items , (self numberBaseItems). |
73 | 100 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
101 |
m := PopUpMenu |
1666 | 102 |
itemList:items |
103 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
104 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
105 |
selectionIndex isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
106 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
107 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
108 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
109 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
110 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
111 |
m disable:#removeIndex |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
112 |
]. |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
113 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
114 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
115 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
116 |
|
9702
da6868fa3692
comment/format in: #fieldMenu
Claus Gittinger <cg@exept.de>
parents:
9556
diff
changeset
|
117 |
"Modified: / 27-01-2011 / 11:49:59 / cg" |
6491 | 118 |
! ! |
119 |
||
120 |
!OrderedCollectionInspectorView methodsFor:'private'! |
|
121 |
||
122 |
baseInspectedObjectClass |
|
123 |
(inspectedObject class inheritsFrom:OrderedCollection) ifFalse:[ |
|
124 |
^ Object |
|
125 |
]. |
|
126 |
^ OrderedCollection |
|
127 |
! |
|
128 |
||
129 |
defaultLabel |
|
130 |
^ 'Contents' |
|
131 |
||
132 |
" |
|
133 |
(OrderedCollection with:1 with:2 with:3) inspect |
|
134 |
" |
|
135 |
||
136 |
"Modified: 28.6.1996 / 16:06:24 / cg" |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
137 |
! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
138 |
|
6941 | 139 |
derivedFields |
7380 | 140 |
^ Dictionary new |
141 |
declareAllNewFrom:(super derivedFields ? #()); |
|
142 |
add:('-size' -> [ object size ]); |
|
143 |
yourself |
|
6941 | 144 |
|
145 |
"Created: / 22-08-2006 / 11:55:29 / cg" |
|
7380 | 146 |
"Modified: / 09-10-2006 / 12:27:32 / cg" |
6941 | 147 |
! |
148 |
||
3875 | 149 |
indexList |
150 |
"return a list of indexes to show in the selectionList. |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
151 |
Set hasMore to true, if a '...' entry should be added." |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
152 |
|
3875 | 153 |
|n| |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
154 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
155 |
n := inspectedObject size. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
156 |
(n > nShown) ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
157 |
n := nShown. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
158 |
hasMore := true. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
159 |
]. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
160 |
|
3875 | 161 |
^ (1 to:n) |
18 | 162 |
! ! |
73 | 163 |
|
164 |
!OrderedCollectionInspectorView methodsFor:'user interaction'! |
|
165 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
166 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
167 |
^ inspectedObject at:idx ifAbsent:nil. |
200 | 168 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
169 |
! |
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 |
indexedValueAtIndex:idx put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
172 |
inspectedObject at:idx put:newValue. |
200 | 173 |
! |
174 |
||
73 | 175 |
removeIndex |
176 |
"remove selected item from the collection" |
|
177 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
178 |
|idx| |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
179 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
180 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
181 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
182 |
inspectedObject removeIndex:idx. |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
183 |
selectionIndex := selectedLine := nil. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
184 |
inspectedObject changed. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
185 |
self reinspect. |
73 | 186 |
] |
200 | 187 |
! ! |
73 | 188 |
|
1040 | 189 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 190 |
|
200 | 191 |
version |
9702
da6868fa3692
comment/format in: #fieldMenu
Claus Gittinger <cg@exept.de>
parents:
9556
diff
changeset
|
192 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.43 2011-01-27 11:09:38 cg Exp $' |
9352
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
193 |
! |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
194 |
|
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
195 |
version_CVS |
9702
da6868fa3692
comment/format in: #fieldMenu
Claus Gittinger <cg@exept.de>
parents:
9556
diff
changeset
|
196 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.43 2011-01-27 11:09:38 cg Exp $' |
73 | 197 |
! ! |