ClassInspectorView.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 01 Apr 2015 10:38:01 +0100
branchjv
changeset 15566 184cea584be5
parent 13173 e9da2324940d
parent 15533 705cf3d2d10a
child 16572 ab23beb4bba6
permissions -rw-r--r--
Merged 25c2a13f00c5 and e6512d88f1ab (branch default - CVS HEAD)

"{ Encoding: utf8 }"

"
 COPYRIGHT (c) 1994 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.
"
"{ Package: 'stx:libtool' }"

"{ NameSpace: Smalltalk }"

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

!ClassInspectorView class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1994 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.
"


!

documentation
"
    modified Inspector for Classes; in addition to instance variables,
    also shows ClassVariables in its left SelectionList.

        Array inspect
        View inspect
"
! !

!ClassInspectorView methodsFor:'accessing'!

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

    |aList|

    aList := super fieldList.

    "/
    "/ add class variables
    "/
    inspectedObject theNonMetaclass withAllSuperclasses reverseDo:[:aClass |
        |varNames|

        varNames := aClass classVarNames.
        varNames notEmpty ifTrue:[
            aList add:('--- classvariables from ' , aClass name allBold, ' ---').
            varNames do:[:classVarName |
                aList add:classVarName
            ]
        ]
    ].
    ^ aList
!

valueAtLine:lineNr
    "return a list of names to show in the selectionList"

    |list idx0|

    list := super fieldList.
    lineNr <= list size ifTrue:[ ^ super valueAtLine:lineNr ].

    "/
    "/ a class variable
    "/
    idx0 := list size + 1.
    inspectedObject class withAllSuperclasses reverseDo:[:aClass |
        |varNames varName|

        varNames := aClass classVarNames.
        varNames notEmpty ifTrue:[
            (lineNr between:idx0+1 and:(idx0 + 1 + varNames size - 1)) ifTrue:[
                varName := varNames at:lineNr-idx0.
                ^ aClass classVarAt:varName.
            ].
            idx0 := idx0 + varNames size + 1.
        ]
    ].
    ^ nil
! !

!ClassInspectorView class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/ClassInspectorView.st,v 1.15 2015-03-25 14:11:59 cg Exp $'
! !