package redefinition handling fixed
authorClaus Gittinger <cg@exept.de>
Thu, 26 Aug 1999 13:53:26 +0200
changeset 4639 a139399c5f4f
parent 4638 c0984e7647a7
child 4640 034c028a5463
package redefinition handling fixed
PosStream.st
PositionableStream.st
--- a/PosStream.st	Thu Aug 26 13:51:19 1999 +0200
+++ b/PosStream.st	Thu Aug 26 13:53:26 1999 +0200
@@ -519,7 +519,7 @@
      changeDefaultApplicationNotificationSignal
      defaultApplicationQuerySignal defaultApplication
      confirmationQuerySignal handledSignals
-     dontAskSignals|
+     dontAskSignals asSomeoneForPackage redef|
 
     "/ support for V'Age applications
     defaultApplicationQuerySignal := Class defaultApplicationQuerySignal.
@@ -532,8 +532,10 @@
 
     (someone respondsTo:#packageToInstall) ifFalse:[
         pkg := packageQuerySignal query.
+        asSomeoneForPackage := false.
     ] ifTrue:[
-        pkg := someone packageToInstall
+        pkg := someone packageToInstall.
+        asSomeoneForPackage := true.
     ].
     (someone respondsTo:#currentNameSpace) ifFalse:[
         spc := nameSpaceQuerySignal query.
@@ -582,7 +584,11 @@
         ].
         sig == packageQuerySignal ifTrue:[
             "/ query for the package to use for classes & methods
-            ex proceedWith:pkg
+            asSomeoneForPackage ifTrue:[
+                ex proceedWith:someone packageToInstall
+            ] ifFalse:[
+                ex proceedWith:pkg
+            ]
         ].
         sig == usedNameSpaceQuerySignal ifTrue:[
             "/ query for the namespaces searched when encountering globals
@@ -606,7 +612,12 @@
             ].
         ].
 
