BrowserView.st
changeset 2479 b7943e6621b2
parent 2478 b223d2373f80
child 2480 8b8af77f0e6c
equal deleted inserted replaced
2478:b223d2373f80 2479:b7943e6621b2
  4309 
  4309 
  4310     |box className
  4310     |box className
  4311      moduleHolder packageHolder fileNameHolder
  4311      moduleHolder packageHolder fileNameHolder
  4312      oldModule oldPackage oldFileName
  4312      oldModule oldPackage oldFileName
  4313      module package fileName nameSpace nameSpacePrefix
  4313      module package fileName nameSpace nameSpacePrefix
  4314      y component info project nm mgr creatingNew msg|
  4314      y component info project nm mgr creatingNew msg 
       
  4315      answer doCheckinWithoutAsking forceCheckIn|
  4315 
  4316 
  4316     aClass isLoaded ifFalse:[
  4317     aClass isLoaded ifFalse:[
  4317         self warn:'please load the class first'.
  4318         self warn:'please load the class first'.
  4318         ^ false.
  4319         ^ false.
  4319     ].
  4320     ].
  4400         package replaceAll:$\ with:$/.
  4401         package replaceAll:$\ with:$/.
  4401     ].
  4402     ].
  4402     packageHolder := package asValue.
  4403     packageHolder := package asValue.
  4403 
  4404 
  4404     "/
  4405     "/
  4405     "/ should check for conflicts (i.e. if such a container already exists) ...
  4406     "/ check for conflicts (i.e. if such a container already exists) ...
  4406     "/
  4407     "/
       
  4408     doCheckinWithoutAsking := false.
  4407     (mgr checkForExistingContainerInModule:module 
  4409     (mgr checkForExistingContainerInModule:module 
  4408                                    package:package 
  4410                                    package:package 
  4409                                  container:fileName) ifTrue:[
  4411                                  container:fileName) ifTrue:[
  4410         "/ for now - this needs more work.
  4412         answer := Dialog confirmWithCancel:(resources 
  4411 
  4413                             string:'About to change the source container.
  4412 "/        self information:(resources 
  4414 
  4413 "/                            string:'%1 is already contained in the container:
  4415 Notice: there is a container for %1 in:
  4414 "/
       
  4415 "/    %2 / %3 / %4'
       
  4416 "/                            with:className
       
  4417 "/                            with:module
       
  4418 "/                            with:package
       
  4419 "/                            with:fileName).
       
  4420 "/        ^ false.
       
  4421 "/
       
  4422         (Dialog confirm:(resources 
       
  4423                             string:'Notice: there already is a container for %1 in:
       
  4424 
  4416 
  4425     %2 / %3 / %4
  4417     %2 / %3 / %4
  4426 
  4418 
  4427 To change it, press continue.'
  4419 Do you want to change it or check right into that container ?'
  4428                             with:className
  4420                             with:className
  4429                             with:module
  4421                             with:module
  4430                             with:package
  4422                             with:package
  4431                             with:fileName)
  4423                             with:fileName)
  4432                 yesLabel:(resources string:'continue')
  4424                 labels:(resources array:#('cancel' 'check in' 'change')).
  4433                 noLabel:(resources string:'cancel'))
  4425         answer isNil ifTrue:[AbortSignal raise].
  4434         ifFalse:[
  4426         answer ifTrue:[
       
  4427             doCheckinWithoutAsking := false.
       
  4428             oldModule := module.
       
  4429             oldPackage := package.
       
  4430             oldFileName := fileName
       
  4431         ] ifFalse:[
       
  4432             doCheckinWithoutAsking := true.
       
  4433             creatingNew := false.
       
  4434         ].
       
  4435     ].
       
  4436 
       
  4437     doCheckinWithoutAsking ifFalse:[
       
  4438         "/
       
  4439         "/ open a dialog for this
       
  4440         "/
       
  4441         box := DialogBox new.
       
  4442         box label:title.
       
  4443 
       
  4444         component := box addTextLabel:boxText withCRs.
       
  4445         component adjust:#left; borderWidth:0.
       
  4446         box addVerticalSpace.
       
  4447         box addVerticalSpace.
       
  4448 
       
  4449         y := box yPosition.
       
  4450         component := box addTextLabel:(resources string:'Module:').
       
  4451         component width:0.4; adjust:#right.
       
  4452         box yPosition:y.
       
  4453         component := box addInputFieldOn:moduleHolder tabable:true.
       
  4454         component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
       
  4455 
       
  4456         box addVerticalSpace.
       
  4457         y := box yPosition.
       
  4458         component := box addTextLabel:'Package:'.
       
  4459         component width:0.4; adjust:#right.
       
  4460         box yPosition:y.
       
  4461         component := box addInputFieldOn:packageHolder tabable:true.
       
  4462         component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
       
  4463 
       
  4464         box addVerticalSpace.
       
  4465         y := box yPosition.
       
  4466         component := box addTextLabel:'Filename:'.
       
  4467         component width:0.4; adjust:#right.
       
  4468         box yPosition:y.
       
  4469         component := box addInputFieldOn:fileNameHolder tabable:true.
       
  4470         component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
       
  4471 
       
  4472         box addVerticalSpace.
       
  4473 
       
  4474         (mgr checkForExistingContainerInModule:module 
       
  4475                                        package:package 
       
  4476                                      container:fileName) ifFalse:[
       
  4477             component := box addTextLabel:'Notice: class seems to have no container yet.'.
       
  4478             component adjust:#left; borderWidth:0.
       
  4479             creatingNew := true.
       
  4480         ] ifTrue:[
       
  4481             creatingNew := false.
       
  4482         ].
       
  4483 
       
  4484         box addVerticalSpace.
       
  4485 
       
  4486         box addAbortAndOkButtons.
       
  4487 
       
  4488         box showAtPointer.
       
  4489 
       
  4490         box accepted ifFalse:[
       
  4491             box destroy.
  4435             ^ false
  4492             ^ false
  4436         ].
  4493         ].
  4437         oldModule := module.
  4494 
  4438         oldPackage := package.
       
  4439         oldFileName := fileName
       
  4440     ].
       
  4441 
       
  4442     "/
       
  4443     "/ open a dialog for this
       
  4444     "/
       
  4445     box := DialogBox new.
       
  4446     box label:title.
       
  4447 
       
  4448     component := box addTextLabel:boxText withCRs.
       
  4449     component adjust:#left; borderWidth:0.
       
  4450     box addVerticalSpace.
       
  4451     box addVerticalSpace.
       
  4452 
       
  4453     y := box yPosition.
       
  4454     component := box addTextLabel:(resources string:'Module:').
       
  4455     component width:0.4; adjust:#right.
       
  4456     box yPosition:y.
       
  4457     component := box addInputFieldOn:moduleHolder tabable:true.
       
  4458     component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
       
  4459 
       
  4460     box addVerticalSpace.
       
  4461     y := box yPosition.
       
  4462     component := box addTextLabel:'Package:'.
       
  4463     component width:0.4; adjust:#right.
       
  4464     box yPosition:y.
       
  4465     component := box addInputFieldOn:packageHolder tabable:true.
       
  4466     component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
       
  4467 
       
  4468     box addVerticalSpace.
       
  4469     y := box yPosition.
       
  4470     component := box addTextLabel:'Filename:'.
       
  4471     component width:0.4; adjust:#right.
       
  4472     box yPosition:y.
       
  4473     component := box addInputFieldOn:fileNameHolder tabable:true.
       
  4474     component width:0.6; left:0.4; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
       
  4475 
       
  4476     box addVerticalSpace.
       
  4477 
       
  4478     (mgr checkForExistingContainerInModule:module 
       
  4479                                    package:package 
       
  4480                                  container:fileName) ifFalse:[
       
  4481         component := box addTextLabel:'Notice: class seems to have no container yet.'.
       
  4482         component adjust:#left; borderWidth:0.
       
  4483         creatingNew := true.
       
  4484     ] ifTrue:[
       
  4485         creatingNew := false.
       
  4486     ].
       
  4487 
       
  4488     box addVerticalSpace.
       
  4489 
       
  4490     box addAbortAndOkButtons.
       
  4491 
       
  4492     box showAtPointer.
       
  4493 
       
  4494     box accepted ifTrue:[
       
  4495         module := moduleHolder value withoutSpaces.
  4495         module := moduleHolder value withoutSpaces.
  4496         package := packageHolder value withoutSpaces.
  4496         package := packageHolder value withoutSpaces.
  4497 
  4497 
  4498         fileName := fileNameHolder value withoutSpaces.
  4498         fileName := fileNameHolder value withoutSpaces.
  4499 
  4499 
  4500         (fileName endsWith:',v') ifTrue:[
  4500     ].
  4501             fileName := fileName copyWithoutLast:2
  4501 
  4502         ].
  4502     (fileName endsWith:',v') ifTrue:[
  4503         (fileName endsWith:'.st') ifFalse:[
  4503         fileName := fileName copyWithoutLast:2
  4504             fileName := fileName , '.st'
  4504     ].
  4505         ].
  4505     (fileName endsWith:'.st') ifFalse:[
  4506 
  4506         fileName := fileName , '.st'
  4507         info := aClass revisionInfo.
  4507     ].
  4508         info notNil ifTrue:[
  4508 
  4509             (info includesKey:#repositoryPathName) ifFalse:[
  4509     info := aClass revisionInfo.
  4510                 info := nil
  4510     info notNil ifTrue:[
  4511             ]
  4511         (info includesKey:#repositoryPathName) ifFalse:[
  4512         ].
  4512             info := nil
  4513         info isNil ifTrue:[
  4513         ]
  4514             creatingNew ifFalse:[
  4514     ].
  4515                 (self confirm:(resources string:'The repository already contains a container named "%3" in "%1/%2" !!\\Checkin %4 anyway ? (DANGER - be careful)'
  4515     info isNil ifTrue:[
  4516                          withArgs:(Array with:module with:package with:fileName with:className)) withCRs)
  4516         creatingNew ifFalse:[
  4517                     ifFalse:[
  4517             doCheckinWithoutAsking ifFalse:[
  4518                         ^ false
  4518                 (Dialog 
  4519                     ].
  4519                     confirm:(resources string:'The repository already contains a container named "%3" in "%1/%2" !!\\Checkin %4 anyway ? (DANGER - be careful)'
  4520             ].
  4520                          withArgs:(Array with:module with:package with:fileName with:className)) withCRs
  4521 
  4521                     noLabel:'cancel')
  4522             (self confirm:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs)
       
  4523                 ifFalse:[
  4522                 ifFalse:[
  4524                     ^ false
  4523                     ^ false
  4525                 ].
  4524                 ].
  4526             aClass updateVersionMethodFor:(mgr initialRevisionStringFor:aClass 
  4525             ]
  4527                                                inModule:module 
       
  4528                                                package:package 
       
  4529                                                container:fileName).
       
  4530         ].
  4526         ].
  4531 
  4527 
  4532         "/
  4528         doCheckinWithoutAsking ifFalse:[
  4533         "/ check for the module
  4529             (Dialog 
  4534         "/
  4530                 confirm:(resources string:'%1 does not have any (usable) revision info (#version method)\\Shall I create one ?' with:className) withCRs
  4535         (mgr checkForExistingModule:module) ifFalse:[
  4531                 noLabel:'cancel')
  4536             (createDirs or:[creatingNew]) ifFalse:[
  4532             ifFalse:[
  4537                 self warn:(resources string:'a module named %1 does not exist in the source code management' with:module).
       
  4538                 ^ false
  4533                 ^ false
  4539             ].
  4534             ].
  4540             (self confirm:(resources string:'%1 is a new module.\\create it ?' with:module) withCRs) ifFalse:[
       
  4541                 ^ false.
       
  4542             ].
       
  4543             (mgr createModule:module) ifFalse:[
       
  4544                 self warn:(resources string:'cannot create new module: %1' with:module).
       
  4545                 ^ false.
       
  4546             ]
       
  4547         ].
  4535         ].
  4548         lastModule := module.
  4536 
  4549 
  4537         aClass updateVersionMethodFor:(mgr initialRevisionStringFor:aClass 
  4550 
  4538                                            inModule:module 
  4551         "/
  4539                                            package:package 
  4552         "/ check for the package
  4540                                            container:fileName).
  4553         "/
  4541     ].
  4554         (mgr checkForExistingModule:module package:package) ifFalse:[
  4542 
  4555             (createDirs or:[creatingNew]) ifFalse:[
  4543     "/
  4556                 self warn:(resources string:'a package named %1 does not exist module %2' with:module with:package).
  4544     "/ check for the module
  4557                 ^ false
  4545     "/
  4558             ].
  4546     (mgr checkForExistingModule:module) ifFalse:[
  4559             (self confirm:(resources string:'%1 is a new package (in module %2).\\create it ?' with:package with:module) withCRs) ifFalse:[
  4547         (createDirs or:[creatingNew]) ifFalse:[
  4560                 ^ false.
  4548             self warn:(resources string:'a module named %1 does not exist in the source code management' with:module).
  4561             ].
  4549             ^ false
  4562             (mgr createModule:module package:package) ifFalse:[
       
  4563                 self warn:(resources string:'cannot create new package: %1 (in module %2)' with:package with:module).
       
  4564                 ^ false.
       
  4565             ]
       
  4566         ].
  4550         ].
  4567         lastPackage := package.
  4551         (Dialog 
  4568 
  4552             confirm:(resources string:'%1 is a new module.\\create it ?' with:module) withCRs
  4569         "/
  4553             noLabel:'cancel') 
  4570         "/ check for the container itself
  4554         ifFalse:[
  4571         "/
  4555             ^ false.
  4572         (mgr checkForExistingContainerInModule:module package:package container:fileName) ifTrue:[
  4556         ].
  4573             creatingNew ifTrue:[
  4557         (mgr createModule:module) ifFalse:[
  4574                 self warn:(resources string:'container for %1 already exists in %2/%3.' with:fileName with:module with:package) withCRs.
  4558             self warn:(resources string:'cannot create new module: %1' with:module).
  4575             ].
  4559             ^ false.
       
  4560         ]
       
  4561     ].
       
  4562     lastModule := module.
       
  4563 
       
  4564 
       
  4565     "/
       
  4566     "/ check for the package
       
  4567     "/
       
  4568     (mgr checkForExistingModule:module package:package) ifFalse:[
       
  4569         (createDirs or:[creatingNew]) ifFalse:[
       
  4570             self warn:(resources string:'a package named %1 does not exist module %2' with:module with:package).
       
  4571             ^ false
       
  4572         ].
       
  4573         (Dialog 
       
  4574             confirm:(resources string:'%1 is a new package (in module %2).\\create it ?' with:package with:module) withCRs
       
  4575             noLabel:'cancel') 
       
  4576         ifFalse:[
       
  4577             ^ false.
       
  4578         ].
       
  4579         (mgr createModule:module package:package) ifFalse:[
       
  4580             self warn:(resources string:'cannot create new package: %1 (in module %2)' with:package with:module).
       
  4581             ^ false.
       
  4582         ]
       
  4583     ].
       
  4584     lastPackage := package.
       
  4585 
       
  4586     "/
       
  4587     "/ check for the container itself
       
  4588     "/
       
  4589     (mgr checkForExistingContainerInModule:module package:package container:fileName) ifTrue:[
       
  4590         creatingNew ifTrue:[
       
  4591             self warn:(resources string:'container for %1 already exists in %2/%3.' with:fileName with:module with:package) withCRs.
       
  4592         ].
  4576 
  4593 
  4577 "/            (oldModule notNil
  4594 "/            (oldModule notNil
  4578 "/            and:[(oldModule ~= module)
  4595 "/            and:[(oldModule ~= module)
  4579 "/                 or:[oldPackage ~= package
  4596 "/                 or:[oldPackage ~= package
  4580 "/                 or:[oldFileName ~= fileName]]])
  4597 "/                 or:[oldFileName ~= fileName]]])
  4581 "/            ifFalse:[
  4598 "/            ifFalse:[
  4582 "/                self warn:(resources string:'no change').
  4599 "/                self warn:(resources string:'no change').
  4583 "/                ^ false.
  4600 "/                ^ false.
  4584 "/            ].
  4601 "/            ].
  4585 
  4602 
  4586             (self confirm:(resources string:'check %1 into the existing container
  4603         doCheckinWithoutAsking ifFalse:[
       
  4604             (Dialog 
       
  4605                 confirm:(resources string:'check %1 into the existing container
  4587 
  4606 
  4588     %2 / %3 / %4  ?'
  4607     %2 / %3 / %4  ?'
  4589                                 with:className
  4608                                 with:className
  4590                                 with:module 
  4609                                 with:module 
  4591                                 with:package 
  4610                                 with:package 
  4592                                 with:fileName) withCRs) 
  4611                                 with:fileName) withCRs
       
  4612                 noLabel:'cancel') 
  4593             ifFalse:[
  4613             ifFalse:[
  4594                 ^ false.
  4614                 ^ false.
  4595             ].  
  4615             ].  
  4596 
  4616         ].  
  4597             aClass updateVersionMethodFor:'$' , 'Header' , '$'. "/ concatenated to avoid RCS-expansion
  4617 
  4598 
  4618         aClass updateVersionMethodFor:'$' , 'Header' , '$'. "/ concatenated to avoid RCS-expansion
  4599             oldFileName notNil ifTrue:[
  4619 
  4600                 msg := ('forced checkin / source container change from ' , oldFileName).
  4620         oldFileName notNil ifTrue:[
  4601             ] ifFalse:[
  4621             msg := ('forced checkin / source container change from ' , oldFileName).
  4602                 msg := 'defined source container'
  4622         ] ifFalse:[
  4603             ].
  4623             msg := 'defined source container'
  4604 
  4624         ].
       
  4625 
       
  4626         (forceCheckIn := doCheckinWithoutAsking) ifFalse:[
  4605             (mgr
  4627             (mgr
  4606                 checkinClass:aClass 
  4628                 checkinClass:aClass 
  4607                 fileName:fileName 
  4629                 fileName:fileName 
  4608                 directory:package 
  4630                 directory:package 
  4609                 module:module 
  4631                 module:module 
  4610                 logMessage:msg)
  4632                 logMessage:msg)
  4611             ifFalse:[
  4633             ifFalse:[
  4612                 (self confirm:'no easy merge seems possible; force checkin (no merge) ?') ifFalse:[
  4634                 doCheckinWithoutAsking ifFalse:[
  4613                     self normalLabel.
  4635                     (Dialog 
  4614                     ^ false.
  4636                         confirm:'no easy merge seems possible; force checkin (no merge) ?'
       
  4637                         noLabel:'cancel') 
       
  4638                     ifFalse:[
       
  4639                         self normalLabel.
       
  4640                         ^ false.
       
  4641                     ].
  4615                 ].
  4642                 ].
  4616                 (mgr
  4643                 forceCheckIn := true.
  4617                     checkinClass:aClass 
       
  4618                     fileName:fileName 
       
  4619                     directory:package 
       
  4620                     module:module 
       
  4621                     logMessage:msg
       
  4622                     force:true)
       
  4623                 ifFalse:[
       
  4624                     self warn:(resources string:'failed to check into existing container.').
       
  4625                     self normalLabel.
       
  4626                     ^ false.
       
  4627                 ].
       
  4628             ].
       
  4629 
       
  4630             self normalLabel.
       
  4631             ^ true
       
  4632         ] ifFalse:[
       
  4633             (createContainer or:[creatingNew]) ifFalse:[
       
  4634                 (self confirm:(resources string:'no container exists for %1 in %2/%3\\create ?' 
       
  4635                                           with:fileName with:module with:package) withCRs) ifFalse:[
       
  4636                     ^ false
       
  4637                 ]
       
  4638             ]
  4644             ]
  4639         ].
  4645         ].
  4640 
  4646         forceCheckIn ifTrue:[
  4641         (mgr
  4647             (mgr
  4642                 createContainerFor:aClass
  4648                 checkinClass:aClass 
  4643                 inModule:module
  4649                 fileName:fileName 
  4644                 package:package
  4650                 directory:package 
  4645                 container:fileName) ifFalse:[
  4651                 module:module 
  4646             self warn:(resources string:'failed to create container.').
  4652                 logMessage:msg
  4647             self normalLabel.
  4653                 force:true)
  4648             ^ false.
  4654             ifFalse:[
       
  4655                 self warn:(resources string:'failed to check into existing container.').
       
  4656                 self normalLabel.
       
  4657                 ^ false.
       
  4658             ].
  4649         ].
  4659         ].
  4650         self normalLabel.
  4660         self normalLabel.
  4651         ^ true
  4661         ^ true
  4652     ].
  4662     ] ifFalse:[
  4653     box destroy.
  4663         (createContainer or:[creatingNew]) ifFalse:[
  4654     ^ false
  4664             (Dialog
  4655 
  4665                  confirm:(resources string:'no container exists for %1 in %2/%3\\create ?' 
  4656     "Modified: / 5.3.1998 / 02:44:45 / cg"
  4666                                       with:fileName with:module with:package) withCRs
       
  4667                  noLabel:'cancel') ifFalse:[
       
  4668                 ^ false
       
  4669             ]
       
  4670         ]
       
  4671     ].
       
  4672 
       
  4673     (mgr
       
  4674             createContainerFor:aClass
       
  4675             inModule:module
       
  4676             package:package
       
  4677             container:fileName) ifFalse:[
       
  4678         self warn:(resources string:'failed to create container.').
       
  4679         self normalLabel.
       
  4680         ^ false.
       
  4681     ].
       
  4682     self normalLabel.
       
  4683     ^ true
  4657 !
  4684 !
  4658 
  4685 
  4659 classLoadNewRevision
  4686 classLoadNewRevision
  4660     "let user specify a container and fileIn from there"
  4687     "let user specify a container and fileIn from there"
  4661 
  4688 
 14014 ! !
 14041 ! !
 14015 
 14042 
 14016 !BrowserView class methodsFor:'documentation'!
 14043 !BrowserView class methodsFor:'documentation'!
 14017 
 14044 
 14018 version
 14045 version
 14019     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.576 1999-12-09 12:40:38 cg Exp $'
 14046     ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.577 1999-12-09 20:05:55 cg Exp $'
 14020 ! !
 14047 ! !
 14021 BrowserView initialize!
 14048 BrowserView initialize!