NewInspectorList.st
author Claus Gittinger <cg@exept.de>
Tue, 24 Oct 2000 20:23:46 +0200
changeset 1419 f808d17ff6f5
parent 1213 6cf7a4c2dfce
child 2621 285fa261cbcb
permissions -rw-r--r--
*** empty log message ***
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
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
    16
Object subclass:#NewInspectorList
33
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:''
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
    20
	category:'Interface-NewInspector'
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    21
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
    22
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
    23
!NewInspectorList class methodsFor:'documentation'!
809
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
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
    40
!NewInspectorList class methodsFor:'instance creation'!
33
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
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
    57
!NewInspectorList class methodsFor:'helpers'!
38
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
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
    86
!NewInspectorList class methodsFor:'testing'!
33
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 ].
1022
afd2ac9d1b55 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
    99
        cls == Float      ifTrue:[ ^ false ].
afd2ac9d1b55 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
   100
        cls == ShortFloat ifTrue:[ ^ false ].
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   101
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   102
        cls allInstVarNames notEmpty ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   103
            ^ true
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   104
        ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   105
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   106
        anInstance isVariable ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   107
            ^ true
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   108
        ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   109
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   110
    ^ false
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   111
1022
afd2ac9d1b55 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
   112
    "Modified: / 4.2.1999 / 20:00:11 / cg"
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   113
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   114
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   115
isTraceable:anInstance
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   116
    "returns true if the instance could be traced or traped
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   117
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   118
    |cls|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   119
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   120
    anInstance notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   121
        cls := anInstance class.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   122
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   123
      ^ (     cls ~~ True
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   124
         and:[cls ~~ False
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   125
         and:[cls ~~ SmallInteger]]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   126
        )
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   127
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   128
    ^ false.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   129
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   130
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   131
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   132
!NewInspectorList methodsFor:'accessing'!
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   133
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   134
includesSelf:aBoolean
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   135
    "includes 'self' dependant on the boolean
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   136
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   137
    (self includesSelf) ~~ aBoolean ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   138
        aBoolean ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   139
            instanceNames addFirst:'self'.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   140
            instanceTypes addFirst:#self.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   141
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   142
            selection notNil ifTrue:[selection := selection + 1]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   143
                            ifFalse:[selection := 1]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   144
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   145
        ] ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   146
            instanceNames removeFirst.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   147
            instanceTypes removeFirst.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   148
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   149
            selection isNil ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   150
                (selection := selection - 1) == 0 ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   151
                    selection := nil
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
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   158
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   159
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   160
list
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   161
    "returns self
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   162
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   163
    ^ self
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   164
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   165
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   166
size
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   167
    "returns size of list
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   168
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   169
    ^ instanceNames size
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   170
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   171
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   172
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   173
update
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   174
    "update list contents
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   175
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   176
    |start stop size|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   177
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   178
    inspectedObject isVariable ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   179
        start := instanceNames findFirst:[:el|(el at:1) isDigit].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   180
        stop  := instanceTypes size.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   181
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   182
        start == 0 ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   183
            size := stop + 10.  "must be > 1: force a resize the first time"   
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   184
        ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   185
            instanceTypes last ~~ #grow ifTrue:[size := stop]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   186
                                       ifFalse:[size := stop-1].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   187
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   188
            instanceTypes removeFromIndex:start toIndex:stop.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   189
            instanceNames removeFromIndex:start toIndex:stop.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   190
        ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   191
        self resizeTo:size.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   192
    ]
1022
afd2ac9d1b55 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
   193
afd2ac9d1b55 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 810
diff changeset
   194
    "Modified: / 4.2.1999 / 20:00:38 / cg"
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   195
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   196
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   197
!NewInspectorList methodsFor:'accessing contents'!
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   198
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   199
inspectedObject
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   200
    "returns current inspected object
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   201
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   202
    ^ inspectedObject
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   203
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   204
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   205
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   206
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   207
instanceNames
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   208
    "returns list of instance names
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   209
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   210
    ^ instanceNames
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   211
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   212
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   213
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   214
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   215
instanceTypeAt:anIndex
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   216
    "returns type assigned to the list entry (#directory #normal #self #grow)
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   217
     In case of an invalid index nil is returned.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   218
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   219
    (anIndex isNil or:[anIndex > instanceTypes size]) ifFalse:[^ instanceTypes at:anIndex]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   220
                                                       ifTrue:[^ nil].
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   221
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   222
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   223
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   224
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   225
instanceTypes
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   226
    "returns list of types (#directory #normal #self #grow)
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   227
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   228
    ^ instanceTypes
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   229
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   230
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   231
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   232
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   233
instanceVarAt:anIndex
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   234
    "returns the instnace variable assigned to the index or 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   235
     nil in case of an invalid index.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   236
    "
