InspectorView.st
changeset 18008 ed579d6c007e
parent 17985 e80c463e90f6
child 18014 9061616443d4
equal deleted inserted replaced
18007:b7ac416ae0ac 18008:ed579d6c007e
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1989 by Claus Gittinger
     4  COPYRIGHT (c) 1989 by Claus Gittinger
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
  2995 
  2997 
  2996     someValue == NoLongerPresentDummyObject ifTrue:[
  2998     someValue == NoLongerPresentDummyObject ifTrue:[
  2997         "/ this is returned by collection-inspectors,
  2999         "/ this is returned by collection-inspectors,
  2998         "/ when a field-index for a no-longer-present-index is selected
  3000         "/ when a field-index for a no-longer-present-index is selected
  2999         "/ (eg. if an OrderedCollection growed to a smaller size in the meantime)
  3001         "/ (eg. if an OrderedCollection growed to a smaller size in the meantime)
  3000         ^ '«element no longer present»' withColor:Color grey.
  3002         ^ '«element no longer present»' withColor:Color grey.
  3001     ].
  3003     ].
  3002 
  3004 
  3003     idx := self theSingleSelectionIndex.
  3005     idx := self theSingleSelectionIndex.
  3004     idx notNil ifTrue:[
  3006     idx notNil ifTrue:[
  3005         sel := self listEntryAt:idx.
  3007         sel := self listEntryAt:idx.
  3294     |d actionItems valueItems otherItems|
  3296     |d actionItems valueItems otherItems|
  3295 
  3297 
  3296     d := self derivedFields.
  3298     d := self derivedFields.
  3297     (d isDictionary) ifTrue:[
  3299     (d isDictionary) ifTrue:[
  3298         actionItems := d keys select:[:k | k first == $!!] as:OrderedCollection .
  3300         actionItems := d keys select:[:k | k first == $!!] as:OrderedCollection .
  3299         valueItems := d keys select:[:k | '-¤' includes:k first] as:OrderedCollection.
  3301         valueItems := d keys select:[:k | '-¤' includes:k first] as:OrderedCollection.
  3300         otherItems := d keys select:[:k | ('!!-¤' includes: k first) not] as:OrderedCollection.
  3302         otherItems := d keys select:[:k | ('!!-¤' includes: k first) not] as:OrderedCollection.
  3301         ^ ((actionItems sort , valueItems sort) collect:[:k | (k copyTo:1),(k copyFrom:2) allItalic])
  3303         ^ ((actionItems sort , valueItems sort) collect:[:k | (k copyTo:1),(k copyFrom:2) allItalic])
  3302           ,
  3304           ,
  3303           otherItems sort
  3305           otherItems sort
  3304     ].
  3306     ].
  3305     ^ d collect:[:eachEntry |
  3307     ^ d collect:[:eachEntry |
  3332 
  3334 
  3333     "Modified: / 03-08-2006 / 15:17:19 / cg"
  3335     "Modified: / 03-08-2006 / 15:17:19 / cg"
  3334 !
  3336 !
  3335 
  3337 
  3336 extraNamedFields
  3338 extraNamedFields
  3337     "by redefining inspectorExtraNamedFields to return an array of
  3339     "another extension mechanism (only used in some java packages):
  3338      pseudo-fieldName->value associations, the inspectors left list can be extended"
  3340      by redefining inspectorExtraNamedFields in an object to return an array of
  3339 
  3341      pseudo-fieldName->value associations, the inspector's left list can be extended"
  3340     "the check below is not sufficient - if someone catches messages, for example.
  3342 
  3341      Therefore, we do a manual lookup here:"
  3343     "the MessageNotUnderstood check below is not sufficient 
  3342 
  3344      - if some proxy (javaBridge) catches and forwards messages for example,
       
  3345        this makes problems. Therefore, we do an extra check here:"
  3343     (object class whichClassIncludesSelector:#inspectorExtraNamedFields) isNil ifTrue:[
  3346     (object class whichClassIncludesSelector:#inspectorExtraNamedFields) isNil ifTrue:[
  3344         ^ #()
  3347         ^ #()
  3345     ].
  3348     ].
  3346     ^ [object inspectorExtraNamedFields]
  3349     ^ [object inspectorExtraNamedFields]
  3347                 on: MessageNotUnderstood
  3350             on: MessageNotUnderstood
  3348                 do: [:ex | ex return: #() ]
  3351             do: [:ex | ex return: #() ]
  3349 
  3352 
  3350     "Created: / 03-08-2006 / 13:34:18 / cg"
  3353     "Created: / 03-08-2006 / 13:34:18 / cg"
  3351     "Modified: / 29-08-2006 / 13:03:57 / cg"
  3354     "Modified: / 29-08-2006 / 13:03:57 / cg"
  3352 !
  3355 !
  3353 
  3356 
  3424             self hasSelfEntry ifTrue:[
  3427             self hasSelfEntry ifTrue:[
  3425                 self suppressPseudoSlots ifFalse:[
  3428                 self suppressPseudoSlots ifFalse:[
  3426                     derivedFieldList := OrderedCollection new.
  3429                     derivedFieldList := OrderedCollection new.
  3427                     derivedFieldList addAll:(self pseudoFieldNamesWithIndexed:(indexedList notEmptyOrNil)).
  3430                     derivedFieldList addAll:(self pseudoFieldNamesWithIndexed:(indexedList notEmptyOrNil)).
  3428                     derivedFieldList addAll:(self derivedFieldNames).
  3431                     derivedFieldList addAll:(self derivedFieldNames).
       
  3432                     derivedFieldList addAll:(self objectAttributeKeyNames).
  3429                     extraNamedFieldList addAll:(self extraNamedFieldNames).
  3433                     extraNamedFieldList addAll:(self extraNamedFieldNames).
  3430                 ].
  3434                 ].
  3431             ].
  3435             ].
  3432 
  3436 
  3433             fieldList := OrderedCollection new.
  3437             fieldList := OrderedCollection new.
  3659 
  3663 
  3660     "Created: / 16-05-2012 / 17:53:39 / cg"
  3664     "Created: / 16-05-2012 / 17:53:39 / cg"
  3661 !
  3665 !
  3662 
  3666 
  3663 myObjectsInspectorExtraAttributes
  3667 myObjectsInspectorExtraAttributes
  3664 
  3668     "by redefining inspectorExtraAttributes in an object to return an array of
  3665     "the MessageNotUnderstood check below is not sufficient - if some proxy catches messages, for example.
  3669      pseudo-fieldName->value associations, the inspector's left list can be extended"
  3666      Therefore, we do a manual lookup here:"
  3670 
       
  3671     "the MessageNotUnderstood check below is not sufficient 
       
  3672      - if some proxy (javaBridge) catches and forwards messages for example,
       
  3673        this makes problems. Therefore, we do an extra check here:"
  3667     (object class canUnderstand:#inspectorExtraAttributes) ifFalse:[
  3674     (object class canUnderstand:#inspectorExtraAttributes) ifFalse:[
  3668         ^ #()
  3675         ^ #()
  3669     ].
  3676     ].
  3670     ^ [object inspectorExtraAttributes]
  3677     ^ [object inspectorExtraAttributes]
  3671                 on: MessageNotUnderstood
  3678                 on: MessageNotUnderstood
  3721 
  3728 
  3722 numIndexedFields
  3729 numIndexedFields
  3723     ^ inspectedObject basicSize
  3730     ^ inspectedObject basicSize
  3724 
  3731 
  3725     "Created: / 13-06-2012 / 10:13:24 / cg"
  3732     "Created: / 13-06-2012 / 10:13:24 / cg"
       
  3733 !
       
  3734 
       
  3735 objectAttributeKeyNames
       
  3736     |attrs|
       
  3737 
       
  3738     (attrs := object objectAttributes) notEmptyOrNil ifTrue:[
       
  3739         ^ attrs keys collect:[:key | ('+' , key) allItalic ].
       
  3740     ].
       
  3741     ^ #()
  3726 !
  3742 !
  3727 
  3743 
  3728 pseudoFieldNames
  3744 pseudoFieldNames
  3729     "return a list of names to show in the selectionList.
  3745     "return a list of names to show in the selectionList.
  3730      Leave hasMore as true, if a '...' entry should be added."
  3746      Leave hasMore as true, if a '...' entry should be added."
  3912           and:[(lineEntry at:2) isDigit not "negative number"]]
  3928           and:[(lineEntry at:2) isDigit not "negative number"]]
  3913         ) ifTrue:[
  3929         ) ifTrue:[
  3914             ^ self valueForSpecialLine:lineEntry
  3930             ^ self valueForSpecialLine:lineEntry
  3915         ].
  3931         ].
  3916     ].
  3932     ].
       
  3933     "/ an object attribute?
       
  3934     (lineEntry startsWith:$+) ifTrue:[
       
  3935         (object objectAttributes includesKey:(lineEntry copyFrom:2) asSymbol) ifTrue:[
       
  3936             ^ object objectAttributeAt:(lineEntry copyFrom:2) asSymbol
       
  3937         ]
       
  3938     ].
       
  3939 
  3917     "/ another special (pseudo) entries?
  3940     "/ another special (pseudo) entries?
  3918     (lineEntry startsWith:$¤) ifTrue:[
  3941     (lineEntry startsWith:$¤) ifTrue:[
  3919         ^ self valueForSpecialLine:lineEntry
  3942         ^ self valueForSpecialLine:lineEntry
  3920     ].
  3943     ].
  3921 
  3944 
  3922     "/ a named instVar ?
  3945     "/ a named instVar ?
  3923     idx := self instVarIndexForLine:lineNr.
  3946     idx := self instVarIndexForLine:lineNr.
  4318     "Created: 28.6.1996 / 15:06:38 / cg"
  4341     "Created: 28.6.1996 / 15:06:38 / cg"
  4319     "Modified: 18.3.1997 / 18:22:54 / cg"
  4342     "Modified: 18.3.1997 / 18:22:54 / cg"
  4320 !
  4343 !
  4321 
  4344 
  4322 tryToSelectKeyNamed:aString
  4345 tryToSelectKeyNamed:aString
  4323     "called from the debugger to try to select the previousöy selected
  4346     "called from the debugger to try to select the previousöy selected
  4324      field (by name)"
  4347      field (by name)"
  4325      
  4348      
  4326     |list idx aStringWithSpace|
  4349     |list idx aStringWithSpace|
  4327 
  4350 
  4328     aString isEmptyOrNil ifTrue:[^ self].
  4351     aString isEmptyOrNil ifTrue:[^ self].