author | Claus Gittinger <cg@exept.de> |
Tue, 24 Jan 2006 17:27:21 +0100 | |
changeset 6491 | d02c41c57d02 |
parent 6324 | 29bf9ceffe8f |
child 6941 | c9b0b4f80a8c |
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 |
" |
|
18 | 12 |
|
2717 | 13 |
"{ Package: 'stx:libtool' }" |
14 |
||
18 | 15 |
InspectorView subclass:#OrderedCollectionInspectorView |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
16 |
instanceVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
17 |
classVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
18 |
poolDictionaries:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
19 |
category:'Interface-Inspector' |
18 | 20 |
! |
21 |
||
1040 | 22 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
88 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
473
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 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
38 |
documentation |
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 |
a modified Inspector for orderedCollections |
510 | 41 |
|
42 |
[author:] |
|
43 |
Claus Gittinger |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
44 |
" |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
45 |
|
88 | 46 |
! ! |
47 |
||
6491 | 48 |
!OrderedCollectionInspectorView methodsFor:'menu'! |
647 | 49 |
|
73 | 50 |
fieldMenu |
1040 | 51 |
"return the menu for the field-list" |
52 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1040
diff
changeset
|
53 |
<resource: #programMenu> |
1040 | 54 |
|
5473 | 55 |
|items m sel| |
18 | 56 |
|
4983 | 57 |
items := #( |
58 |
('Inspect' doInspect ) |
|
59 |
('BasicInspect' doBasicInspect ) |
|
60 |
('Inspect hierarchical' doNewInspect ) |
|
61 |
('-') |
|
62 |
('Ref chains' showReferences ) |
|
63 |
('-') |
|
64 |
('Browse' browse ) |
|
3200 | 65 |
"/ ('Browse class hierarchy' browseClassHierarchy ) |
66 |
"/ ('Browse full class protocol' browseFullClassProtocol) |
|
5473 | 67 |
). |
68 |
||
69 |
sel := self selection. |
|
70 |
(sel isBlock or:[sel isContext]) ifTrue:[ |
|
71 |
items := items , #( |
|
72 |
('Browse Blocks Home' #browseHome) |
|
73 |
). |
|
74 |
]. |
|
75 |
||
76 |
items := items , #( |
|
4983 | 77 |
('-') |
78 |
('Remove' removeIndex ) |
|
79 |
). |
|
5473 | 80 |
|
4983 | 81 |
(hasMore) ifTrue:[ |
82 |
items := items , #( |
|
2085 | 83 |
('-') |
3200 | 84 |
('Show more' showMore ) |
473
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 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
88 |
monitorProcess isNil ifTrue:[ |
3200 | 89 |
items := items , #( ('-') ('Start monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
90 |
] ifFalse:[ |
3200 | 91 |
items := items , #( ('-') ('Stop monitor' doStopMonitor)). |
18 | 92 |
]. |
4983 | 93 |
showHex ifTrue:[ |
94 |
items := items , #( |
|
95 |
('-') |
|
96 |
('Decimal Integers' #toggleHex ) |
|
97 |
) |
|
98 |
] ifFalse:[ |
|
99 |
items := items , #( |
|
100 |
('-') |
|
101 |
('Hex Integers' #toggleHex ) |
|
102 |
) |
|
103 |
]. |
|
73 | 104 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
105 |
m := PopUpMenu |
1666 | 106 |
itemList:items |
107 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
108 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
109 |
selectionIndex isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
110 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
111 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
112 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
113 |
] ifFalse:[ |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
114 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
115 |
m disable:#removeIndex |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
116 |
]. |
473
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 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
119 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
120 |
|
1666 | 121 |
"Modified: / 21.5.1998 / 13:32:09 / cg" |
6491 | 122 |
! ! |
123 |
||
124 |
!OrderedCollectionInspectorView methodsFor:'private'! |
|
125 |
||
126 |
baseInspectedObjectClass |
|
127 |
(inspectedObject class inheritsFrom:OrderedCollection) ifFalse:[ |
|
128 |
^ Object |
|
129 |
]. |
|
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 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
149 |
n := inspectedObject size. |
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) |
18 | 156 |
! ! |
73 | 157 |
|
158 |
!OrderedCollectionInspectorView methodsFor:'user interaction'! |
|
159 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
160 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
161 |
^ inspectedObject at:idx ifAbsent:nil. |
200 | 162 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
163 |
! |
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 |
indexedValueAtIndex:idx put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
166 |
inspectedObject at:idx put:newValue. |
200 | 167 |
! |
168 |
||
73 | 169 |
removeIndex |
170 |
"remove selected item from the collection" |
|
171 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
172 |
|idx| |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
173 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
174 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
175 |
idx notNil ifTrue:[ |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
176 |
inspectedObject removeIndex:idx. |
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
177 |
selectionIndex := selectedLine := nil. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
178 |
inspectedObject changed. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2085
diff
changeset
|
179 |
self reinspect. |
73 | 180 |
] |
200 | 181 |
! ! |
73 | 182 |
|
1040 | 183 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 184 |
|
200 | 185 |
version |
6491 | 186 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.37 2006-01-24 16:27:13 cg Exp $' |
73 | 187 |
! ! |