InspectorList.st
author Claus Gittinger <cg@exept.de>
Fri, 22 May 1998 11:57:38 +0200
changeset 847 15f688710007
parent 810 032e13b1bfda
child 1022 afd2ac9d1b55
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     1
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     3
              All Rights Reserved
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     4
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     5
 This software is furnished under a license and may be used
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     6
 only in accordance with the terms of that license and with the
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     8
 be provided or otherwise made available to, or used by, any
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
     9
 other person.  No title to or ownership of the software is
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    10
 hereby transferred.
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    11
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    12
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    13
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    14
"{ NameSpace: NewInspector }"
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    15
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    16
Object subclass:#InspectorList
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    17
	instanceVariableNames:'inspectedObject instanceNames instanceTypes selection'
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    18
	classVariableNames:''
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    19
	poolDictionaries:''
810
032e13b1bfda category change
Claus Gittinger <cg@exept.de>
parents: 809
diff changeset
    20
	category:'Interface-Inspector'
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    21
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    22
809
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    23
!InspectorList class methodsFor:'documentation'!
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    24
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    25
copyright
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    26
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    27
 COPYRIGHT (c) 1997 by eXept Software AG
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    28
              All Rights Reserved
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    29
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    30
 This software is furnished under a license and may be used
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    31
 only in accordance with the terms of that license and with the
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    33
 be provided or otherwise made available to, or used by, any
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    34
 other person.  No title to or ownership of the software is
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    35
 hereby transferred.
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    36
"
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    37
6f127dd5e578 added copyright & documentation
Claus Gittinger <cg@exept.de>
parents: 327
diff changeset
    38
