ClassInspectorView.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 04:00:37 +0200
changeset 18220 d1ebaddf1100
parent 17392 8421115ff73b
child 18640 e83cc2cd72e3
permissions -rw-r--r--
#UI_ENHANCEMENT by cg class: Tools::CheckinInfoDialog class changed: #windowSpec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
     1
"
205d53e91c52 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
     3
              All Rights Reserved
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
     4
205d53e91c52 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
205d53e91c52 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
205d53e91c52 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
205d53e91c52 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
205d53e91c52 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
205d53e91c52 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
205d53e91c52 Initial revision
claus
parents:
diff changeset
    11
"
2997
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    12
"{ Package: 'stx:libtool' }"
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    13
15533
705cf3d2d10a class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 13697
diff changeset
    14
"{ NameSpace: Smalltalk }"
705cf3d2d10a class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 13697
diff changeset
    15
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    16
InspectorView subclass:#ClassInspectorView
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    17
	instanceVariableNames:''
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    18
	classVariableNames:''
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    19
	poolDictionaries:''
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    20
	category:'Interface-Inspector'
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    21
!
205d53e91c52 Initial revision
claus
parents:
diff changeset
    22
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    23
!ClassInspectorView class methodsFor:'documentation'!
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    24
205d53e91c52 Initial revision
claus
parents:
diff changeset
    25
copyright
205d53e91c52 Initial revision
claus
parents:
diff changeset
    26
"
205d53e91c52 Initial revision
claus
parents:
diff changeset
    27
 COPYRIGHT (c) 1994 by Claus Gittinger
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    28
              All Rights Reserved
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    29
205d53e91c52 Initial revision
claus
parents:
diff changeset
    30
 This software is furnished under a license and may be used
205d53e91c52 Initial revision
claus
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
205d53e91c52 Initial revision
claus
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
205d53e91c52 Initial revision
claus
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
205d53e91c52 Initial revision
claus
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
205d53e91c52 Initial revision
claus
parents:
diff changeset
    35
 hereby transferred.
205d53e91c52 Initial revision
claus
parents:
diff changeset
    36
"
205d53e91c52 Initial revision
claus
parents:
diff changeset
    37
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    38
2997
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    39
!
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    40
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    41
documentation
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    42
"
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    43
    modified Inspector for Classes; in addition to instance variables,
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    44
    also shows ClassVariables in its left SelectionList.
3200
4889a13402db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
    45
4889a13402db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
    46
        Array inspect
4889a13402db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2997
diff changeset
    47
        View inspect
2997
928594257211 Move documentation method to class protocol.
Stefan Vogel <sv@exept.de>
parents: 2271
diff changeset
    48
"
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    49
! !
205d53e91c52 Initial revision
claus
parents:
diff changeset
    50
205d53e91c52 Initial revision
claus
parents:
diff changeset
    51
!ClassInspectorView methodsFor:'accessing'!
205d53e91c52 Initial revision
claus
parents:
diff changeset
    52
2271
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    53
fieldList
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    54
    "return a list of names to show in the selectionList"
205d53e91c52 Initial revision
claus
parents:
diff changeset
    55
205d53e91c52 Initial revision
claus
parents:
diff changeset
    56
    |aList|
205d53e91c52 Initial revision
claus
parents:
diff changeset
    57
2271
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    58
    aList := super fieldList.
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    59
205d53e91c52 Initial revision
claus
parents:
diff changeset
    60
    "/
16548
b8f9c3d05c67 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 15533
diff changeset
    61
    "/ add class variables (always sorted)
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    62
    "/
15533
705cf3d2d10a class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 13697
diff changeset
    63
    inspectedObject theNonMetaclass withAllSuperclasses reverseDo:[:aClass |
17392
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    64
        |varNames headLine|
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    65
2271
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    66
        varNames := aClass classVarNames.
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    67
        varNames notEmpty ifTrue:[
16548
b8f9c3d05c67 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 15533
diff changeset
    68
            varNames sort.
17392
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    69
            aClass isSharedPool ifTrue:[
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    70
                headLine := resources string:'pool variables in %1' with:aClass name allBold.
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    71
            ] ifFalse:[    
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    72
                headLine := resources string:'class variables from %1' with:aClass name allBold.
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    73
            ].
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    74
            aList add:('--- ',headLine,' ---').
2271
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    75
            varNames do:[:classVarName |
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    76
                aList add:classVarName
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    77
            ]
0cf238543cb1 fixed and improved fieldNameList generation & use.
Claus Gittinger <cg@exept.de>
parents: 2236
diff changeset
    78
        ]
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
    79
    ].
205d53e91c52 Initial revision
claus
parents:
diff changeset
    80
    ^ aList
17392
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    81
8421115ff73b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 16654
diff changeset
    82
    "Modified: / 12-02-2017 / 11:03:47 / cg"
12447
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    83
!
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    84
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    85
valueAtLine:lineNr
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    86
    "return a list of names to show in the selectionList"
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    87
16654
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
    88
    |list idx0 nm cls|
12447
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    89
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    90
    list := super fieldList.
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    91
    lineNr <= list size ifTrue:[ ^ super valueAtLine:lineNr ].
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    92
16654
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
    93
    nm := self listEntryAt:lineNr.
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
    94
    nm isNil ifTrue:[ ^nil].
12447
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
    95
16654
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
    96
    "/
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
    97
    "/ a class variable?
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
    98
    "/
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
    99
    cls := inspectedObject class theNonMetaclass whichClassDefinesClassVar:nm.
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   100
    cls notNil ifTrue:[
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   101
        ^ cls classVarAt:nm.
12447
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   102
    ].
16654
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   103
    
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   104
"/    idx0 := list size + 1.
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   105
"/    inspectedObject class withAllSuperclasses reverseDo:[:aClass |
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   106
"/        |varNames varName|
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   107
"/
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   108
"/        varNames := aClass classVarNames.
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   109
"/        varNames notEmpty ifTrue:[
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   110
"/            (lineNr between:idx0+1 and:(idx0 + 1 + varNames size - 1)) ifTrue:[
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   111
"/                varName := varNames at:lineNr-idx0.
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   112
"/                ^ aClass classVarAt:varName.
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   113
"/            ].
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   114
"/            idx0 := idx0 + varNames size + 1.
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   115
"/        ]
769d7d0f32b4 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 16548
diff changeset
   116
"/    ].
12447
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   117
    ^ nil
30
205d53e91c52 Initial revision
claus
parents:
diff changeset
   118
! !
205d53e91c52 Initial revision
claus
parents:
diff changeset
   119
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   120
!ClassInspectorView class methodsFor:'documentation'!
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   121
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   122
version
16548
b8f9c3d05c67 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 15533
diff changeset
   123
    ^ '$Header$'
2236
257f587ad7dc migrate instvars 'inspectedObject' to 'object'
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
   124
! !
12447
a35a8b2fe1f5 class: ClassInspectorView
Claus Gittinger <cg@exept.de>
parents: 3201
diff changeset
   125