extensions.st
changeset 19189 39d98e426492
parent 19187 24f98c6b1c90
child 19198 cdaab19788cd
--- a/extensions.st	Mon Sep 16 16:49:25 2019 +0200
+++ b/extensions.st	Mon Sep 16 17:30:11 2019 +0200
@@ -135,21 +135,23 @@
 
 !ArrayedCollection class methodsFor:'inspecting - helpers'!
 
-hexDumpViewFor:anInstance
+hexDumpViewFor:instOrHolder
     "a tab, showing a hex dump; defined here, so that both byteArrays and other bulk data
      containers can define it in their inspector2Tabs methods."
 
-    |wrapper myByteSize v genDump baseAddress|
-
-    myByteSize := anInstance size * anInstance class elementByteSize.
+    |getByteSize wrapper v genDump baseAddress|
+
+    getByteSize := [ instOrHolder value size * instOrHolder value class elementByteSize ].
 
     wrapper := Plug new.
-    wrapper respondTo:#size with:[ myByteSize ].
-    wrapper respondTo:#at: with:[:byteIdx | anInstance byteAt:byteIdx ].
-    wrapper respondTo:#do: with:[:aBlock | 1 to:myByteSize 
-                                            do:[:i |
-                                                aBlock value:(anInstance byteAt:i) 
-                                            ].
+    wrapper respondTo:#size with:[ getByteSize value ].
+    wrapper respondTo:#at: with:[:byteIdx | instOrHolder value byteAt:byteIdx ].
+    wrapper respondTo:#do: with:[:aBlock |
+                                    |sz|
+                                    sz := getByteSize value.
+                                    1 to:sz do:[:i |
+                                        aBlock value:(instOrHolder value byteAt:i) 
+                                    ].
                                 ].
 
     baseAddress := 0.
@@ -159,7 +161,7 @@
                     v topView withWaitCursorDo:[
                         dump := AbstractFileBrowser 
                             contentsOfBytesAsHexDump:wrapper 
-                            numberOfAddressDigits:(myByteSize hexPrintString size) 
+                            numberOfAddressDigits:(getByteSize value hexPrintString size) 
                             addressStart:baseAddress.
                         v list:dump expandTabs:false scanForNonStrings:false includesNonStrings:false.
                     ].
@@ -168,6 +170,7 @@
     v := HVScrollableView for:TextView. 
     v autoHideScrollBars:true.
     genDump value.
+    instOrHolder onChangeEvaluate:genDump.
 
     v scrolledView 
         menuHolder: