New SetInspectorView.
'From Smalltalk/X, Version:2.10.9 on 13-feb-1996 at 12:09:01' !
InspectorView subclass:#SetInspectorView
instanceVariableNames:'keys'
classVariableNames:''
poolDictionaries:''
category:'Interface-Inspector'
!
!SetInspectorView class methodsFor:'documentation'!
documentation
"
A modified inspector for Sets
"
!
examples
"
#(a b c d e) asSet inspect
"
!
history
"Created: 13.2.1996 / 10:09:14 / stefan"
! !
!SetInspectorView methodsFor:'initialization'!
fieldMenu
|menu|
menu := super fieldMenu.
menu addLabels:#(
'-'
'remove element'
)
selectors:#(
nil
doRemoveKey
).
^ menu
! !
!SetInspectorView methodsFor:'private'!
fieldList
"return a list of names for the selectionlist. Leave hasMore as
true, if a '...' entry should be added."
|aList|
inspectedObject isNil ifTrue:[^ #()].
keys := inspectedObject asSortedCollection:[:a :b | a printString < b printString].
aList := keys collect:[:k | k isSymbol ifTrue:[
k printString
] ifFalse:[
k displayString
]
].
aList := aList asOrderedCollection.
aList addFirst:'self'.
^ aList
"Modified: 9.2.1996 / 12:02:19 / stefan"
!
release
"release inspected object"
keys := nil.
super release
"Created: 9.2.1996 / 12:04:30 / stefan"
! !
!SetInspectorView methodsFor:'user interaction'!
doAccept:theText
"accept value for selected item"
|value|
value := Compiler evaluate:theText receiver:inspectedObject notifying:workspace.
inspectedObject add:value.
inspectedObject changed.
self inspect:inspectedObject
!
doRemoveKey
"remove selected item from keys"
|key|
selectedLine == 1 ifFalse:[
key := (keys at:selectedLine - 1).
(inspectedObject includes:key) ifTrue:[
listView cursor:(Cursor wait).
inspectedObject remove:key.
keys := nil.
selectedLine := nil.
inspectedObject changed.
listView cursor:(Cursor hand).
self inspect:inspectedObject. "force list update"
].
]
!
valueAtLine:lineNr
"helper - return the value of the selected entry"
|key|
lineNr == 1 ifTrue:[
^ inspectedObject
].
key := (keys at:lineNr - 1).
^ key.
"Created: 9.2.1996 / 12:03:29 / stefan"
! !
!SetInspectorView class methodsFor:'documentation'!
version
"
$Header: /cvs/stx/stx/libtool/SetInspectorView.st,v 1.1 1996-02-14 09:51:50 stefan Exp $
"
! !