370
|
1 |
'From Smalltalk/X, Version:2.10.9 on 13-feb-1996 at 12:09:01' !
|
|
2 |
|
|
3 |
InspectorView subclass:#SetInspectorView
|
|
4 |
instanceVariableNames:'keys'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Interface-Inspector'
|
|
8 |
!
|
|
9 |
|
|
10 |
!SetInspectorView class methodsFor:'documentation'!
|
|
11 |
|
|
12 |
documentation
|
|
13 |
"
|
|
14 |
A modified inspector for Sets
|
|
15 |
"
|
|
16 |
!
|
|
17 |
|
|
18 |
examples
|
|
19 |
"
|
|
20 |
#(a b c d e) asSet inspect
|
|
21 |
"
|
|
22 |
!
|
|
23 |
|
|
24 |
history
|
|
25 |
"Created: 13.2.1996 / 10:09:14 / stefan"
|
|
26 |
! !
|
|
27 |
|
|
28 |
!SetInspectorView methodsFor:'initialization'!
|
|
29 |
|
|
30 |
fieldMenu
|
|
31 |
|menu|
|
|
32 |
|
|
33 |
menu := super fieldMenu.
|
|
34 |
menu addLabels:#(
|
|
35 |
'-'
|
|
36 |
'remove element'
|
|
37 |
)
|
|
38 |
selectors:#(
|
|
39 |
nil
|
|
40 |
doRemoveKey
|
|
41 |
).
|
|
42 |
|
|
43 |
^ menu
|
|
44 |
! !
|
|
45 |
|
|
46 |
!SetInspectorView methodsFor:'private'!
|
|
47 |
|
|
48 |
fieldList
|
|
49 |
"return a list of names for the selectionlist. Leave hasMore as
|
|
50 |
true, if a '...' entry should be added."
|
|
51 |
|
|
52 |
|aList|
|
|
53 |
|
|
54 |
inspectedObject isNil ifTrue:[^ #()].
|
|
55 |
|
|
56 |
keys := inspectedObject asSortedCollection:[:a :b | a printString < b printString].
|
|
57 |
aList := keys collect:[:k | k isSymbol ifTrue:[
|
|
58 |
k printString
|
|
59 |
] ifFalse:[
|
|
60 |
k displayString
|
|
61 |
]
|
|
62 |
].
|
|
63 |
aList := aList asOrderedCollection.
|
|
64 |
aList addFirst:'self'.
|
|
65 |
^ aList
|
|
66 |
|
|
67 |
"Modified: 9.2.1996 / 12:02:19 / stefan"
|
|
68 |
!
|
|
69 |
|
|
70 |
release
|
|
71 |
"release inspected object"
|
|
72 |
|
|
73 |
keys := nil.
|
|
74 |
super release
|
|
75 |
|
|
76 |
"Created: 9.2.1996 / 12:04:30 / stefan"
|
|
77 |
! !
|
|
78 |
|
|
79 |
!SetInspectorView methodsFor:'user interaction'!
|
|
80 |
|
|
81 |
doAccept:theText
|
|
82 |
"accept value for selected item"
|
|
83 |
|
|
84 |
|value|
|
|
85 |
|
|
86 |
value := Compiler evaluate:theText receiver:inspectedObject notifying:workspace.
|
|
87 |
|
|
88 |
inspectedObject add:value.
|
|
89 |
inspectedObject changed.
|
|
90 |
self inspect:inspectedObject
|
|
91 |
|
|
92 |
|
|
93 |
!
|
|
94 |
|
|
95 |
doRemoveKey
|
|
96 |
"remove selected item from keys"
|
|
97 |
|
|
98 |
|key|
|
|
99 |
|
|
100 |
selectedLine == 1 ifFalse:[
|
|
101 |
key := (keys at:selectedLine - 1).
|
|
102 |
(inspectedObject includes:key) ifTrue:[
|
|
103 |
listView cursor:(Cursor wait).
|
|
104 |
inspectedObject remove:key.
|
|
105 |
keys := nil.
|
|
106 |
selectedLine := nil.
|
|
107 |
inspectedObject changed.
|
|
108 |
listView cursor:(Cursor hand).
|
|
109 |
self inspect:inspectedObject. "force list update"
|
|
110 |
].
|
|
111 |
]
|
|
112 |
|
|
113 |
|
|
114 |
!
|
|
115 |
|
|
116 |
valueAtLine:lineNr
|
|
117 |
"helper - return the value of the selected entry"
|
|
118 |
|
|
119 |
|key|
|
|
120 |
|
|
121 |
lineNr == 1 ifTrue:[
|
|
122 |
^ inspectedObject
|
|
123 |
].
|
|
124 |
key := (keys at:lineNr - 1).
|
|
125 |
^ key.
|
|
126 |
|
|
127 |
"Created: 9.2.1996 / 12:03:29 / stefan"
|
|
128 |
! !
|
|
129 |
|
|
130 |
!SetInspectorView class methodsFor:'documentation'!
|
|
131 |
|
|
132 |
version
|
|
133 |
"
|
|
134 |
$Header: /cvs/stx/stx/libtool/SetInspectorView.st,v 1.1 1996-02-14 09:51:50 stefan Exp $
|
|
135 |
"
|
|
136 |
! !
|