OrderedCollectionInspectorView.st
author claus
Sun, 16 Jan 1994 05:02:19 +0100
changeset 23 3363884b8e9f
parent 18 850295468cac
child 29 8a72e10043f6
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:[
        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
! !