author | Jan Vrany <jan.vrany@labware.com> |
Tue, 09 Jun 2020 11:02:53 +0100 | |
branch | jv |
changeset 19589 | 8f1c638e83cf |
parent 18532 | cccb41254edf |
permissions | -rw-r--r-- |
2627 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by Claus Gittinger / eXept Software AG |
|
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 |
||
15801 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
370 | 16 |
InspectorView subclass:#SetInspectorView |
17 |
instanceVariableNames:'keys' |
|
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Interface-Inspector' |
|
21 |
! |
|
22 |
||
794 | 23 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 24 |
|
2627 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1996 by Claus Gittinger / eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
! |
|
39 |
||
370 | 40 |
documentation |
41 |
" |
|
42 |
A modified inspector for Sets |
|
510 | 43 |
|
44 |
[author:] |
|
45 |
Stefan Vogel |
|
370 | 46 |
" |
47 |
! |
|
48 |
||
49 |
examples |
|
50 |
" |
|
51 |
#(a b c d e) asSet inspect |
|
52 |
" |
|
53 |
! ! |
|
54 |
||
6491 | 55 |
!SetInspectorView methodsFor:'menu'! |
370 | 56 |
|
57 |
fieldMenu |
|
1361 | 58 |
<resource: #programMenu > |
59 |
||
370 | 60 |
|menu| |
61 |
||
62 |
menu := super fieldMenu. |
|
63 |
menu addLabels:#( |
|
64 |
'-' |
|
3200 | 65 |
'Remove element' |
370 | 66 |
) |
67 |
selectors:#( |
|
68 |
nil |
|
69 |
doRemoveKey |
|
70 |
). |
|
71 |
||
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
72 |
(self keyIndexForLine:selectionIndex) isNil ifTrue:[ |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
73 |
menu disableAll:#(doRemoveKey) |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
74 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
75 |
|
370 | 76 |
^ menu |
1361 | 77 |
|
78 |
"Modified: / 29.10.1997 / 03:41:47 / cg" |
|
370 | 79 |
! ! |
80 |
||
81 |
!SetInspectorView methodsFor:'private'! |
|
82 |
||
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
83 |
baseInspectedObjectClass |
15801 | 84 |
(inspectedObject class inheritsFrom:Set) ifTrue:[ |
85 |
^ Set |
|
6324 | 86 |
]. |
15801 | 87 |
^ Object |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
88 |
! |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
89 |
|
647 | 90 |
defaultLabel |
4095
5bd36b14723d
labels; added suppressPseudoVars & dereferenceValueHolders
Claus Gittinger <cg@exept.de>
parents:
3884
diff
changeset
|
91 |
^ 'Contents' |
647 | 92 |
|
93 |
" |
|
94 |
(Set with:1 with:2 with:3) inspect |
|
95 |
" |
|
96 |
||
97 |
"Modified: 28.6.1996 / 16:05:42 / cg" |
|
98 |
! |
|
99 |
||
6943 | 100 |
derivedFields |
11894 | 101 |
^ super derivedFields |
102 |
"/ |
|
103 |
"/ size is already there |
|
104 |
"/ ^ Dictionary new |
|
105 |
"/ declareAllNewFrom:(super derivedFields ? #()); |
|
106 |
"/ add:('-size' -> [ object size ]); |
|
107 |
"/ yourself |
|
6943 | 108 |
|
7379 | 109 |
"Modified: / 09-10-2006 / 12:27:21 / cg" |
6943 | 110 |
! |
111 |
||
3875 | 112 |
indexList |
113 |
"return a list of indexes to show in the selectionList. |
|
114 |
Set hasMore to true, if a '...' entry should be added." |
|
115 |
||
8526
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
116 |
inspectedObject size > nShown ifTrue:[ |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
117 |
|coll| |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
118 |
|
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
119 |
coll := (SortedCollection new:nShown) sortBlock:[:a :b | a displayString < b displayString]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
120 |
inspectedObject do:[:el | |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
121 |
coll add:el. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
122 |
coll size >= nShown ifTrue:[ |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
123 |
hasMore := true. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
124 |
^ coll |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
125 |
]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
126 |
]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
127 |
]. |
5ecd6ffcfa6c
also show only the first nShown names;
Claus Gittinger <cg@exept.de>
parents:
7379
diff
changeset
|
128 |
|
3875 | 129 |
^ inspectedObject asSortedCollection:[:a :b | a displayString < b displayString]. |
130 |
! |
|
131 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
132 |
indexedFieldList |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
133 |
"return a list of indexed-variable names to show in the selectionList. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
134 |
Set hasMore to true, if a '...' entry should be added." |
370 | 135 |
|
3875 | 136 |
keys := self indexList. |
15801 | 137 |
^ keys collect:[:k | k displayString]. |
370 | 138 |
! |
139 |
||
12833 | 140 |
numIndexedFields |
141 |
^ inspectedObject size |
|
142 |
! |
|
143 |
||
370 | 144 |
release |
145 |
"release inspected object" |
|
146 |
||
147 |
keys := nil. |
|
148 |
super release |
|
149 |
||
150 |
"Created: 9.2.1996 / 12:04:30 / stefan" |
|
3884 | 151 |
! |
152 |
||
153 |
showAllIndexedVarsInFieldList |
|
15801 | 154 |
^ true |
155 |
! ! |
|
156 |
||
157 |
!SetInspectorView methodsFor:'queries'! |
|
158 |
||
159 |
isIndexShown |
|
3884 | 160 |
^ false |
370 | 161 |
! ! |
162 |
||
163 |
!SetInspectorView methodsFor:'user interaction'! |
|
164 |
||
165 |
doRemoveKey |
|
166 |
"remove selected item from keys" |
|
167 |
||
2192 | 168 |
|key idx| |
370 | 169 |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
170 |
idx := self keyIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
171 |
idx notNil ifTrue:[ |
2192 | 172 |
key := keys at:idx. |
370 | 173 |
(inspectedObject includes:key) ifTrue:[ |
174 |
listView cursor:(Cursor wait). |
|
175 |
inspectedObject remove:key. |
|
176 |
keys := nil. |
|
2236
257f587ad7dc
migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents:
2193
diff
changeset
|
177 |
selectionIndex := selectedLine := nil. |
370 | 178 |
inspectedObject changed. |
179 |
listView cursor:(Cursor hand). |
|
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
180 |
self reinspect. |
370 | 181 |
]. |
182 |
] |
|
183 |
||
184 |
||
185 |
! |
|
186 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
187 |
indexedValueAtIndex:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
188 |
^ keys at:idx |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
189 |
! |
370 | 190 |
|
3884 | 191 |
indexedValueAtKey:idx |
15801 | 192 |
^ idx |
3884 | 193 |
! |
194 |
||
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
195 |
valueAtLine:lineNr put:newValue |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
196 |
"store newValue; |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
197 |
For non-named instvars, we add the new value - ignoring the selection" |
370 | 198 |
|
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
199 |
|idx| |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
200 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
201 |
idx := self instVarIndexForLine:selectionIndex. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
202 |
idx notNil ifTrue:[ |
2271
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
203 |
inspectedObject instVarAt:idx put:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
204 |
] ifFalse:[ |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
205 |
inspectedObject add:newValue. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
206 |
|
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
207 |
"/ inspectedObject changed. |
0cf238543cb1
fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents:
2236
diff
changeset
|
208 |
self reinspect. |
2193
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
209 |
]. |
3d7b1044e8c8
fixed access to namedInstvars
Claus Gittinger <cg@exept.de>
parents:
2192
diff
changeset
|
210 |
|
370 | 211 |
|
212 |
! ! |
|
213 |
||
794 | 214 |
!SetInspectorView class methodsFor:'documentation'! |
370 | 215 |
|
216 |
version |
|
15801 | 217 |
^ '$Header$' |
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
218 |
! |
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
219 |
|
12431
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
220 |
version_HG |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
221 |
|
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
222 |
^ '$Changeset: <not expanded> $' |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
223 |
! |
9f0c59c742d5
Added LintRuleSettingsApplication and LintRuleEditDialog to define user-defined rule sets.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12401
diff
changeset
|
224 |
|
12128
a7ff7d66ee85
Improvements in LintHighlighter, few fixes
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
12125
diff
changeset
|
225 |
version_SVN |
12308 | 226 |
^ '$Id: SetInspectorView.st 8074 2012-11-30 17:23:39Z vranyj1 $' |
370 | 227 |
! ! |
12833 | 228 |