327
0040d47658c6 check - warnings eliminated. Fix in InspectorList.st
Claus Gittinger <cg@exept.de>
parents: 38
diff changeset
   237
    |nm|
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   238
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   239
    (anIndex isNil or:[anIndex > instanceTypes size]) ifFalse:[
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   240
        nm := instanceNames at:anIndex.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   241
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   242
        (nm at:1) isDigit ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   243
            self includesSelf ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   244
                ^ inspectedObject instVarAt:anIndex
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   245
            ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   246
            anIndex == 1 ifFalse:[^ inspectedObject instVarAt:(anIndex-1)]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   247
                          ifTrue:[^ inspectedObject]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   248
        ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   249
      ^ inspectedObject basicAt:(Number readFrom:nm onError:0)
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   250
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   251
    ^ nil
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   252
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   253
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   254
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   255
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   256
!NewInspectorList methodsFor:'initialization'!
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   257
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   258
initialize
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   259
    "initialize instance attributes
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   260
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   261
    super initialize.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   262
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   263
    instanceNames := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   264
    instanceTypes := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   265
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   266
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   267
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   268
!NewInspectorList methodsFor:'private'!
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   269
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   270
resizeTo:aNumber
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   271
    "resize list to minimum aNumber
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   272
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   273
    |lstVarId basicSize newLastId obj instSize|
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   274
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   275
    (inspectedObject isVariable and:[self class isDirectory:inspectedObject]) ifFalse:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   276
        ^ self
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   277
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   278
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   279
    instanceTypes size == 0 ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   280
        lstVarId := 0
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   281
    ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   282
        instSize := inspectedObject class instSize.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   283
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   284
        instanceTypes first == #self ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   285
            instSize := instSize + 1
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   286
        ].
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   287
        instanceTypes last == #grow ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   288
            instanceNames removeLast.       " ..    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   289
            instanceTypes removeLast.       " #grow "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   290
        ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   291
        lstVarId := instanceTypes size - instSize.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   292
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   293
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   294
    (basicSize := inspectedObject basicSize) == lstVarId ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   295
        ^ self
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   296
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   297
    newLastId := (1 bitShift:((aNumber-1) highBit)) max:128.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   298
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   299
    (newLastId + 64) > basicSize ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   300
        newLastId := basicSize
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   301
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   302
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   303
    [lstVarId ~~ newLastId] whileTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   304
        lstVarId := lstVarId + 1.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   305
        obj := inspectedObject basicAt:lstVarId.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   306
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   307
        (self class isDirectory:obj) ifTrue:[instanceTypes add:#directory]
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   308
                                    ifFalse:[instanceTypes add:#normal].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   309
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   310
        instanceNames add:(lstVarId printString, '   ', obj class name printString).
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   311
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   312
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   313
    lstVarId ~~ basicSize ifTrue:[
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   314
        instanceNames add:'..'.
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   315
        instanceTypes add:#grow
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   316
    ].
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   317
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   318
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   319
!NewInspectorList methodsFor:'selections'!
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   320
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   321
selectedInstanceType
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   322
    "returns type assigned to the selected list entry (#directory #normal #self #grow).
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   323
     In case of no selection nil is returned.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   324
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   325
    ^ self instanceTypeAt:selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   326
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   327
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   328
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   329
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   330
selectedInstanceVar
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   331
    "returns current inspected instance variable or nil
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   332
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   333
    ^ self instanceVarAt:selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   334
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   335
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   336
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   337
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   338
selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   339
    "returns current selection number or nil
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   340
    "
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   341
    ^ selection
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   342
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   343
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   344
!
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   345
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   346
setSelection:aNrOrNil
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   347
    "change current selection to a number or nil; may resize the lists
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   348
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   349
    selection := aNrOrNil.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   350
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   351
    (selection isNil or:[instanceTypes size > selection]) ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   352
        self resizeTo:selection.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   353
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   354
        selection > instanceTypes size ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   355
            selection := nil
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   356
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   357
    ]    
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   358
! !
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   359
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   360
!NewInspectorList methodsFor:'testing'!
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   361
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   362
includesSelf
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   363
    "returns true if 'self' is included in the list
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   364
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   365
    ^ (instanceTypes notEmpty and:[instanceTypes first == #self])
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   366
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   367
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   368
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   369
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   370
isEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   371
    "returns true if the list is empty
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   372
    "
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   373
    ^ instanceNames isEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   374
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   375
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   376
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   377
notEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   378
    "returns true if the list is not empty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   379
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   380
    ^ instanceNames notEmpty
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   381
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   382
! !
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   383
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   384
!NewInspectorList methodsFor:'user interaction'!
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   385
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   386
accept:aText notifying:aView
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   387
    "evaluating aText on the selected instance var; if an error occurs #Error
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   388
     is returned otherwise the inspected object instance. On success the list
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   389
     will be updated.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   390
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   391
    |text slNr value|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   392
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   393
    selection notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   394
        text := self class asString:aText.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   395
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   396
        text notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   397
            self includesSelf ifFalse:[slNr := selection]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   398
                               ifTrue:[slNr := selection-1].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   399
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   400
            value := inspectedObject class evaluatorClass 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   401
                       evaluate:text
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   402
                       receiver:inspectedObject 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   403
                      notifying:aView.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   404
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   405
            slNr ~~ 0 ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   406
                (inspectedObject class isVariable) ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   407
                    inspectedObject instVarAt:slNr put:value
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   408
                ] ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   409
                    slNr <= (inspectedObject class instSize) ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   410
                        inspectedObject instVarAt:slNr put:value
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   411
                    ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   412
                        slNr := slNr - inspectedObject class instSize.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   413
                        inspectedObject basicAt:slNr put:value
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   414
                    ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   415
                ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   416
            ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   417
            inspectedObject changed.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   418
            self update.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   419
          ^ inspectedObject
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   420
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   421
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   422
    ^ #Error
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   423
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   424
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   425
doIt:aCode notifying:aView
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   426
    "evaluating aCode on the selected instance var; if an error occurs #Error
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   427
     is returned otherwise the result returned from the evaluator. On success
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   428
     the list will be updated.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   429
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   430
    |successFg result evaluator selInstVar code|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   431
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   432
    selInstVar := self selectedInstanceVar.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   433
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   434
    selInstVar notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   435
        code := self class asString:aCode.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   436
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   437
        code notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   438
            evaluator := selInstVar class evaluatorClass.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   439
            successFg := true.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   440
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   441
            evaluator notNil ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   442
                result := evaluator evaluate:code 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   443
                                          in:nil 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   444
                                    receiver:selInstVar 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   445
                                   notifying:aView 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   446
                                      logged:true 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   447
                                      ifFail:[successFg := false].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   448
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   449
                successFg ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   450
                    self update. 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   451
                  ^ result 
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   452
                ]
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   453
            ]
