AbstractFileBrowser.st
changeset 8472 8673c279211b
parent 8462 a5d12742a900
child 8473 2dfb88ac0c12
--- a/AbstractFileBrowser.st	Wed Dec 03 22:13:48 2008 +0100
+++ b/AbstractFileBrowser.st	Wed Dec 03 22:14:02 2008 +0100
@@ -2225,8 +2225,12 @@
 !AbstractFileBrowser class methodsFor:'utilities'!
 
 contentsOfFileAsHexDump:f
+    ^ self contentsOfFileAsHexDump:f withLimit:nil lastPart:nil
+!
+
+contentsOfFileAsHexDump:f withLimit:limitOrNil lastPart:showLastPartOrNil
     |resources fileName stream data offs 
-     addrDigits col line lineStream asciiLineStream lines answer sizeLimit|
+     addrDigits col line lineStream asciiLineStream lines answer sizeLimit showLastPart|
 
     resources := self classResources.
 
@@ -2244,21 +2248,29 @@
         ^ nil
     ].
     f fileSize > (1024*1024) ifTrue:[
-        answer := Dialog 
-                        confirmWithCancel:(resources
-                                            stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' 
-                                            with:(fileName contractTo:40) allBold 
-                                            with:(UnitConverter fileSizeStringFor:f fileSize))
-                        labels:#('Cancel' 'Show All' 'Show First Part' ).
-
-        answer isNil ifTrue:[^ nil].
-        answer ifTrue:[
-            sizeLimit := 4 * 1024 * 1024
+        limitOrNil notNil ifTrue:[
+            sizeLimit := limitOrNil.
+            showLastPart := showLastPartOrNil
+        ] ifFalse:[
+            answer := Dialog 
+                            confirmWithCancel:(resources
+                                                stringWithCRs:'"%1" is very large (%2).\\Show all or only the first 4 Mb ?' 
+                                                with:(fileName contractTo:40) allBold 
+                                                with:(UnitConverter fileSizeStringFor:f fileSize))
+                            labels:#('Cancel' 'Show All' 'Show First Part' ).
+
+            answer isNil ifTrue:[^ nil].
+            answer ifTrue:[
+                sizeLimit := 4 * 1024 * 1024
+            ].
         ].
     ].
 
     stream := f readStream binary.
     sizeLimit notNil ifTrue:[
+        showLastPart == true ifTrue:[
+            stream position:(f fileSize - sizeLimit).
+        ].
         data := stream nextBytes:sizeLimit.
     ] ifFalse:[
         data := stream contents.
@@ -7528,5 +7540,5 @@
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.389 2008-11-29 18:27:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.390 2008-12-03 21:14:02 cg Exp $'
 ! !