author | Claus Gittinger <cg@exept.de> |
Mon, 09 Oct 2006 12:48:59 +0200 | |
changeset 7380 | a96ada2a8d96 |
parent 6941 | c9b0b4f80a8c |
child 7949 | a2b4878cab10 |
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 ) |
|
59 |
('Inspect hierarchical' doNewInspect ) |
|
60 |
('-') |
|
61 |
('Ref chains' showReferences ) |
|
62 |
('-') |
|
63 |
('Browse' browse ) |
|
3200 | 64 |
"/ ('Browse class hierarchy' browseClassHierarchy ) |
65 |
"/ ('Browse full class protocol' browseFullClassProtocol) |
|
5473 | 66 |
). |
67 |
||
68 |
sel := self selection. |
|
69 |
(sel isBlock or:[sel isContext]) ifTrue:[ |
|
70 |
items := items , #( |
|
71 |
('Browse Blocks Home' #browseHome) |
|
72 |
). |
|
73 |
]. |
|
74 |
||
75 |
items := items , #( |
|
4983 | 76 |
('-') |
77 |
('Remove' removeIndex ) |
|
78 |
). |
|
5473 | 79 |
|
4983 | 80 |
(hasMore) ifTrue:[ |
81 |
items := items , #( |
|
2085 | 82 |
('-') |
3200 | 83 |
('Show more' showMore ) |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
84 |
). |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
85 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
86 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
87 |
monitorProcess isNil ifTrue:[ |
3200 | 88 |
items := items , #( ('-') ('Start monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
89 |
] ifFalse:[ |
3200 | 90 |
items := items , #( ('-') ('Stop monitor' doStopMonitor)). |
18 | 91 |
]. |
4983 | 92 |
showHex ifTrue:[ |
93 |
items := items , #( |
|
94 |
('-') |
|
95 |
('Decimal Integers' #toggleHex ) |
|
96 |
) |
|
97 |
] ifFalse:[ |
|
98 |
items := items , #( |
|
99 |
('-') |
|
100 |
('Hex Integers' #toggleHex ) |
|
101 |
) |
|
102 |
]. |
|
73 | 103 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
104 |
m := PopUpMenu |
1666 | 105 |
itemList:items |
106 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
107 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
108 |
selectionIndex isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
109 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
110 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
111 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
112 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
113 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
114 |
m disable:#removeIndex |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
115 |
]. |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
116 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
117 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
118 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
119 |
|
1666 | 120 |
"Modified: / 21.5.1998 / 13:32:09 / cg" |
6491 | 121 |
! ! |
122 |
||
123 |
!OrderedCollectionInspectorView methodsFor:'private'! |
|
124 |
||
125 |
baseInspectedObjectClass |
|
126 |
(inspectedObject class inheritsFrom:OrderedCollection) ifFalse:[ |
|
127 |
^ Object |
|
128 |
]. |
|
129 |
^ OrderedCollection |
|
130 |
! |
|
131 |
||
132 |
defaultLabel |
|
133 |
^ 'Contents' |
|
134 |
||
135 |
" |
|
136 |
(OrderedCollection with:1 with:2 with:3) inspect |
|
137 |
" |
|
138 |
||
139 |
"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
|
140 |
! |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
141 |
|
6941 | 142 |
derivedFields |
7380 | 143 |
^ Dictionary new |
144 |
declareAllNewFrom:(super derivedFields ? #()); |
|
145 |
add:('-size' -> [ object size ]); |
|
146 |
yourself |
|
6941 | 147 |
|
148 |
"Created: / 22-08-2006 / 11:55:29 / cg" |
|
7380 | 149 |
"Modified: / 09-10-2006 / 12:27:32 / cg" |
6941 | 150 |
! |
151 |
||
3875 | 152 |
indexList |
153 |
"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
|
154 |
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
|
155 |
|
3875 | 156 |
|n| |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
157 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
158 |
n := inspectedObject size. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
159 |
(n > nShown) ifTrue:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
160 |
n := nShown. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
161 |
hasMore := true. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
162 |
]. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
163 |
|
3875 | 164 |
^ (1 to:n) |
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 |
7380 | 195 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.39 2006-10-09 10:48:59 cg Exp $' |
73 | 196 |
! ! |