author | Claus Gittinger <cg@exept.de> |
Thu, 21 May 1998 13:32:17 +0200 | |
changeset 1666 | c9fdd884d706 |
parent 1235 | 13610578a5d2 |
child 1739 | d98fa6eea4fc |
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 ) |
|
91 |
('-' nil ) |
|
92 |
('browse' browse ) |
|
93 |
('browse class hierarchy' browseClassHierarchy ) |
|
94 |
('browse full class protocol' browseFullClassProtocol) |
|
95 |
('-' nil ) |
|
96 |
('remove' removeIndex ) |
|
97 |
('-' nil ) |
|
98 |
('show more' showMore ) |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
99 |
). |
18 | 100 |
] ifFalse:[ |
1666 | 101 |
items := #( |
102 |
('inspect' doInspect ) |
|
103 |
('basicInspect' doBasicInspect ) |
|
104 |
('inspect hierarchical' doNewInspect ) |
|
105 |
('-' nil ) |
|
106 |
('browse' browse ) |
|
107 |
('browse class hierarchy' browseClassHierarchy ) |
|
108 |
('browse full class protocol' browseFullClassProtocol) |
|
109 |
('-' nil ) |
|
110 |
('remove' inspectOwners ) |
|
111 |
"/ ('-' ) |
|
112 |
"/ ('owners' ) |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
113 |
). |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
114 |
]. |
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 |
monitorProcess isNil ifTrue:[ |
1666 | 117 |
items := items , #( ('-' nil) ('start monitor' doStartMonitor)). |
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
118 |
] ifFalse:[ |
1666 | 119 |
items := items , #( ('-' nil) ('stop monitor' doStopMonitor)). |
18 | 120 |
]. |
73 | 121 |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
122 |
m := PopUpMenu |
1666 | 123 |
itemList:items |
124 |
resources:resources. |
|
473
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
125 |
|
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
126 |
selectedLine isNil ifTrue:[ |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
127 |
m disableAll:#(doInspect doBasicInspect |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
128 |
browse browseClassHierarchy browseFullClassProtocol |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
129 |
doStartMonitor removeIndex) |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
130 |
] ifFalse:[ |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
131 |
selectedLine == 1 ifTrue:[ |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
132 |
m disable:#removeIndex |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
133 |
] |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
134 |
]. |
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 |
^ m |
5435d56402db
added monitor stuff to menu; items reordered
Claus Gittinger <cg@exept.de>
parents:
200
diff
changeset
|
137 |
|
1666 | 138 |
"Modified: / 21.5.1998 / 13:32:09 / cg" |
18 | 139 |
! ! |
73 | 140 |
|
141 |
!OrderedCollectionInspectorView methodsFor:'user interaction'! |
|
142 |
||
200 | 143 |
doAccept:theText |
144 |
|value| |
|
145 |
||
146 |
value := Compiler evaluate:theText |
|
147 |
receiver:inspectedObject |
|
148 |
notifying:workspace. |
|
149 |
||
150 |
selectedLine notNil ifTrue:[ |
|
151 |
selectedLine == 1 ifFalse:[ |
|
152 |
inspectedObject at:selectedLine - 1 put:value. |
|
153 |
inspectedObject changed |
|
154 |
] |
|
155 |
]. |
|
156 |
! |
|
157 |
||
158 |
doInspect |
|
159 |
"user selected inspect-menu entry" |
|
160 |
||
161 |
selectedLine notNil ifTrue:[ |
|
162 |
(selectedLine == 1) ifTrue:[ |
|
163 |
inspectedObject inspect |
|
164 |
] ifFalse:[ |
|
165 |
(inspectedObject at:selectedLine - 1) inspect |
|
166 |
]. |
|
167 |
] |
|
168 |
! |
|
169 |
||
73 | 170 |
removeIndex |
171 |
"remove selected item from the collection" |
|
172 |
||
173 |
selectedLine == 1 ifFalse:[ |
|
88 | 174 |
inspectedObject removeIndex:selectedLine -1. |
175 |
selectedLine := nil. |
|
176 |
inspectedObject changed. |
|
177 |
self inspect:inspectedObject. "force list update" |
|
73 | 178 |
] |
179 |
! |
|
180 |
||
181 |
valueAtLine:lineNr |
|
182 |
"helper - return the value of the selected entry" |
|
183 |
||
184 |
|index| |
|
185 |
||
645 | 186 |
hideReceiver ifFalse:[ |
187 |
(lineNr isNil or:[lineNr == 1]) ifTrue:[ |
|
188 |
^ inspectedObject |
|
189 |
]. |
|
190 |
index := lineNr - 1. "/ skip self |
|
191 |
] ifTrue:[ |
|
192 |
index := lineNr |
|
73 | 193 |
]. |
194 |
^ inspectedObject at:index |
|
195 |
||
645 | 196 |
"Modified: 28.6.1996 / 15:53:56 / cg" |
200 | 197 |
! ! |
73 | 198 |
|
1040 | 199 |
!OrderedCollectionInspectorView class methodsFor:'documentation'! |
73 | 200 |
|
200 | 201 |
version |
1666 | 202 |
^ '$Header: /cvs/stx/stx/libtool/OrderedCollectionInspectorView.st,v 1.20 1998-05-21 11:32:17 cg Exp $' |
73 | 203 |
! ! |