author | Claus Gittinger <cg@exept.de> |
Mon, 06 Aug 2012 09:02:02 +0200 | |
changeset 11729 | 28a9e5cf7f79 |
parent 11577 | e95cfba9668e |
child 12401 | 4714b9640528 |
child 16817 | 2a7b77006cbf |
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 ) |
11729 | 68 |
('Ref Chains' showReferences ) |
4983 | 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 |
('-') |
11575 | 90 |
('Show More' showMore ) |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
91 |
). |
11577 | 92 |
(self numIndexedFields > (nShown * 2)) ifTrue:[ |
11575 | 93 |
items := items , #( |
94 |
('Show All' #showAll ) |
|
95 |
) |
|
96 |
]. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
97 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
98 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
99 |
monitorProcess isNil ifTrue:[ |
11729 | 100 |
items := items , #( ('-') ('Start Monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
101 |
] ifFalse:[ |
11729 | 102 |
items := items , #( ('-') ('Stop Monitor' doStopMonitor)). |
18 | 103 |
]. |
9556
65d673dd5ef3
can now display values and indices in binary and hex.
Claus Gittinger <cg@exept.de>
parents:
9352
diff
changeset
|
104 |
items := items , (self numberBaseItems). |
73 | 105 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
106 |
m := PopUpMenu |
1666 | 107 |
itemList:items |
108 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
109 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
110 |
selectionIndex isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
111 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
112 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
113 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
114 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
115 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
116 |
m disable:#removeIndex |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
117 |
]. |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
118 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
119 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
120 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
121 |
|
11729 | 122 |
"Modified: / 06-08-2012 / 09:01:56 / cg" |
6491 | 123 |
! ! |
124 |
||
125 |
!OrderedCollectionInspectorView methodsFor:'private'! |
|
126 |
||
127 |
baseInspectedObjectClass |
|
128 |
(inspectedObject class inheritsFrom:OrderedCollection) ifFalse:[ |
|
129 |
^ Object |
|
130 |
]. |
|
131 |
^ OrderedCollection |
|
132 |
! |
|
133 |
||
134 |
defaultLabel |
|
135 |
^ 'Contents' |
|
136 |
||
137 |
" |
|
138 |
(OrderedCollection with:1 with:2 with:3) inspect |
|
139 |
" |
|
140 |
||
141 |
"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
|
142 |
! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
143 |
|
3875 | 144 |
indexList |
145 |
"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
|
146 |
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
|
147 |
|
3875 | 148 |
|n| |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
149 |
|
11577 | 150 |
n := self numIndexedFields. |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
151 |
(n > nShown) ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
152 |
n := nShown. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
153 |
hasMore := true. |
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 |
|
3875 | 156 |
^ (1 to:n) |
11577 | 157 |
|
158 |
"Modified: / 13-06-2012 / 10:14:06 / cg" |
|
159 |
! |
|
160 |
||
161 |
numIndexedFields |
|
162 |
^ inspectedObject size |
|
163 |
||
164 |
"Created: / 13-06-2012 / 10:13:16 / cg" |
|
18 | 165 |
! ! |
73 | 166 |
|
167 |
!OrderedCollectionInspectorView methodsFor:'user interaction'! |
|
168 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
169 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
170 |
^ inspectedObject at:idx ifAbsent:nil. |
200 | 171 |
|
2271
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 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
174 |
indexedValueAtIndex:idx put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
175 |
inspectedObject at:idx put:newValue. |
200 | 176 |
! |
177 |
||
73 | 178 |
removeIndex |
179 |
"remove selected item from the collection" |
|
180 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
181 |
|idx| |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
182 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
183 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
184 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
185 |
inspectedObject removeIndex:idx. |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
186 |
selectionIndex := selectedLine := nil. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
187 |
inspectedObject changed. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
188 |
self reinspect. |
73 | 189 |
] |
200 | 190 |
! ! |
73 | 191 |
|
1040 | 192 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 193 |
|
200 | 194 |
version |
11729 | 195 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.48 2012-08-06 07:02:02 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
|
196 |
! |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
197 |
|
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
198 |
version_CVS |
11729 | 199 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.48 2012-08-06 07:02:02 cg Exp $' |
73 | 200 |
! ! |