InspectorView.st
branchjv
changeset 12262 d25ef6bb0ef3
parent 12258 c25935799d7b
child 12265 f1b3696cf042
--- a/InspectorView.st	Wed Jul 18 10:57:46 2012 +0100
+++ b/InspectorView.st	Wed Jul 18 18:00:57 2012 +0100
@@ -1232,7 +1232,12 @@
         items := items , #(
                         ('-')
                         ('Show More'                    #showMore               )
+                          ).
+        (self numIndexedFields > (nShown * 2)) ifTrue:[
+            items := items , #(
+                        ('Show All'                     #showAll                )
                           )
+        ].
     ].
 
     protocols := Dictionary new.
@@ -1336,7 +1341,7 @@
 
     ^ m
 
-    "Modified: / 27-01-2011 / 12:08:54 / cg"
+    "Modified: / 13-06-2012 / 10:13:39 / cg"
 !
 
 numberBaseItems
@@ -1793,6 +1798,20 @@
     "Modified: / 25-01-2011 / 17:23:38 / cg"
 !
 
+showAll
+    |o|
+
+    hasMore ifTrue:[
+        nShown := self numIndexedFields.
+        "/ force update (which is otherwise ignored)
+        o := object.
+        inspectedObject := object := nil.
+        self inspect:o
+    ]
+
+    "Created: / 13-06-2012 / 09:27:45 / cg"
+!
+
 showInWindowsExplorer
     "show in explorer"
 
@@ -1814,6 +1833,20 @@
     "Created: / 05-02-2011 / 15:49:33 / cg"
 !
 
+showMore
+    |o|
+
+    hasMore ifTrue:[
+        nShown := nShown * 2.
+        "/ force update (which is otherwise ignored)
+        o := object.
+        inspectedObject := object := nil.
+        self inspect:o
+    ]
+
+    "Modified: / 26.8.1998 / 19:05:25 / cg"
+!
+
 showOwners
     |o|
 
@@ -1942,7 +1975,7 @@
         ^ s contents
     ].
 
-    "Modified: / 17-02-2012 / 20:48:45 / cg"
+    "Modified: / 17-07-2012 / 13:22:27 / cg"
 !
 
 displayStringForValue:someValue
@@ -2031,36 +2064,16 @@
 !
 
 listEntryForName:nameString value:value
-    |valString plainString|
+    |entryString|
 
     UserPreferences current showTypeIndicatorInInspector ifFalse:[
         ^ nameString
     ].
 
-    value isNumber ifTrue:[
-        valString := value printString
-    ] ifFalse:[
-        (value isSymbol or:[value isCharacter]) ifTrue:[
-            valString := value storeString
-        ] ifFalse:[
-            value isString ifTrue:[
-                valString := value contractTo:30.
-            ] ifFalse:[
-                value isColor ifTrue:[
-                    valString := value htmlPrintString
-                ].
-            ].
-        ]
-    ].
-
-    valString notNil ifTrue:[
-        plainString := (nameString allBold,' <',valString,'>').
-    ] ifFalse:[
-        plainString := nameString allBold
-    ].
+    entryString := nameString allBold,(self valueStringInListEntryForValue:value).
 
     value isColor ifTrue:[
-        plainString := plainString
+        entryString := entryString
                      , '  ' , ('   '
                         colorizeAllWith:((value brightness < 0.5)
                                 ifTrue:[ Color white ]
@@ -2068,11 +2081,49 @@
                         on:value).
     ].
 
-    ^ LabelAndIcon string:plainString image:(self iconForValue:value)
+    ^ LabelAndIcon string:entryString image:(self iconForValue:value)
 
     "Created: / 16-05-2012 / 18:42:28 / cg"
 !
 
+plainValueStringInListEntryForValue:value
+    "returns nil or a string to show in angle brackets"
+
+    |s|
+
+    UserPreferences current showTypeIndicatorInInspector ifFalse:[^ nil].
+
+    value class == ValueHolder ifTrue:[
+        s := self plainValueStringInListEntryForValue:value value.
+        s notNil ifTrue:[
+            ^ '[[' , s , ']]'
+        ].
+        ^ nil
+    ].
+
+    (value isNumber or:[value isBoolean]) ifTrue:[
+        ^ value printString
+    ].
+    (value isSymbol or:[value isCharacter]) ifTrue:[
+        ^ value storeString
+    ].
+    value isString ifTrue:[
+        ^ value contractTo:30.
+    ].
+    value isColor ifTrue:[
+        ^ value htmlPrintString
+    ].
+    value isNil ifTrue:[
+        ^ 'nil'
+    ].
+    (value isClass and:[value name notEmptyOrNil]) ifTrue:[
+        ^ value name
+    ].
+    ^ value classNameWithArticle "nil"
+
+    "Created: / 13-06-2012 / 12:50:26 / cg"
+!
+
 stringWithAllIndexedVarValues
     |nIdx s names maxLen varString padLeft|
 
@@ -2176,6 +2227,18 @@
         s cr.
     ].
     ^ s contents
