Do not pop up dialogs on PackageRedefinitions when doing a fileIn
authorStefan Vogel <sv@exept.de>
Mon, 25 Apr 2005 16:33:08 +0200
changeset 6281 e8e47b1b290f
parent 6280 c2e6d159d842
child 6282 3dd6584ffe92
Do not pop up dialogs on PackageRedefinitions when doing a fileIn (for Methods and Classes). These Notifications should be and are handled by the GUI-Applications (Filebrowsers).
AbstractFileBrowser.st
--- a/AbstractFileBrowser.st	Mon Apr 25 12:07:17 2005 +0200
+++ b/AbstractFileBrowser.st	Mon Apr 25 16:33:08 2005 +0200
@@ -5447,9 +5447,13 @@
 singleFileFileIn:fileName lazy:lazy
     "fileIn the selected file(s)"
 
-    |aStream wasLazy notifyString|
-
-    fileName type == #regular ifTrue:[
+    |aStream wasLazy notifyString dontAskSignals|
+
+    fileName isRegularFile ifFalse:[
+        ^ self.
+    ].
+
+    [
         (ObjectFileLoader notNil
          and:[ObjectFileLoader hasValidBinaryExtension:fileName]) ifTrue:[
             AbortOperationRequest catch:[
@@ -5525,7 +5529,87 @@
                 ]
             ]]]]
         ]]
-    ].
+    ] on:Error, HaltInterrupt, Class packageRedefinitionNotification do:[:ex| 
+        |sig msg label labels values action proceedValue isRedef|
+
+        isRedef := false.
+        sig := ex signal.
+        (sig == NoHandlerError and:[ex parameter rejected]) ifTrue:[
+            ex reject
+        ].
+        sig == Class methodRedefinitionNotification ifTrue:[
+            msg := 'trying to overwrite method:\\    ' , ex oldMethod whoString , '\\in package ''' 
+                   , ex oldPackage , ''' with method from package ''' , ex newPackage , ''''.
+            label := 'Method redefinition in fileIn'.
+            isRedef := true.
+        ] ifFalse:[sig == Class classRedefinitionNotification ifTrue:[
+            msg := 'trying to redefine class: ' , ex oldClass name allBold , '\\in package ''' 
+                   , ex oldPackage , ''' with new definition from package ''' , ex newPackage , ''''.
+            label := 'Class redefinition in fileIn'.
+            isRedef := true.
+        ] ifFalse:[sig == HaltInterrupt ifTrue:[ |sender|
+            label := 'Breakpoint/Halt in fileIn'.
+            sender := ex suspendedContext.
+            msg := msg , '\\in ' , sender receiver class name , '>>' , sender selector
+        ] ifFalse:[
+            label := 'Error in fileIn'.
+            msg := 'error in fileIn: %1'
+        ]]].
+
+        msg := msg bindWith:ex description.
+
+        isRedef ifTrue:[
+              labels := #('Cancel' 'Skip' 'Debug' 'Continue' 'ContinueForAll').
+              values := #(abort     skip  debug   continue   continueForAll).
+        ] ifFalse:[
+              labels := #('Cancel' 'Skip' 'Debug' 'Continue').
+              values := #(abort    skip   debug   continue).
+        ].
+
+        AbortAllOperationRequest isHandled ifTrue:[
+              labels := #('Cancel All') , labels.
+              values := #(cancelAll) , values.
+        ].
+
+        action := OptionBox 
+                      request:(msg withCRs) 
+                      label:label
+                      image:(WarningBox iconBitmap)
+                      buttonLabels:labels
+                      values:values
+                      default:#continue
+                      onCancel:#abort.
+
+        action == #continueForAll ifTrue:[
+            dontAskSignals isNil ifTrue:[
+                dontAskSignals := IdentityDictionary new.
+            ].
+            dontAskSignals at:sig put:#continue.
+            action := #continue.
+        ].
+
+        action == #continue ifTrue:[
+            ex proceedWith:(isRedef ifTrue:[#keep] ifFalse:[#continue]).
+        ].
+        action == #abort ifTrue:[
+            AbortOperationRequest raise.
+            ex return
+        ].
+        action == #cancelAll ifTrue:[
+            AbortAllOperationRequest raise.
+            ex return
+        ].
+        action == #skip ifTrue:[
+            ex proceedWith:nil
+        ].
+        action == #debug ifTrue:[
+            Debugger enter:ex suspendedContext 
+                     withMessage:ex description 
+                     mayProceed:true.
+            ex proceedWith:nil.
+        ].
+        ex reject
+    ]
 !
 
 splitFile:infile intoPiecesOfSize:kiloBytes
@@ -6609,5 +6693,5 @@
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.288 2005-04-20 09:25:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.289 2005-04-25 14:33:08 stefan Exp $'
 ! !