Stc cannot handle thisContext restart in true-Block.
authorStefan Vogel <sv@exept.de>
Sun, 11 May 2003 19:47:39 +0200
changeset 2757 b98097eaf8dc
parent 2756 2bdd7ceaf05c
child 2758 a91d29f612b5
Stc cannot handle thisContext restart in true-Block.
EditTextView.st
--- a/EditTextView.st	Sat May 10 13:54:38 2003 +0200
+++ b/EditTextView.st	Sun May 11 19:47:39 2003 +0200
@@ -4461,40 +4461,26 @@
     "insert contents of a file 
      - ask user for filename using a fileSelectionBox."
 
-    |fileBox file text|
-
-    file := Dialog 
-        requestFileName:(resources string:'Insert contents of:') 
-        default:nil
-        ok:(resources string:'Insert') 
-        abort:(resources string:'Cancel') 
-        pattern:nil
-        fromDirectory:directoryForFileDialog.
-    file size == 0 ifTrue:[^ self].
-
-"/    fileBox := FileSelectionBox
-"/                    title:(resources string:'Insert contents of:')
-"/                    okText:(resources string:'Insert')
-"/                    abortText:(resources string:'Cancel')
-"/                    action:[:fileName | file := fileName].
-"/
-"/    directoryForFileDialog notNil ifTrue:[
-"/        fileBox directory:directoryForFileDialog
-"/    ].
-"/    fileBox showAtPointer.
-"/    file size == 0 ifTrue:[^ self].
-"/
-"/    directoryForFileDialog := fileBox directory.  "/ remember for next time
-"/    fileBox destroy.
-
-    file asFilename isDirectory ifTrue:[
-        thisContext restart
-    ].
-
-    text := file asFilename contentsOfEntireFile.
+    |file text|
+
+    [
+        file := Dialog 
+            requestFileName:(resources string:'Insert contents of:') 
+            default:nil
+            ok:(resources string:'Insert') 
+            abort:(resources string:'Cancel') 
+            pattern:nil
+            fromDirectory:directoryForFileDialog.
+        file isNil ifTrue:[
+            "cancel"
+            ^ self.
+        ].
+        file := file asFilename.
+        directoryForFileDialog := file.
+    ] doUntil:[file isReadable and:[file isDirectory not]].
+
+    text := file contentsOfEntireFile.
     self paste:text.
-
-    "Modified: 16.4.1997 / 20:49:26 / cg"
 !
 
 paste
@@ -5478,5 +5464,5 @@
 !EditTextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.305 2003-05-10 11:54:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/EditTextView.st,v 1.306 2003-05-11 17:47:39 stefan Exp $'
 ! !