OCInspView.st
author claus
Thu, 17 Nov 1994 15:47:59 +0100
changeset 52 7b48409ae088
parent 29 8a72e10043f6
child 56 d0cb937cbcaa
permissions -rw-r--r--
*** empty log message ***

"
 COPYRIGHT (c) 1989 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

InspectorView subclass:#OrderedCollectionInspectorView
	 instanceVariableNames:''
	 classVariableNames:''
	 poolDictionaries:''
	 category:'Interface-Inspector'
!

!OrderedCollectionInspectorView methodsFor:'user interaction'!

showSelection:lineNr
    "user clicked on an instvar - show value in workspace"

    |val string|

    workspace contents:nil.
    lineNr == 1 ifTrue:[
	"selecting self also does a re-set, this allows updating the list"
	self inspect:inspectedObject.
	val := inspectedObject
    ] ifFalse:[
	val := inspectedObject at:(lineNr - 1)
    ].
    string := val displayString.
    workspace paste:string.
    selectedLine := lineNr
!

doAccept:theText
    |value|

    value := Compiler evaluate:theText
		      receiver:inspectedObject 
		     notifying:workspace.

    inspectedValues isNil ifTrue:[
	selectedLine notNil ifTrue:[
	    selectedLine == 1 ifFalse:[
		inspectedObject at:selectedLine - 1 put:value.
		inspectedObject changed
	    ]
	]
    ].
!

doInspect
    "user selected inspect-menu entry"

    selectedLine notNil ifTrue:[
	inspectedValues isNil ifTrue:[
	    (selectedLine == 1) ifTrue:[
		inspectedObject inspect
	    ] ifFalse:[
		(inspectedObject at:selectedLine - 1) inspect
	    ]
	].
    ]
! !

!OrderedCollectionInspectorView methodsFor:'accessing'!

listOfNames
    "return a list of names to show in the selectionList"

    |aList n cut|

    aList := Text new.
    aList add:'self'.
    n := inspectedObject size.
    (n > nShown) ifTrue:[
	n := nShown.
	cut := true.
	listView setMiddleButtonMenu:menu2.
    ] ifFalse:[
	cut := false.
	listView setMiddleButtonMenu:menu1.
    ].
    1 to:n do:[:index |
	aList add:(index printString)
    ].
    cut ifTrue:[
	aList add:' ... '
    ].
    ^ aList
! !