+!
+
+valueStringInListEntryForValue:value
+    "returns something to append to the name"
+
+    |valString|
+
+    valString := self plainValueStringInListEntryForValue:value.
+    valString isNil ifTrue:[^ ''].
+    ^ ' <',valString,'>'
+
+    "Created: / 13-06-2012 / 12:04:31 / cg"
 ! !
 
 !InspectorView methodsFor:'private'!
@@ -2368,7 +2431,7 @@
 
     cls isVariable ifFalse:[^ nil ].
 
-    n := objSz := object basicSize.
+    n := objSz := self numIndexedFields.
     (n > nShown) ifTrue:[
         n := nShown.
         hasMore := true.
@@ -2379,7 +2442,7 @@
 "/            LabelAndIcon string:nm image:(self iconForValue:(object basicAt:idx))
 "/        ].
 
-    "Modified: / 16-05-2012 / 18:34:35 / cg"
+    "Modified: / 13-06-2012 / 10:14:13 / cg"
 !
 
 indexOfFirstNamedInstvarInList
@@ -2591,34 +2654,19 @@
     "Modified: / 16-05-2012 / 18:43:23 / cg"
 !
 
+numIndexedFields
+    ^ inspectedObject basicSize
+
+    "Created: / 13-06-2012 / 10:13:24 / cg"
+!
+
 pseudoFieldNames
     "return a list of names to show in the selectionList.
      Leave hasMore as true, if a '...' entry should be added."
 
-    |list cls|
-
-    cls := object class.
-
-    list := OrderedCollection new.
-    list add:'-' , 'self' allItalic.
-    list add:'-' , 'local messages' allItalic.
-    "/ list add:'-' , 'inherited messages' allItalic.
-    list add:'-' , 'all messages' allItalic.
-    list add:'-' , 'hash' allItalic.
-    list add:'-' , 'identityHash' allItalic.
-
-    cls hasImmediateInstances ifFalse:[
-        object dependents notEmptyOrNil ifTrue:[
-            list add:'-' , 'dependents' allItalic.
-        ].
-    ].
-    cls instSize > 0 ifTrue:[
-        list add:'-' , 'all inst vars' allItalic.
-    ].
-    ((cls isVariable) and:[self showAllIndexedVarsInFieldList]) ifTrue:[
-        list add:'-' , 'all indexed vars' allItalic.
-    ].
-    ^ list
+    ^ self pseudoFieldNamesWithIndexed: object class isVariable
+
+    "Modified: / 06-06-2012 / 11:56:56 / cg"
 !
 
 pseudoFieldNamesWithIndexed:withIndexed
@@ -2637,6 +2685,15 @@
     list add:'-' , 'hash' allItalic.
     list add:'-' , 'identityHash' allItalic.
 
+    withIndexed ifTrue:[
+        list add:'-' , 'basicSize' allItalic, (self valueStringInListEntryForValue:object basicSize).
+    ].
+    object isCollection ifTrue:[
+        (cls whichClassImplements:#size) == (cls whichClassImplements:#basicSize) ifFalse:[
+            list add:'-' , 'size' allItalic , (self valueStringInListEntryForValue:object size).
+        ]
+    ].
+
     cls hasImmediateInstances ifFalse:[
         object dependents notEmptyOrNil ifTrue:[
             list add:'-' , 'dependents' allItalic.
@@ -2649,6 +2706,8 @@
         list add:'-' , 'all indexed vars' allItalic.
     ].
     ^ list
+
+    "Modified: / 13-06-2012 / 12:10:16 / cg"
 !
 
 setAcceptAction
@@ -2673,6 +2732,12 @@
         (sel startsWith:'-hash') ifTrue:[
             acceptAction := nil.
         ].
+        (sel startsWith:'-basicSize') ifTrue:[
+            acceptAction := nil.
+        ].
+        (sel startsWith:'-size') ifTrue:[
+            acceptAction := nil.
+        ].
         (sel startsWith:'-identityHash') ifTrue:[
             acceptAction := nil.
         ].
@@ -2686,7 +2751,7 @@
 
     workspace acceptAction:acceptAction.
 
-    "Modified: / 16-05-2012 / 17:54:16 / cg"
+    "Modified: / 06-06-2012 / 11:57:27 / cg"
 !
 
 setDoItAction
@@ -2722,20 +2787,6 @@
     ^ true
 !
 
-showMore
-    |o|
-
-    hasMore ifTrue:[
-        nShown := nShown * 2.
-        "/ force update (which is otherwise ignored)
-        o := object.
-        inspectedObject := object := nil.
-        self inspect:o
-    ]
-
-    "Modified: / 26.8.1998 / 19:05:25 / cg"
-!
-
 theSingleSelectionIndex
     "helper - return the index of the (single) selected entry.
      Nil if nothing or multiple items are selected"
@@ -2851,6 +2902,9 @@
     (line startsWith:'-self') ifTrue:[
         ^ object
     ].
+    (line startsWith:'-basicSize') ifTrue:[
+        ^ object basicSize
+    ].
     (line startsWith:'-size') ifTrue:[
         ^ object size
     ].
@@ -2879,7 +2933,7 @@
     self error:'unknown special line'.
 
     "Created: / 31-10-2001 / 09:17:45 / cg"
-    "Modified: / 13-03-2012 / 08:25:52 / cg"
+    "Modified: / 06-06-2012 / 11:57:54 / cg"
 ! !
 
 !InspectorView methodsFor:'queries'!
@@ -3170,16 +3224,20 @@
 !
 
 tryToSelectKeyNamed:aString
-    |list idx|
+    |list idx aStringWithSpace|
+
+    aString isEmptyOrNil ifTrue:[^ self].
+
+    aStringWithSpace := aString string,' '.
 
     list := listView list.
     list notNil ifTrue:[
-        (idx := list indexOf:aString) ~= 0 ifTrue:[
+        (idx := list findFirst:[:line | line = aString or:[line string startsWith:aStringWithSpace]]) ~= 0 ifTrue:[
             listView selection:idx
         ].
     ].
 
-    "Created: / 16.11.2001 / 13:48:51 / cg"
+    "Created: / 16-11-2001 / 13:48:51 / cg"
 ! !
 
 !InspectorView methodsFor:'workspace protocol'!
@@ -3195,13 +3253,13 @@
 !InspectorView class methodsFor:'documentation'!
 
 version
-    ^ '$Id: InspectorView.st 8012 2012-07-06 11:44:18Z vranyj1 $'
+    ^ '$Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.266 2012/07/18 15:17:31 cg Exp $'
 !
 
 version_CVS
-    ^ '§Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.257 2012/06/04 16:17:33 cg Exp §'
+    ^ '§Header: /cvs/stx/stx/libtool/InspectorView.st,v 1.266 2012/07/18 15:17:31 cg Exp §'
 !
 
 version_SVN
-    ^ '$Id: InspectorView.st 8012 2012-07-06 11:44:18Z vranyj1 $'
+    ^ '$Id: InspectorView.st 8018 2012-07-18 17:00:57Z vranyj1 $'
 ! !