author | Claus Gittinger <cg@exept.de> |
Mon, 29 Mar 1999 17:11:21 +0200 | |
changeset 2085 | ec4daf11d3b6 |
parent 1743 | 88f86bfde4a4 |
child 2193 | 3d7b1044e8c8 |
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 |
|
13 |
InspectorView subclass:#OrderedCollectionInspectorView |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
14 |
instanceVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
15 |
classVariableNames:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
16 |
poolDictionaries:'' |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
17 |
category:'Interface-Inspector' |
18 | 18 |
! |
19 |
||
1040 | 20 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
88 | 21 |
|
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
34 |
! |
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 |
documentation |
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 |
a modified Inspector for orderedCollections |
510 | 39 |
|
40 |
[author:] |
|
41 |
Claus Gittinger |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
42 |
" |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
43 |
|
88 | 44 |
! ! |
45 |
||
73 | 46 |
!OrderedCollectionInspectorView methodsFor:'private'! |
47 |
||
647 | 48 |
defaultLabel |
49 |
^ 'contents' |
|
50 |
||
51 |
" |
|
52 |
(OrderedCollection with:1 with:2 with:3) inspect |
|
53 |
" |
|
54 |
||
55 |
"Modified: 28.6.1996 / 16:06:24 / cg" |
|
56 |
! |
|
57 |
||
200 | 58 |
fieldList |
59 |
"return a list of names for the selectionlist. Leave hasMore as |
|
60 |
true, if a '...' entry should be added." |
|
61 |
||
62 |
|aList n| |
|
63 |
||
64 |
n := inspectedObject size. |
|
65 |
(n > nShown) ifTrue:[ |
|
645 | 66 |
n := nShown. |
67 |
hasMore := true. |
|
200 | 68 |
]. |
69 |
aList := OrderedCollection new:n+1. |
|
645 | 70 |
hideReceiver ifFalse:[aList add:'self']. |
200 | 71 |
1 to:n do:[:index | |
645 | 72 |
aList add:(index printString) |
200 | 73 |
]. |
74 |
^ aList |
|
645 | 75 |
|
76 |
"Modified: 28.6.1996 / 15:09:24 / cg" |
|
200 | 77 |
! |
78 |
||
73 | 79 |
fieldMenu |
1040 | 80 |
"return the menu for the field-list" |
81 |
||
1235
13610578a5d2
resource flag: #menu -> #programMenu
Claus Gittinger <cg@exept.de>
parents:
1040
diff
changeset
|
82 |
<resource: #programMenu> |
1040 | 83 |
|
1666 | 84 |
|items m| |
18 | 85 |
|
73 | 86 |
hasMore ifTrue:[ |
1666 | 87 |
items := #( |
88 |
('inspect' doInspect ) |
|
89 |
('basicInspect' doBasicInspect ) |
|
90 |
('inspect hierarchical' doNewInspect ) |
|
2085 | 91 |
('-') |
1743 | 92 |
('ref chains' showReferences ) |
2085 | 93 |
('-') |
1666 | 94 |
('browse' browse ) |
95 |
('browse class hierarchy' browseClassHierarchy ) |
|
96 |
('browse full class protocol' browseFullClassProtocol) |
|
2085 | 97 |
('-') |
1666 | 98 |
('remove' removeIndex ) |
2085 | 99 |
('-') |
1666 | 100 |
('show more' showMore ) |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
101 |
). |
18 | 102 |
] ifFalse:[ |
1666 | 103 |
items := #( |
104 |
('inspect' doInspect ) |
|
105 |
('basicInspect' doBasicInspect ) |
|
106 |
('inspect hierarchical' doNewInspect ) |
|
2085 | 107 |
('-') |
1743 | 108 |
('ref chains' showReferences ) |
2085 | 109 |
('-') |
1666 | 110 |
('browse' browse ) |
111 |
('browse class hierarchy' browseClassHierarchy ) |
|
112 |
('browse full class protocol' browseFullClassProtocol) |
|
2085 | 113 |
('-') |
114 |
('remove' removeIndex ) |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
115 |
). |
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 |
monitorProcess isNil ifTrue:[ |
2085 | 119 |
items := items , #( ('-') ('start monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
120 |
] ifFalse:[ |
2085 | 121 |
items := items , #( ('-') ('stop monitor' doStopMonitor)). |
18 | 122 |
]. |
73 | 123 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
124 |
m := PopUpMenu |
1666 | 125 |
itemList:items |
126 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
127 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
128 |
selectedLine isNil ifTrue:[ |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
129 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
130 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
131 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
132 |
] ifFalse:[ |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
133 |
selectedLine == 1 ifTrue:[ |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
134 |
m disable:#removeIndex |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
135 |
] |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
136 |
]. |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
137 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
138 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
139 |
|
1666 | 140 |
"Modified: / 21.5.1998 / 13:32:09 / cg" |
18 | 141 |
! ! |
73 | 142 |
|
143 |
!OrderedCollectionInspectorView methodsFor:'user interaction'! |
|
144 |
||
200 | 145 |
doAccept:theText |
146 |
|value| |
|
147 |
||
148 |
value := Compiler evaluate:theText |
|
149 |
receiver:inspectedObject |
|
150 |
notifying:workspace. |
|
151 |
||
152 |
selectedLine notNil ifTrue:[ |
|
153 |
selectedLine == 1 ifFalse:[ |
|
154 |
inspectedObject at:selectedLine - 1 put:value. |
|
155 |
inspectedObject changed |
|
156 |
] |
|
157 |
]. |
|
158 |
! |
|
159 |
||
160 |
doInspect |
|
161 |
"user selected inspect-menu entry" |
|
162 |
||
163 |
selectedLine notNil ifTrue:[ |
|
164 |
(selectedLine == 1) ifTrue:[ |
|
165 |
inspectedObject inspect |
|
166 |
] ifFalse:[ |
|
167 |
(inspectedObject at:selectedLine - 1) inspect |
|
168 |
]. |
|
169 |
] |
|
170 |
! |
|
171 |
||
73 | 172 |
removeIndex |
173 |
"remove selected item from the collection" |
|
174 |
||
175 |
selectedLine == 1 ifFalse:[ |
|
88 | 176 |
inspectedObject removeIndex:selectedLine -1. |
177 |
selectedLine := nil. |
|
178 |
inspectedObject changed. |
|
179 |
self inspect:inspectedObject. "force list update" |
|
73 | 180 |
] |
181 |
! |
|
182 |
||
183 |
valueAtLine:lineNr |
|
184 |
"helper - return the value of the selected entry" |
|
185 |
||
186 |
|index| |
|
187 |
||
645 | 188 |
hideReceiver ifFalse:[ |
189 |
(lineNr isNil or:[lineNr == 1]) ifTrue:[ |
|
190 |
^ inspectedObject |
|
191 |
]. |
|
192 |
index := lineNr - 1. "/ skip self |
|
193 |
] ifTrue:[ |
|
194 |
index := lineNr |
|
73 | 195 |
]. |
196 |
^ inspectedObject at:index |
|
197 |
||
645 | 198 |
"Modified: 28.6.1996 / 15:53:56 / cg" |
200 | 199 |
! ! |
73 | 200 |
|
1040 | 201 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 202 |
|
200 | 203 |
version |
2085 | 204 |
^ '$Header: /cvs/stx/stx/libtool/Attic/OCInspView.st,v 1.24 1999-03-29 15:10:59 cg Exp $' |
73 | 205 |
! ! |