BrowserView.st
changeset 2479 b7943e6621b2
parent 2478 b223d2373f80
child 2480 8b8af77f0e6c
--- a/BrowserView.st	Thu Dec 09 13:40:38 1999 +0100
+++ b/BrowserView.st	Thu Dec 09 21:05:55 1999 +0100
@@ -4311,7 +4311,8 @@
      moduleHolder packageHolder fileNameHolder
      oldModule oldPackage oldFileName
      module package fileName nameSpace nameSpacePrefix
-     y component info project nm mgr creatingNew msg|
+     y component info project nm mgr creatingNew msg 
+     answer doCheckinWithoutAsking forceCheckIn|
 
     aClass isLoaded ifFalse:[
         self warn:'please load the class first'.
@@ -4402,177 +4403,193 @@
     packageHolder := package asValue.
 
     "/
-    "/ should check for conflicts (i.e. if such a container already exists) ...
+    "/ check for conflicts (i.e. if such a container already exists) ...
     "/
+    doCheckinWithoutAsking := false.
     (mgr checkForExistingContainerInModule:module 
                                    package:package 
                                  container:fileName) ifTrue:[
-        "/ for now - this needs more work.
-
-"/        self information:(resources 
-"/                            string:'%1 is already contained in the container:
-"/
-"/    %2 / %3 / %4'
-"/                            with:className
-"/                            with:module
-"/                            with:package
-"/                            with:fileName).
-"/        ^ false.
-"/
-        (Dialog confirm:(resources 
-                            string:'Notice: there already is a container for %1 in:
+        answer := Dialog confirmWithCancel:(resources 
+                            string:'About to change the source container.
+
+Notice: there is a container for %1 in:
 
     %2 / %3 / %4
 
-To change it, press continue.'
+Do you want to change it or check right into that container ?'
                             with:className
                             with:module
                             with:package
                             with:fileName)
-                yesLabel:(resources string:'continue')
-                noLabel:(resources string:'cancel'))
-        ifFalse:[
+                labels:(resources array:#('cancel' 'check in' 'change')).
+        answer isNil ifTrue:[AbortSignal raise].
+        answer ifTrue:[
+            doCheckinWithoutAsking := false.
+            oldModule := module.
+            oldPackage := package.
+            oldFileName := fileName
+        ] ifFalse:[
+            doCheckinWithoutAsking := true.
+            creatingNew := false.
+        ].
+    ].
+
+    doCheckinWithoutAsking ifFalse:[
+        "/
+        "/ open a dialog for this
+        "/
+        box := DialogBox new.
+        box label:title.
+
+        component := box addTextLabel:boxText withCRs.
+        component adjust:#left; borderWidth:0.
+        box addVerticalSpace.
+        box addVerticalSpace.
+
+        y := box yPosition.
+        component := box addTextLabel:(resources string:'Module:').
+        component width:0.4; adjust:#right.
+        box yPosition:y.
+        component := box addInputFieldOn:moduleHolder tabable:true.
+        component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
+
+        box addVerticalSpace.
+        y := box yPosition.
+        component := box addTextLabel:'Package:'.
+        component width:0.4; adjust:#right.
+        box yPosition:y.
+        component := box addInputFieldOn:packageHolder tabable:true.
+        component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
+
+        box addVerticalSpace.
+        y := box yPosition.
+        component := box addTextLabel:'Filename:'.
+        component width:0.4; adjust:#right.
+        box yPosition:y.
+        component := box addInputFieldOn:fileNameHolder tabable:true.
+        component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
+
+        box addVerticalSpace.
+
+        (mgr checkForExistingContainerInModule:module 
+                                       package:package 
+                                     container:fileName) ifFalse:[
+            component := box addTextLabel:'Notice: class seems to have no container yet.'.
+            component adjust:#left; borderWidth:0.
+            creatingNew := true.
+        ] ifTrue:[
+            creatingNew := false.
+        ].
+
+        box addVerticalSpace.
+
+        box addAbortAndOkButtons.
+
+        box showAtPointer.
+
+        box accepted ifFalse:[
+            box destroy.
             ^ false
         ].
-        oldModule := module.
-        oldPackage := package.
-        oldFileName := fileName
-    ].
-
-    "/
-    "/ open a dialog for this
-    "/
-    box := DialogBox new.
-    box label:title.
-
-    component := box addTextLabel:boxText withCRs.
-    component adjust:#left; borderWidth:0.
-    box addVerticalSpace.
-    box addVerticalSpace.
-
-    y := box yPosition.
-    component := box addTextLabel:(resources string:'Module:').
-    component width:0.4; adjust:#right.
-    box yPosition:y.
-    component := box addInputFieldOn:moduleHolder tabable:true.
-    component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
-
-    box addVerticalSpace.
-    y := box yPosition.
-    component := box addTextLabel:'Package:'.
-    component width:0.4; adjust:#right.
-    box yPosition:y.
-    component := box addInputFieldOn:packageHolder tabable:true.
-    component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
-
-    box addVerticalSpace.
-    y := box yPosition.
-    component := box addTextLabel:'Filename:'.
-    component width:0.4; adjust:#right.
-    box yPosition:y.
-    component := box addInputFieldOn:fileNameHolder tabable:true.
-    component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
-
-    box addVerticalSpace.
-
-    (mgr checkForExistingContainerInModule:module 
-                                   package:package 
-                                 container:fileName) ifFalse:[
-        component := box addTextLabel:'Notice: class seems to have no container yet.'.
-        component adjust:#left; borderWidth:0.
-        creatingNew := true.
-    ] ifTrue:[
-        creatingNew := false.
-    ].
-
-    box addVerticalSpace.
-
-    box addAbortAndOkButtons.
-
-    box showAtPointer.
-
-    box accepted ifTrue:[
+
         module := moduleHolder value withoutSpaces.
         package := packageHolder value withoutSpaces.
 
         fileName := fileNameHolder value withoutSpaces.
 
-        (fileName endsWith:',v') ifTrue:[
-            fileName := fileName copyWithoutLast:2
-        ].
-        (fileName endsWith:'.st') ifFalse:[
-            fileName := fileName , '.st'
-        ].
-
-        info := aClass revisionInfo.
-        info notNil ifTrue:[
-            (info includesKey:#repositoryPathName) ifFalse:[
-                info := nil
-            ]
-        ].
-        info isNil ifTrue:[
-            creatingNew ifFalse:[
-                (self confirm:(resources string:'The repository already contains a container named "%3" in "%1/%2" !!\\Checkin %4 anyway ? (DANGER - be careful)'
-                         withArgs:(Array with:module with:package with:fileName with:className)) withCRs)
-                    ifFalse:[
-                        ^ false
-                    ].
-            ].
-
-            (self confirm:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs)
+    ].
+
+    (fileName endsWith:',v') ifTrue:[
+        fileName := fileName copyWithoutLast:2
+    ].
+    (fileName endsWith:'.st') ifFalse:[
+        fileName := fileName , '.st'
+    ].
+
+    info := aClass revisionInfo.
+    info notNil ifTrue:[
+        (info includesKey:#repositoryPathName) ifFalse:[
+            info := nil
+        ]
+    ].
+    info isNil ifTrue:[
+        creatingNew ifFalse:[
+            doCheckinWithoutAsking ifFalse:[
+                (Dialog 
+                    confirm:(resources string:'The repository already contains a container named "%3" in "%1/%2" !!\\Checkin %4 anyway ? (DANGER - be careful)'
+                         withArgs:(Array with:module with:package with:fileName with:className)) withCRs
+                    noLabel:'cancel')
                 ifFalse:[
                     ^ false
                 ].
-            aClass updateVersionMethodFor:(mgr initialRevisionStringFor:aClass 
-                                               inModule:module 
-                                               package:package 
-                                               container:fileName).
-        ].
-
-        "/
-        "/ check for the module
-        "/
-        (mgr checkForExistingModule:module) ifFalse:[
-            (createDirs or:[creatingNew]) ifFalse:[
-                self warn:(resources string:'a module named %1 does not exist in the source code management' with:module).
+            ]
+        ].
+
+        doCheckinWithoutAsking ifFalse:[
+            (Dialog 
+                confirm:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs
+                noLabel:'cancel')
+            ifFalse:[
                 ^ false
             ].
-            (self confirm:(resources string:'%1 is a new module.\\create it ?' with:module) withCRs) ifFalse:[
-                ^ false.
-            ].
-            (mgr createModule:module) ifFalse:[
-                self warn:(resources string:'cannot create new module: %1' with:module).
-                ^ false.
-            ]
-        ].
-        lastModule := module.
-
-
-        "/
-        "/ check for the package
-        "/
-        (mgr checkForExistingModule:module package:package) ifFalse:[
-            (createDirs or:[creatingNew]) ifFalse:[
-                self warn:(resources string:'a package named %1 does not exist module %2' with:module with:package).
-                ^ false
-            ].
-            (self confirm:(resources string:'%1 is a new package (in module %2).\\create it ?' with:package with:module) withCRs) ifFalse:[
-                ^ false.
-            ].
-            (mgr createModule:module package:package) ifFalse:[
-                self warn:(resources string:'cannot create new package: %1 (in module %2)' with:package with:module).
-                ^ false.
-            ]
-        ].
-        lastPackage := package.
-
-        "/
-        "/ check for the container itself
-        "/
-        (mgr checkForExistingContainerInModule:module package:package container:fileName) ifTrue:[
-            creatingNew ifTrue:[
-                self warn:(resources string:'container for %1 already exists in %2/%3.' with:fileName with:module with:package) withCRs.
-            ].
+        ].
+
+        aClass updateVersionMethodFor:(mgr initialRevisionStringFor:aClass 
+                                           inModule:module 
+                                           package:package 
+                                           container:fileName).
+    ].
+
+    "/
+    "/ check for the module
+    "/
+    (mgr checkForExistingModule:module) ifFalse:[
+        (createDirs or:[creatingNew]) ifFalse:[
+            self warn:(resources string:'a module named %1 does not exist in the source code management' with:module).
+            ^ false
+        ].
+        (Dialog 
+            confirm:(resources string:'%1 is a new module.\\create it ?' with:module) withCRs
+            noLabel:'cancel') 
+        ifFalse:[
+            ^ false.
+        ].
+        (mgr createModule:module) ifFalse:[
+            self warn:(resources string:'cannot create new module: %1' with:module).
+            ^ false.
+        ]
+    ].
+    lastModule := module.
+
+
+    "/
+    "/ check for the package
+    "/
+    (mgr checkForExistingModule:module package:package) ifFalse:[
+        (createDirs or:[creatingNew]) ifFalse:[
+            self warn:(resources string:'a package named %1 does not exist module %2' with:module with:package).
+            ^ false
+        ].
+        (Dialog 
+            confirm:(resources string:'%1 is a new package (in module %2).\\create it ?' with:package with:module) withCRs
+            noLabel:'cancel') 
+        ifFalse:[
+            ^ false.
+        ].
+        (mgr createModule:module package:package) ifFalse:[
+            self warn:(resources string:'cannot create new package: %1 (in module %2)' with:package with:module).
+            ^ false.
+        ]
+    ].
+    lastPackage := package.
+
+    "/
+    "/ check for the container itself
+    "/
+    (mgr checkForExistingContainerInModule:module package:package container:fileName) ifTrue:[
+        creatingNew ifTrue:[
+            self warn:(resources string:'container for %1 already exists in %2/%3.' with:fileName with:module with:package) withCRs.
+        ].
 
 "/            (oldModule notNil
 "/            and:[(oldModule ~= module)
@@ -4583,25 +4600,30 @@
 "/                ^ false.
 "/            ].
 
-            (self confirm:(resources string:'check %1 into the existing container
+        doCheckinWithoutAsking ifFalse:[
+            (Dialog 
+                confirm:(resources string:'check %1 into the existing container
 
     %2 / %3 / %4  ?'
                                 with:className
                                 with:module 
                                 with:package 
-                                with:fileName) withCRs) 
+                                with:fileName) withCRs
+                noLabel:'cancel') 
             ifFalse:[
                 ^ false.
             ].  
-
-            aClass updateVersionMethodFor:'$' , 'Header' , '$'. "/ concatenated to avoid RCS-expansion
-
-            oldFileName notNil ifTrue:[
-                msg := ('forced checkin / source container change from ' , oldFileName).
-            ] ifFalse:[
-                msg := 'defined source container'
-            ].
-
+        ].  
+
+        aClass updateVersionMethodFor:'$' , 'Header' , '$'. "/ concatenated to avoid RCS-expansion
+
+        oldFileName notNil ifTrue:[
+            msg := ('forced checkin / source container change from ' , oldFileName).
+        ] ifFalse:[
+            msg := 'defined source container'
+        ].
+
+        (forceCheckIn := doCheckinWithoutAsking) ifFalse:[
             (mgr
                 checkinClass:aClass 
                 fileName:fileName 
@@ -4609,51 +4631,56 @@
                 module:module 
                 logMessage:msg)
             ifFalse:[
-                (self confirm:'no easy merge seems possible; force checkin (no merge) ?') ifFalse:[
-                    self normalLabel.
-                    ^ false.
+                doCheckinWithoutAsking ifFalse:[
+                    (Dialog 
+                        confirm:'no easy merge seems possible; force checkin (no merge) ?'
+                        noLabel:'cancel') 
+                    ifFalse:[
+                        self normalLabel.
+                        ^ false.
+                    ].
                 ].
-                (mgr
-                    checkinClass:aClass 
-                    fileName:fileName 
-                    directory:package 
-                    module:module 
-                    logMessage:msg
-                    force:true)
-                ifFalse:[
-                    self warn:(resources string:'failed to check into existing container.').
-                    self normalLabel.
-                    ^ false.
-                ].
+                forceCheckIn := true.
+            ]
+        ].
+        forceCheckIn ifTrue:[
+            (mgr
+                checkinClass:aClass 
+                fileName:fileName 
+                directory:package 
+                module:module 
+                logMessage:msg
+                force:true)
+            ifFalse:[
+                self warn:(resources string:'failed to check into existing container.').
+                self normalLabel.
+                ^ false.
             ].
-
-            self normalLabel.
-            ^ true
-        ] ifFalse:[
-            (createContainer or:[creatingNew]) ifFalse:[
-                (self confirm:(resources string:'no container exists for %1 in %2/%3\\create ?' 
-                                          with:fileName with:module with:package) withCRs) ifFalse:[
-                    ^ false
-                ]
-            ]
-        ].
-
-        (mgr
-                createContainerFor:aClass
-                inModule:module
-                package:package
-                container:fileName) ifFalse:[
-            self warn:(resources string:'failed to create container.').
-            self normalLabel.
-            ^ false.
         ].
         self normalLabel.
         ^ true
-    ].
-    box destroy.
-    ^ false
-
-    "Modified: / 5.3.1998 / 02:44:45 / cg"
+    ] ifFalse:[
+        (createContainer or:[creatingNew]) ifFalse:[
+            (Dialog
+                 confirm:(resources string:'no container exists for %1 in %2/%3\\create ?' 
+                                      with:fileName with:module with:package) withCRs
+                 noLabel:'cancel') ifFalse:[
+                ^ false
+            ]
+        ]
+    ].
+
+    (mgr
+            createContainerFor:aClass
+            inModule:module
+            package:package
+            container:fileName) ifFalse:[
+        self warn:(resources string:'failed to create container.').
+        self normalLabel.
+        ^ false.
+    ].
+    self normalLabel.
+    ^ true
 !
 
 classLoadNewRevision
@@ -14016,6 +14043,6 @@
 !BrowserView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.576 1999-12-09 12:40:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.577 1999-12-09 20:05:55 cg Exp $'
 ! !
 BrowserView initialize!