! !
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    39
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    40
!InspectorList class methodsFor:'instance creation'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    41
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    42
for:anObject
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    43
    "create a new list for an instance
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    44
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    45
    ^ self new inspect:anObject
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    46
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    47
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    48
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    49
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    50
new
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    51
    "create a new instance and set the inspected object to nil
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    52
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    53
    ^ self basicNew initialize.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    54
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    55
! !
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    56
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    57
!InspectorList class methodsFor:'helpers'!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    58
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    59
asString:aCollection
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    60
    "converts any collection to a string seperated by spaces. If
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    61
     the collection is empty or nil, nil is returned otherwise a
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    62
     string.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    63
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    64
    |string|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    65
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    66
    aCollection isCollection ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    67
        aCollection isString ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    68
            string := aCollection
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    69
        ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    70
            string := aCollection asStringWith:Character space
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    71
                                          from:1 to:(aCollection size)
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    72
                                  compressTabs:true 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    73
                                         final:nil
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    74
        ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    75
        string := string withoutSeparators.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    76
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    77
        string notEmpty ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    78
            ^ string
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    79
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    80
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    81
    ^ nil
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    82
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    83
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    84
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    85
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    86
!InspectorList class methodsFor:'testing'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    87
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    88
isDirectory:anInstance
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
    89
    "returns true if the instance is a directory
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    90
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    91
    |cls|
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    92
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    93
    anInstance notNil ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    94
        cls := anInstance class.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    95
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    96
        cls == Character  ifTrue:[ ^ false ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    97
        cls == Symbol     ifTrue:[ ^ false ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    98
        cls == String     ifTrue:[ ^ false ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    99
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   100
        cls allInstVarNames notEmpty ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   101
            ^ true
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   102
        ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   103
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   104
        anInstance isVariable ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   105
            ^ true
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   106
        ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   107
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   108
    ^ false
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   109
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   110
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   111
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   112
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   113
isTraceable:anInstance
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   114
    "returns true if the instance could be traced or traped
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   115
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   116
    |cls|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   117
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   118
    anInstance notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   119
        cls := anInstance class.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   120
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   121
      ^ (     cls ~~ True
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   122
         and:[cls ~~ False
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   123
         and:[cls ~~ SmallInteger]]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   124
        )
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   125
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   126
    ^ false.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   127
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   128
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   129
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   130
!InspectorList methodsFor:'accessing'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   131
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   132
includesSelf:aBoolean
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   133
    "includes 'self' dependant on the boolean
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   134
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   135
    (self includesSelf) ~~ aBoolean ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   136
        aBoolean ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   137
            instanceNames addFirst:'self'.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   138
            instanceTypes addFirst:#self.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   139
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   140
            selection notNil ifTrue:[selection := selection + 1]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   141
                            ifFalse:[selection := 1]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   142
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   143
        ] ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   144
            instanceNames removeFirst.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   145
            instanceTypes removeFirst.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   146
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   147
            selection isNil ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   148
                (selection := selection - 1) == 0 ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   149
                    selection := nil
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   150
                ]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   151
            ]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   152
        ]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   153
    ]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   154
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   155
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   156
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   157
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   158
list
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   159
    "returns self
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   160
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   161
    ^ self
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   162
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   163
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   164
size
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   165
    "returns size of list
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   166
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   167
    ^ instanceNames size
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   168
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   169
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   170
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   171
update
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   172
    "update list contents
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   173
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   174
    |start stop size|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   175
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   176
    inspectedObject isVariable ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   177
        start := instanceNames findFirst:[:el|(el at:1) isDigit].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   178
        stop  := instanceTypes size.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   179
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   180
        start == 0 ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   181
            size := stop + 10.  "must be > 1: force a resize the first time"   
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   182
        ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   183
            instanceTypes last ~~ #grow ifTrue:[size := stop]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   184
                                       ifFalse:[size := stop-1].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   185
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   186
            instanceTypes removeFromIndex:start toIndex:stop.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   187
            instanceNames removeFromIndex:start toIndex:stop.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   188
        ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   189
        self resizeTo:size.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   190
    ]
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   191
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   192
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   193
!InspectorList methodsFor:'accessing contents'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   194
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   195
inspectedObject
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   196
    "returns current inspected object
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   197
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   198
    ^ inspectedObject
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   199
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   200
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   201
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   202
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   203
instanceNames
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   204
    "returns list of instance names
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   205
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   206
    ^ instanceNames
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   207
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   208
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   209
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   210
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   211
instanceTypeAt:anIndex
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   212
    "returns type assigned to the list entry (#directory #normal #self #grow)
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   213
     In case of an invalid index nil is returned.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   214
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   215
    (anIndex isNil or:[anIndex > instanceTypes size]) ifFalse:[^ instanceTypes at:anIndex]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   216
                                                       ifTrue:[^ nil].
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   217
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   218
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   219
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   220
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   221
instanceTypes
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   222
    "returns list of types (#directory #normal #self #grow)
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   223
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   224
    ^ instanceTypes
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   225
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   226
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   227
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   228
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   229
instanceVarAt:anIndex
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   230
    "returns the instnace variable assigned to the index or 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   231
     nil in case of an invalid index.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   232
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 38
diff changeset
   233
    |nm|
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   234
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   235
    (anIndex isNil or:[anIndex > instanceTypes size]) ifFalse:[
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   236
        nm := instanceNames at:anIndex.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   237
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   238
        (nm at:1) isDigit ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   239
            self includesSelf ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   240
                ^ inspectedObject instVarAt:anIndex
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   241
            ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   242
            anIndex == 1 ifFalse:[^ inspectedObject instVarAt:(anIndex-1)]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   243
                          ifTrue:[^ inspectedObject]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   244
        ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   245
      ^ inspectedObject basicAt:(Number readFrom:nm onError:0)
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   246
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   247
    ^ nil
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   248
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   249
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   250
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   251
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   252
!InspectorList methodsFor:'initialization'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   253
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   254
initialize
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   255
    "initialize instance attributes
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   256
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   257
    super initialize.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   258
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   259
    instanceNames := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   260
    instanceTypes := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   261
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   262
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   263
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   264
!InspectorList methodsFor:'private'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   265
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   266
resizeTo:aNumber
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   267
    "resize list to minimum aNumber
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   268
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   269
    |lstVarId basicSize newLastId obj instSize|
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   270
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   271
    (inspectedObject isVariable and:[self class isDirectory:inspectedObject]) ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   272
        ^ self
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   273
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   274
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   275
    instanceTypes size == 0 ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   276
        lstVarId := 0
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   277
    ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   278
        instSize := inspectedObject class instSize.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   279
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   280
        instanceTypes first == #self ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   281
            instSize := instSize + 1
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   282
        ].
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   283
        instanceTypes last == #grow ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   284
            instanceNames removeLast.       " ..    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   285
            instanceTypes removeLast.       " #grow "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   286
        ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   287
        lstVarId := instanceTypes size - instSize.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   288
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   289
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   290
    (basicSize := inspectedObject basicSize) == lstVarId ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   291
        ^ self
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   292
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   293
    newLastId := (1 bitShift:((aNumber-1) highBit)) max:128.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   294
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   295
    (newLastId + 64) > basicSize ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   296
        newLastId := basicSize
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   297
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   298
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   299
    [lstVarId ~~ newLastId] whileTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   300
        lstVarId := lstVarId + 1.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   301
        obj := inspectedObject basicAt:lstVarId.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   302
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   303
        (self class isDirectory:obj) ifTrue:[instanceTypes add:#directory]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   304
                                    ifFalse:[instanceTypes add:#normal].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   305
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   306
        instanceNames add:(lstVarId printString, '   ', obj class name printString).
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   307
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   308
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   309
    lstVarId ~~ basicSize ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   310
        instanceNames add:'..'.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   311
        instanceTypes add:#grow
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   312
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   313
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   314
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   315
!InspectorList methodsFor:'selections'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   316
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   317
selectedInstanceType
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   318
    "returns type assigned to the selected list entry (#directory #normal #self #grow).
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   319
     In case of no selection nil is returned.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   320
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   321
    ^ self instanceTypeAt:selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   322
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   323
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   324
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   325
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   326
selectedInstanceVar
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   327
    "returns current inspected instance variable or nil
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   328
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   329
    ^ self instanceVarAt:selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   330
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   331
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   332
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   333
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   334
selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   335
    "returns current selection number or nil
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   336
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   337
    ^ selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   338
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   339
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   340
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   341
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   342
setSelection:aNrOrNil
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   343
    "change current selection to a number or nil; may resize the lists
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   344
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   345
    selection := aNrOrNil.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   346
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   347
    (selection isNil or:[instanceTypes size > selection]) ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   348
        self resizeTo:selection.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   349
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   350
        selection > instanceTypes size ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   351
            selection := nil
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   352
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   353
    ]    
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   354
! !
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   355
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   356
!InspectorList methodsFor:'testing'!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   357
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   358
includesSelf
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   359
    "returns true if 'self' is included in the list
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   360
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   361
    ^ (instanceTypes notEmpty and:[instanceTypes first == #self])
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   362
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   363
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   364
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   365
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   366
isEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   367
    "returns true if the list is empty
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   368
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   369
    ^ instanceNames isEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   370
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   371
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   372
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   373
notEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   374
    "returns true if the list is not empty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   375
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   376
    ^ instanceNames notEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   377
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   378
! !
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   379
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   380
!InspectorList methodsFor:'user interaction'!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   381
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   382
accept:aText notifying:aView
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   383
    "evaluating aText on the selected instance var; if an error occurs #Error
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   384
     is returned otherwise the inspected object instance. On success the list
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   385
     will be updated.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   386
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   387
    |text slNr value|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   388
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   389
    selection notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   390
        text := self class asString:aText.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   391
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   392
        text notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   393
            self includesSelf ifFalse:[slNr := selection]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   394
                               ifTrue:[slNr := selection-1].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   395
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   396
            value := inspectedObject class evaluatorClass 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   397
                       evaluate:text
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   398
                       receiver:inspectedObject 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   399
                      notifying:aView.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   400
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   401
            slNr ~~ 0 ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   402
                (inspectedObject class isVariable) ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   403
                    inspectedObject instVarAt:slNr put:value
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   404
                ] ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   405
                    slNr <= (inspectedObject class instSize) ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   406
                        inspectedObject instVarAt:slNr put:value
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   407
                    ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   408
                        slNr := slNr - inspectedObject class instSize.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   409
                        inspectedObject basicAt:slNr put:value
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   410
                    ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   411
                ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   412
            ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   413
            inspectedObject changed.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   414
            self update.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   415
          ^ inspectedObject
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   416
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   417
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   418
    ^ #Error
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   419
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   420
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   421
doIt:aCode notifying:aView
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   422
    "evaluating aCode on the selected instance var; if an error occurs #Error
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   423
     is returned otherwise the result returned from the evaluator. On success
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   424
     the list will be updated.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   425
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   426
    |successFg result evaluator selInstVar code|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   427
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   428
    selInstVar := self selectedInstanceVar.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   429
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   430
    selInstVar notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   431
        code := self class asString:aCode.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   432
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   433
        code notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   434
            evaluator := selInstVar class evaluatorClass.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   435
            successFg := true.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   436
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   437
            evaluator notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   438
                result := evaluator evaluate:code 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   439
                                          in:nil 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   440
                                    receiver:selInstVar 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   441
                                   notifying:aView 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   442
                                      logged:true 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   443
                                      ifFail:[successFg := false].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   444
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   445
                successFg ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   446
                    self update. 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   447
                  ^ result 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   448
                ]
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   449
            ]
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   450
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   451
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   452
    ^ #Error.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   453
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   454
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   455
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   456
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   457
inspect:anObject
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   458
    "inspect a new instance; update contents
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   459
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   460
    |varNamesSize|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   461
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   462
    selection := nil.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   463
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   464
    anObject == inspectedObject ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   465
        inspectedObject := anObject.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   466
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   467
        (self class isDirectory:inspectedObject) ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   468
            instanceNames := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   469
            instanceTypes := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   470
        ] ifTrue:[    
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   471
            instanceNames := inspectedObject class allInstVarNames.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   472
            varNamesSize  := instanceNames size.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   473
            instanceTypes := OrderedCollection new:varNamesSize.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   474
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   475
            1 to:varNamesSize do:[:i|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   476
                (self class isDirectory:(inspectedObject instVarAt:i)) ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   477
                    instanceTypes add:#directory
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   478
                ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   479
                    instanceTypes add:#normal
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   480
                ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   481
            ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   482
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   483
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   484
    self update
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   485
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   486
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   487
!InspectorList class methodsFor:'documentation'!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   488
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   489
version
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   490
    ^ '$Header$'
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   491
! !