+        (dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[
+            ex proceedWith:(dontAskSignals at:sig)
+        ].
+
         canContinueForAll := false.
+        redef := false.
 
         "/ for your convenience ...
         (sig == Class methodRedefinitionSignal) ifTrue:[
@@ -615,26 +626,22 @@
             newPackage := param value package.
             msg := 'trying to overwrite method:\\    %1\\in package ''' 
                    , oldPackage , ''' with method from package ''' , newPackage , ''''.
-            proceedValue := #keep.
             canContinueForAll := true.
         ] ifFalse:[
             (sig == Class classRedefinitionSignal) ifTrue:[
                 param := ex parameter. "/ an association: oldClass -> newClass
+                
                 oldPackage := param key package.
                 newPackage := param value package.
-                msg := 'trying to redefine class:\\    %1\\in package ''' 
+                msg := 'trying to redefine class: ' , param key name asText allBold , '\\in package ''' 
                        , oldPackage , ''' with new definition from package ''' , newPackage , ''''.
-                proceedValue := #keep.
                 canContinueForAll := true.
+                redef := true.
             ] ifFalse:[
                 msg := 'error in fileIn: %1'
             ]
         ].
 
-        (dontAskSignals notNil and:[dontAskSignals includes:sig]) ifTrue:[
-            ex proceedWith:proceedValue
-        ].
-
         what := ex errorString.
         what isNil ifTrue:[
             what := ex signal notifierString.
@@ -660,18 +667,41 @@
 
         "/ otherwise ask what should be done now and either
         "/ continue or abort the fileIn
-
-        action := self askForDebug:msg withCRs canContinueForAll:canContinueForAll.
+        redef ifTrue:[
+            action := OptionBox 
+                          request:(msg withCRs) 
+                          label:'Class redefinition in fileIn'
+                          form:(WarningBox iconBitmap)
+                          buttonLabels:#('cancel' 'skip' 'debug' 'keep' 'keep all' 'continue' 'continue all')
+                          values:#(#abort #skip #debug #keep #keepAll #continue #continueForAll)
+                          default:#continue.
+        ] ifFalse:[
+            action := self askForDebug:msg withCRs canContinueForAll:canContinueForAll.
+        ].
         action == #continueForAll ifTrue:[
             dontAskSignals isNil ifTrue:[
-                dontAskSignals := OrderedCollection new.
+                dontAskSignals := IdentityDictionary new.
             ].
-            dontAskSignals add:sig.
-            action == #continue
+            dontAskSignals at:sig put:#continue.
+            action = proceedValue = #continue.
+        ] ifFalse:[
+            action == #keepForAll ifTrue:[
+                dontAskSignals isNil ifTrue:[
+                    dontAskSignals := IdentityDictionary new.
+                ].
+                dontAskSignals at:sig put:#keep.
+                action := #continue.
+                proceedValue := #keep.
+            ] ifFalse:[
+                action == #keep ifTrue:[
+                    action := #continue.
+                    proceedValue := #keep.
+                ].
+            ].
         ].
 
         action == #continue ifTrue:[
-            ex proceedWith:proceedValue
+            ex proceedWith:(proceedValue ? #continue)
         ].
         action == #abort ifTrue:[
             AbortSignal raise.
@@ -680,6 +710,10 @@
         action == #skip ifTrue:[
             ex proceedWith:nil
         ].
+        action == #debug ifTrue:[
+            Debugger enter:ex suspendedContext withMessage:ex errorString.
+            ex proceedWith:proceedValue
+        ].
 
         "/ (ex signal) enterDebuggerWith:ex message:what.
         ex reject
@@ -977,6 +1011,6 @@
 !PositionableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.79 1999-08-04 19:36:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/PosStream.st,v 1.80 1999-08-26 11:53:26 cg Exp $'
 ! !
 PositionableStream initialize!
--- a/PositionableStream.st	Thu Aug 26 13:51:19 1999 +0200
+++ b/PositionableStream.st	Thu Aug 26 13:53:26 1999 +0200
@@ -519,7 +519,7 @@
      changeDefaultApplicationNotificationSignal
      defaultApplicationQuerySignal defaultApplication
      confirmationQuerySignal handledSignals
-     dontAskSignals|
+     dontAskSignals asSomeoneForPackage redef|
 
     "/ support for V'Age applications
     defaultApplicationQuerySignal := Class defaultApplicationQuerySignal.
@@ -532,8 +532,10 @@
 
     (someone respondsTo:#packageToInstall) ifFalse:[
         pkg := packageQuerySignal query.
+        asSomeoneForPackage := false.
     ] ifTrue:[
-        pkg := someone packageToInstall
+        pkg := someone packageToInstall.
+        asSomeoneForPackage := true.
     ].
     (someone respondsTo:#currentNameSpace) ifFalse:[
         spc := nameSpaceQuerySignal query.
@@ -582,7 +584,11 @@
         ].
         sig == packageQuerySignal ifTrue:[
             "/ query for the package to use for classes & methods
-            ex proceedWith:pkg
+            asSomeoneForPackage ifTrue:[
+                ex proceedWith:someone packageToInstall
+            ] ifFalse:[
+                ex proceedWith:pkg
+            ]
         ].
         sig == usedNameSpaceQuerySignal ifTrue:[
             "/ query for the namespaces searched when encountering globals
@@ -606,7 +612,12 @@
             ].
         ].
 
+        (dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[
+            ex proceedWith:(dontAskSignals at:sig)
+        ].
+
         canContinueForAll := false.
+        redef := false.
 
         "/ for your convenience ...
         (sig == Class methodRedefinitionSignal) ifTrue:[
@@ -615,26 +626,22 @@
             newPackage := param value package.
             msg := 'trying to overwrite method:\\    %1\\in package ''' 
                    , oldPackage , ''' with method from package ''' , newPackage , ''''.
-            proceedValue := #keep.
             canContinueForAll := true.
         ] ifFalse:[
             (sig == Class classRedefinitionSignal) ifTrue:[
                 param := ex parameter. "/ an association: oldClass -> newClass
+                
                 oldPackage := param key package.
                 newPackage := param value package.
-                msg := 'trying to redefine class:\\    %1\\in package ''' 
+                msg := 'trying to redefine class: ' , param key name asText allBold , '\\in package ''' 
                        , oldPackage , ''' with new definition from package ''' , newPackage , ''''.
-                proceedValue := #keep.
                 canContinueForAll := true.
+                redef := true.
             ] ifFalse:[
                 msg := 'error in fileIn: %1'
             ]
         ].
 
-        (dontAskSignals notNil and:[dontAskSignals includes:sig]) ifTrue:[
-            ex proceedWith:proceedValue
-        ].
-
         what := ex errorString.
         what isNil ifTrue:[
             what := ex signal notifierString.
@@ -660,18 +667,41 @@
 
         "/ otherwise ask what should be done now and either
         "/ continue or abort the fileIn
-
-        action := self askForDebug:msg withCRs canContinueForAll:canContinueForAll.
+        redef ifTrue:[
+            action := OptionBox 
+                          request:(msg withCRs) 
+                          label:'Class redefinition in fileIn'
+                          form:(WarningBox iconBitmap)
+                          buttonLabels:#('cancel' 'skip' 'debug' 'keep' 'keep all' 'continue' 'continue all')
+                          values:#(#abort #skip #debug #keep #keepAll #continue #continueForAll)
+                          default:#continue.
+        ] ifFalse:[
+            action := self askForDebug:msg withCRs canContinueForAll:canContinueForAll.
+        ].
         action == #continueForAll ifTrue:[
             dontAskSignals isNil ifTrue:[
-                dontAskSignals := OrderedCollection new.
+                dontAskSignals := IdentityDictionary new.
             ].
-            dontAskSignals add:sig.
-            action == #continue
+            dontAskSignals at:sig put:#continue.
+            action = proceedValue = #continue.
+        ] ifFalse:[
+            action == #keepForAll ifTrue:[
+                dontAskSignals isNil ifTrue:[
+                    dontAskSignals := IdentityDictionary new.
+                ].
+                dontAskSignals at:sig put:#keep.
+                action := #continue.
+                proceedValue := #keep.
+            ] ifFalse:[
+                action == #keep ifTrue:[
+                    action := #continue.
+                    proceedValue := #keep.
+                ].
+            ].
         ].
 
         action == #continue ifTrue:[
-            ex proceedWith:proceedValue
+            ex proceedWith:(proceedValue ? #continue)
         ].
         action == #abort ifTrue:[
             AbortSignal raise.
@@ -680,6 +710,10 @@
         action == #skip ifTrue:[
             ex proceedWith:nil
         ].
+        action == #debug ifTrue:[
+            Debugger enter:ex suspendedContext withMessage:ex errorString.
+            ex proceedWith:proceedValue
+        ].
 
         "/ (ex signal) enterDebuggerWith:ex message:what.
         ex reject
@@ -977,6 +1011,6 @@
 !PositionableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.79 1999-08-04 19:36:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.80 1999-08-26 11:53:26 cg Exp $'
 ! !
 PositionableStream initialize!