author | Claus Gittinger <cg@exept.de> |
Mon, 01 Feb 2010 15:58:11 +0100 | |
changeset 9352 | 9c1b758211d4 |
parent 7949 | a2b4878cab10 |
child 9556 | 65d673dd5ef3 |
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 , #( |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
62 |
('Inspect Hierarchical' #doNewInspect ) |
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 |
]. |
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 |
]. |
4983 | 99 |
showHex ifTrue:[ |
100 |
items := items , #( |
|
101 |
('-') |
|
102 |
('Decimal Integers' #toggleHex ) |
|
103 |
) |
|
104 |
] ifFalse:[ |
|
105 |
items := items , #( |
|
106 |
('-') |
|
107 |
('Hex Integers' #toggleHex ) |
|
108 |
) |
|
109 |
]. |
|
73 | 110 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
111 |
m := PopUpMenu |
1666 | 112 |
itemList:items |
113 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
114 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
115 |
selectionIndex isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
116 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
117 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
118 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
119 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
120 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
121 |
m disable:#removeIndex |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
122 |
]. |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
123 |
]. |
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 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
126 |
|
1666 | 127 |
"Modified: / 21.5.1998 / 13:32:09 / cg" |
6491 | 128 |
! ! |
129 |
||
130 |
!OrderedCollectionInspectorView methodsFor:'private'! |
|
131 |
||
132 |
baseInspectedObjectClass |
|
133 |
(inspectedObject class inheritsFrom:OrderedCollection) ifFalse:[ |
|
134 |
^ Object |
|
135 |
]. |
|
136 |
^ OrderedCollection |
|
137 |
! |
|
138 |
||
139 |
defaultLabel |
|
140 |
^ 'Contents' |
|
141 |
||
142 |
" |
|
143 |
(OrderedCollection with:1 with:2 with:3) inspect |
|
144 |
" |
|
145 |
||
146 |
"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
|
147 |
! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
148 |
|
6941 | 149 |
derivedFields |
7380 | 150 |
^ Dictionary new |
151 |
declareAllNewFrom:(super derivedFields ? #()); |
|
152 |
add:('-size' -> [ object size ]); |
|
153 |
yourself |
|
6941 | 154 |
|
155 |
"Created: / 22-08-2006 / 11:55:29 / cg" |
|
7380 | 156 |
"Modified: / 09-10-2006 / 12:27:32 / cg" |
6941 | 157 |
! |
158 |
||
3875 | 159 |
indexList |
160 |
"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
|
161 |
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
|
162 |
|
3875 | 163 |
|n| |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
164 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
165 |
n := inspectedObject size. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
166 |
(n > nShown) ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
167 |
n := nShown. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
168 |
hasMore := true. |
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 |
|
3875 | 171 |
^ (1 to:n) |
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 |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
177 |
^ inspectedObject at:idx ifAbsent:nil. |
200 | 178 |
|
2271
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 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
181 |
indexedValueAtIndex:idx put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
182 |
inspectedObject at:idx put:newValue. |
200 | 183 |
! |
184 |
||
73 | 185 |
removeIndex |
186 |
"remove selected item from the collection" |
|
187 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
188 |
|idx| |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
189 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
190 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
191 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
192 |
inspectedObject removeIndex:idx. |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
193 |
selectionIndex := selectedLine := nil. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
194 |
inspectedObject changed. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
195 |
self reinspect. |
73 | 196 |
] |
200 | 197 |
! ! |
73 | 198 |
|
1040 | 199 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 200 |
|
200 | 201 |
version |
9352
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
202 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.41 2010-02-01 14:58:11 cg Exp $' |
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 |
|
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
205 |
version_CVS |
9c1b758211d4
do not show new-inspector in menu, if there is none loaded
Claus Gittinger <cg@exept.de>
parents:
7949
diff
changeset
|
206 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.41 2010-02-01 14:58:11 cg Exp $' |
73 | 207 |
! ! |