author | Claus Gittinger <cg@exept.de> |
Mon, 20 Jan 2020 21:02:47 +0100 | |
changeset 19422 | c6ca1c3e0fd7 |
parent 18970 | 61b3a3df0868 |
permissions | -rw-r--r-- |
18970 | 1 |
"{ Encoding: utf8 }" |
2 |
||
88 | 3 |
" |
4 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
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 |
||
16817 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
18 | 18 |
InspectorView subclass:#OrderedCollectionInspectorView |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
19 |
instanceVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
20 |
classVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
21 |
poolDictionaries:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
22 |
category:'Interface-Inspector' |
18 | 23 |
! |
24 |
||
1040 | 25 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
88 | 26 |
|
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
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 |
" |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
39 |
! |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
40 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
41 |
documentation |
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 |
a modified Inspector for orderedCollections |
510 | 44 |
|
45 |
[author:] |
|
46 |
Claus Gittinger |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
47 |
" |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
48 |
|
88 | 49 |
! ! |
50 |
||
6491 | 51 |
!OrderedCollectionInspectorView methodsFor:'menu'! |
647 | 52 |
|
73 | 53 |
fieldMenu |
1040 | 54 |
"return the menu for the field-list" |
55 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1040
diff
changeset
|
56 |
<resource: #programMenu> |
1040 | 57 |
|
5473 | 58 |
|items m sel| |
18 | 59 |
|
4983 | 60 |
items := #( |
61 |
('Inspect' doInspect ) |
|
62 |
('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
|
63 |
). |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
64 |
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
|
65 |
items := items , #( |
9702
da6868fa3692
comment/format in: #fieldMenu
Claus Gittinger <cg@exept.de>
parents:
9556
diff
changeset
|
66 |
('Inspect Hierarchical' #doNewInspect ) |
da6868fa3692
comment/format in: #fieldMenu
Claus Gittinger <cg@exept.de>
parents:
9556
diff
changeset
|
67 |
). |
9352
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
68 |
]. |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
69 |
items := items , #( |
4983 | 70 |
('-') |
7949 | 71 |
('Owners' showOwners ) |
11729 | 72 |
('Ref Chains' showReferences ) |
4983 | 73 |
('-') |
74 |
('Browse' browse ) |
|
3200 | 75 |
"/ ('Browse class hierarchy' browseClassHierarchy ) |
76 |
"/ ('Browse full class protocol' browseFullClassProtocol) |
|
5473 | 77 |
). |
78 |
||
79 |
sel := self selection. |
|
18756 | 80 |
sel isBridgeProxy ifFalse:[ |
81 |
(sel isBlock or:[sel isContext]) ifTrue:[ |
|
82 |
items := items , #( |
|
83 |
('Browse Blocks Home' #browseHome) |
|
84 |
). |
|
85 |
]. |
|
5473 | 86 |
]. |
87 |
||
88 |
items := items , #( |
|
4983 | 89 |
('-') |
90 |
('Remove' removeIndex ) |
|
91 |
). |
|
5473 | 92 |
|
4983 | 93 |
(hasMore) ifTrue:[ |
94 |
items := items , #( |
|
2085 | 95 |
('-') |
11575 | 96 |
('Show More' showMore ) |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
97 |
). |
11577 | 98 |
(self numIndexedFields > (nShown * 2)) ifTrue:[ |
11575 | 99 |
items := items , #( |
100 |
('Show All' #showAll ) |
|
101 |
) |
|
102 |
]. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
103 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
104 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
105 |
monitorProcess isNil ifTrue:[ |
11729 | 106 |
items := items , #( ('-') ('Start Monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
107 |
] ifFalse:[ |
11729 | 108 |
items := items , #( ('-') ('Stop Monitor' doStopMonitor)). |
18 | 109 |
]. |
9556
65d673dd5ef3
can now display values and indices in binary and hex.
Claus Gittinger <cg@exept.de>
parents:
9352
diff
changeset
|
110 |
items := items , (self numberBaseItems). |
73 | 111 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
112 |
m := PopUpMenu |
1666 | 113 |
itemList:items |
114 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
115 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
116 |
selectionIndex isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
117 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
118 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
119 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
120 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
121 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
122 |
m disable:#removeIndex |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
123 |
]. |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
124 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
125 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
126 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
127 |
|
11729 | 128 |
"Modified: / 06-08-2012 / 09:01:56 / cg" |
18756 | 129 |
"Modified: / 08-05-2019 / 02:32:28 / Claus Gittinger" |
6491 | 130 |
! ! |
131 |
||
132 |
!OrderedCollectionInspectorView methodsFor:'private'! |
|
133 |
||
134 |
baseInspectedObjectClass |
|
18970 | 135 |
"only instvars below that are shown by me in the non-basic tab. |
136 |
This hides uninterresting details in the regular tab" |
|
137 |
||
6491 | 138 |
^ OrderedCollection |
139 |
! |
|
140 |
||
141 |
defaultLabel |
|
142 |
^ 'Contents' |
|
143 |
||
144 |
" |
|
145 |
(OrderedCollection with:1 with:2 with:3) inspect |
|
146 |
" |
|
147 |
||
148 |
"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
|
149 |
! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
150 |
|
3875 | 151 |
indexList |
152 |
"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
|
153 |
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
|
154 |
|
3875 | 155 |
|n| |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
156 |
|
11577 | 157 |
n := self numIndexedFields. |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
158 |
(n > nShown) ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
159 |
n := nShown. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
160 |
hasMore := true. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
161 |
]. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
162 |
|
3875 | 163 |
^ (1 to:n) |
11577 | 164 |
|
165 |
"Modified: / 13-06-2012 / 10:14:06 / cg" |
|
166 |
! |
|
167 |
||
168 |
numIndexedFields |
|
169 |
^ inspectedObject size |
|
170 |
||
171 |
"Created: / 13-06-2012 / 10:13:16 / cg" |
|
18 | 172 |
! ! |
73 | 173 |
|
174 |
!OrderedCollectionInspectorView methodsFor:'user interaction'! |
|
175 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
176 |
indexedValueAtIndex:idx |
17873 | 177 |
^ inspectedObject at:idx ifAbsent:NoLongerPresentDummyObject. |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
178 |
! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
179 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
180 |
indexedValueAtIndex:idx put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
181 |
inspectedObject at:idx put:newValue. |
200 | 182 |
! |
183 |
||
73 | 184 |
removeIndex |
185 |
"remove selected item from the collection" |
|
186 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
187 |
|idx| |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
188 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
189 |
idx := self keyIndexForLine:selectionIndex. |
2193
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 removeIndex:idx. |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
192 |
selectionIndex := selectedLine := nil. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
193 |
inspectedObject changed. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
194 |
self reinspect. |
73 | 195 |
] |
200 | 196 |
! ! |
73 | 197 |
|
1040 | 198 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 199 |
|
200 | 200 |
version |
16817 | 201 |
^ '$Header$' |
9352
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
202 |
! |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
203 |
|
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
204 |
version_CVS |
16817 | 205 |
^ '$Header$' |
73 | 206 |
! ! |
16817 | 207 |