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