38
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
    ^ #Error.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   457
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   458
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   459
!
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   460
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   461
inspect:anObject
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   462
    "inspect a new instance; update contents
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   463
    "
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   464
    |varNamesSize|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   465
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   466
    selection := nil.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   467
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   468
    anObject == inspectedObject ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   469
        inspectedObject := anObject.
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   470
38
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   471
        (self class isDirectory:inspectedObject) ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   472
            instanceNames := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   473
            instanceTypes := OrderedCollection new.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   474
        ] ifTrue:[    
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   475
            instanceNames := inspectedObject class allInstVarNames.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   476
            varNamesSize  := instanceNames size.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   477
            instanceTypes := OrderedCollection new:varNamesSize.
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   478
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   479
            1 to:varNamesSize do:[:i|
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   480
                (self class isDirectory:(inspectedObject instVarAt:i)) ifTrue:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   481
                    instanceTypes add:#directory
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   482
                ] ifFalse:[
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   483
                    instanceTypes add:#normal
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   484
                ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   485
            ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   486
        ]
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   487
    ].
7b75ce74d9e1 checkin from browser
ca
parents: 33
diff changeset
   488
    self update
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   489
! !
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   490
1213
6cf7a4c2dfce *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1022
diff changeset
   491
!NewInspectorList class methodsFor:'documentation'!
33
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   492
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   493
version
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   494
    ^ '$Header$'
eeb1fd7f92aa intitial checkin
ca
parents:
diff changeset
   495
! !