fixes & adds for multiple CVSRoots
authorClaus Gittinger <cg@exept.de>
Thu, 07 Dec 2000 14:17:55 +0100
changeset 2884 587baa691c68
parent 2883 bd88b8b95b29
child 2885 7f4a298ca5ae
fixes & adds for multiple CVSRoots
AbstractLauncherApplication.st
--- a/AbstractLauncherApplication.st	Thu Dec 07 08:51:48 2000 +0100
+++ b/AbstractLauncherApplication.st	Thu Dec 07 14:17:55 2000 +0100
@@ -3795,6 +3795,7 @@
     (Smalltalk at:#SourceCodeManager) == CVSSourceCodeManager ifTrue:[
     s nextPutLine:'  Smalltalk at:#SourceCodeManager put: CVSSourceCodeManager.'.
     s nextPutLine:'  AbstractSourceCodeManager cacheDirectoryName:' , AbstractSourceCodeManager cacheDirectoryName storeString , '.'.
+    s nextPutLine:'  CVSSourceCodeManager repositoryNamesPerModule:' , CVSSourceCodeManager repositoryNamesPerModule storeString , '.'.
     s nextPutLine:'  CVSSourceCodeManager initializeForRepository:' , CVSSourceCodeManager repositoryName storeString , '.'.
     ].
     s nextPutLine:'].'.
@@ -3851,14 +3852,14 @@
             ] ifFalse:[
                 repositoryHolder := '' asValue.
             ].
-            cvsIsSetup := true.
+            cvsIsSetup := true asValue.
         ] ifFalse:[
             cvsIsSetup := false asValue.
         ]
     ] ifFalse:[
         useManager := false.
         localSourceFirst := false.
-        cvsIsSetup := false.
+        cvsIsSetup := false asValue.
     ].
     showErrorNotifier := (Exception emergencyHandler == AbstractLauncherApplication notifyingEmergencyHandler) asValue.
     showVerboseStack := (DebugView defaultVerboseBacktrace ? false) asValue.
@@ -3900,44 +3901,43 @@
         check enableChannel:cvsIsSetup.
         box makeTabable:check.
 
-        cvsIsSetup value ifFalse:[
-            AbstractSourceCodeManager notNil ifTrue:[
-                check width:0.6.
-                box yPosition:pos.
-                setupButt := box addComponent:(Button label:(resources string:'setup...') 
-                           action:[|manager|
-
-                                   self cvsConfigurationDialogFor:requestor.
-                                   manager := (Smalltalk at:#SourceCodeManager).
-                                   cvsIsSetup value:manager notNil.
-                                   manager notNil ifTrue:[
-                                        repositoryHolder value: manager repositoryName.
-                                        sourceCacheDir value:(AbstractSourceCodeManager cacheDirectoryName).
-                                        setupButt beInvisible.
-                                   ].
-                                  ]).
-                box makeTabable:setupButt.
-                setupButt left:0.6; width:0.4.
-            ].
+        CVSSourceCodeManager notNil ifTrue:[
+            check width:0.6.
+            box yPosition:pos.
+            setupButt := box addComponent:(Button label:(resources string:'setup...') 
+                       action:[|manager|
+
+                               self cvsConfigurationDialogFor:requestor.
+                               manager := (Smalltalk at:#SourceCodeManager).
+                               cvsIsSetup value:manager notNil.
+                               manager notNil ifTrue:[
+                                    repositoryHolder value: manager repositoryName.
+                                    sourceCacheDir value:(AbstractSourceCodeManager cacheDirectoryName).
+                               ].
+                              ]).
+            setupButt enableChannel:useManager.    
+            box makeTabable:setupButt.
+            setupButt left:0.6; width:0.4.
         ].
         oldIndent := box leftIndent.
         box leftIndent:30.
 
         component := box 
-                        addLabelledInputField:(resources string:'repository:')
+                        addLabelledInputField:(resources string:'CVS repository:')
                         adjust:#right
                         on:repositoryHolder 
                         tabable:true
-                        separateAtX:0.4.
+                        separateAtX:0.5.
         component immediateAccept:true; acceptOnLeave:false.
         component enableChannel:useManager.
+        component readOnly:true. 
 
         cacheEntry := box 
                         addLabelledInputField:(resources string:'source cache dir:')
                         adjust:#right
                         on:sourceCacheDir 
                         tabable:true
-                        separateAtX:0.4.
+                        separateAtX:0.5.
         cacheEntry immediateAccept:true; acceptOnLeave:false.
         cacheEntry enableChannel:useManager.
 
@@ -3946,11 +3946,13 @@
         butt action:[ box withWaitCursorDo:[ AbstractSourceCodeManager flushSourceCache ] ].
         box addComponent:butt tabable:true.
         butt left:0.6; width:0.4; leftInset:0.
+        butt enableChannel:useManager.
 
         butt := Button label:(resources string:'condense cache now').
         butt action:[ box withWaitCursorDo:[ AbstractSourceCodeManager condenseSourceCache ] ].
         box addComponent:butt tabable:true.
         butt left:0.6; width:0.4; leftInset:0.
+        butt enableChannel:useManager.
 
         localCheck := box addCheckBox:(resources string:'if present, use local source (suppress checkout)') on:localSourceFirst.
         localCheck enableChannel:useManager.
@@ -5012,74 +5014,97 @@
     box destroy.
 ! !
 
-!AbstractLauncherApplication::LauncherDialogs class methodsFor:'dialogs-private'!
+!AbstractLauncherApplication::LauncherDialogs class methodsFor:'dialogs - private'!
 
 cvsConfigurationDialogFor:requestor
-    |box y cvsRootHolder component resources defaultsList|
+    |cvsRootHolder resources defaultsList bindings dialog 
+     listOfModules selectedPerModuleRoot rootsPerModule acceptChannel
+     removeEnabled|
 
     resources := requestor class classResources.
 
     OperatingSystem isUNIXlike ifTrue:[
-	defaultsList := #('/files/CVS' '/CVS' 'host:/files/CVS' 'host:/CVS').
+        defaultsList := #('/files/CVS' '/CVS' 'host:/files/CVS' 'host:/CVS' ':pserver:user@host:/files/CVS').
     ] ifFalse:[
-	OperatingSystem isMSDOSlike ifTrue:[
-	    defaultsList := #(':local:c:\files\CVS' ':local:c:\CVS' 'host:/files/CVS' 'host:/CVS').
-	] ifFalse:[
-	    defaultsList := #('host:/files/CVS' 'host:/CVS').
-	]
+        OperatingSystem isMSDOSlike ifTrue:[
+            defaultsList := #(':local:c:\files\CVS' ':local:c:\CVS' 'host:/files/CVS' 'host:/CVS' ':pserver:user@host:/files/CVS').
+        ] ifFalse:[
+            defaultsList := #('host:/files/CVS' 'host:/CVS' ':pserver:user@host:/files/CVS').
+        ]
     ].
 
     cvsRootHolder := CVSSourceCodeManager repositoryName ? '/files/CVS'.
     cvsRootHolder := cvsRootHolder asValue.
-
-    "/
-    "/ create a box to input the CVSRoot ...
-    "/
-    box := DialogBox new.
-    box label:(resources string:'CVS Setup').
-
-    component := (box addTextLabel:'CVS SourceCodeManager setup').
-    component adjust:#left.
-
-    y := box yPosition.
-    component := box addTextLabel:(resources string:'CVSRoot:').
-    component width:0.25; adjust:#right; borderWidth:0.
-    box yPosition:y.
-    component := box addComboBoxOn:nil tabable:true.
-"/    commandListPop := box addInputFieldOn:printCommand tabable:true.
-    component width:0.75; left:0.25; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
-    component list:defaultsList.
-    component model:cvsRootHolder.
-
-"/    component := box 
-"/                    addLabelledInputField:(resources string:'CVSRoot:')
-"/                    adjust:#right
-"/                    on:nil 
-"/                    tabable:true
-"/                    separateAtX:0.5.
-"/    component acceptOnLeave:false.
-"/    component model:cvsRootHolder.
-
-    box 
-	addHelpButtonFor:'Launcher/sourceSettings.html';
-	addAbortAndOkButtons.
-
-    "/
-    "/ show the box ...
-    "/
-    box extent:400@300.
-    box showAtPointer.
+    rootsPerModule := Dictionary new declareAllFrom:(CVSSourceCodeManager repositoryNamesPerModule).
+
+    bindings := IdentityDictionary new.
+    bindings at:#acceptChannel put:(acceptChannel := TriggerValue new).
+
+    bindings at:#cvsRootPrototypeList put:defaultsList.
+    bindings at:#cvsRootHolder put:cvsRootHolder.
+    bindings at:#perModuleRootModule put:nil asValue.
+    bindings at:#perModuleRoot put:nil asValue.
+    bindings at:#removeEnabled put:(removeEnabled := false asValue).
+    bindings at:#listOfModules put:(listOfModules := rootsPerModule keys asList).
+    listOfModules sort.
+
+    bindings at:#selectedPerModuleRoot put:(selectedPerModuleRoot := nil asValue).
+    selectedPerModuleRoot 
+             onChangeEvaluate:[
+                            |module cvsRoot|
+
+                            acceptChannel value:true.    
+                            module := selectedPerModuleRoot value.
+                            removeEnabled value:true.
+                            cvsRoot := rootsPerModule at:module ifAbsent:''.
+                            (bindings at:#perModuleRootModule) value:module.
+                            (bindings at:#perModuleRoot) value:cvsRoot.
+             ].
+
+    bindings at:#help put:[
+                            requestor withWaitCursorDo:[
+                                HTMLDocumentView openFullOnHelpFile:'Launcher/cvsSetup.html'
+                            ]
+                          ].
+
+    bindings at:#addPerModuleRoot put:[
+                            |module cvsRoot|
+
+                            acceptChannel value:true.    
+                            module := (bindings at:#perModuleRootModule) value.
+                            cvsRoot := (bindings at:#perModuleRoot) value.
+                            (listOfModules includes:module) ifFalse:[
+                                listOfModules add:module.
+                                listOfModules sort.
+                            ].
+                            cvsRoot size > 0 ifTrue:[
+                                rootsPerModule at:module put:cvsRoot.
+                            ].
+                          ].
+    bindings at:#removePerModuleRoot put:[
+                            |module|
+
+                            acceptChannel value:true.    
+                            module := (bindings at:#perModuleRootModule) value.
+                            listOfModules remove:module ifAbsent:nil.
+                            rootsPerModule removeKey:module ifAbsent:nil.
+                            (bindings at:#perModuleRootModule) value:nil.
+                            (bindings at:#perModuleRoot) value:nil.
+                          ].
+
+    dialog := SimpleDialog new.
+    dialog resources:resources.
+    (dialog openSpec:(self cvsSetupSpec) withBindings:bindings) ifFalse:[
+        ^ self
+    ].
+
+    acceptChannel value.    
 
     "/
     "/ update system settings
     "/
-    box accepted ifTrue:[
-	CVSSourceCodeManager initializeForRepository:cvsRootHolder value
-    ].
-    box destroy
-
-    "Modified: / 16.4.1998 / 17:18:16 / ca"
-    "Modified: / 12.8.1998 / 17:09:02 / cg"
+    CVSSourceCodeManager initializeForRepository:cvsRootHolder value.
+    CVSSourceCodeManager repositoryNamesPerModule:rootsPerModule.
 !
 
 fontBoxForEncoding:encodingMatch for:requestor
@@ -5423,6 +5448,74 @@
     ].
 !
 
+old_cvsConfigurationDialogFor:requestor
+    |box y cvsRootHolder component resources defaultsList|
+
+    resources := requestor class classResources.
+
+    OperatingSystem isUNIXlike ifTrue:[
+        defaultsList := #('/files/CVS' '/CVS' 'host:/files/CVS' 'host:/CVS').
+    ] ifFalse:[
+        OperatingSystem isMSDOSlike ifTrue:[
+            defaultsList := #(':local:c:\files\CVS' ':local:c:\CVS' 'host:/files/CVS' 'host:/CVS').
+        ] ifFalse:[
+            defaultsList := #('host:/files/CVS' 'host:/CVS').
+        ]
+    ].
+
+    cvsRootHolder := CVSSourceCodeManager repositoryName ? '/files/CVS'.
+    cvsRootHolder := cvsRootHolder asValue.
+
+    "/
+    "/ create a box to input the CVSRoot ...
+    "/
+    box := DialogBox new.
+    box label:(resources string:'CVS Setup').
+
+    component := (box addTextLabel:'CVS SourceCodeManager setup').
+    component adjust:#left.
+
+    y := box yPosition.
+    component := box addTextLabel:(resources string:'CVSRoot:').
+    component width:0.25; adjust:#right; borderWidth:0.
+    box yPosition:y.
+    component := box addComboBoxOn:nil tabable:true.
+"/    commandListPop := box addInputFieldOn:printCommand tabable:true.
+    component width:0.75; left:0.25; immediateAccept:true; acceptOnLeave:false; cursorMovementWhenUpdating:#beginOfLine.
+    component list:defaultsList.
+    component model:cvsRootHolder.
+
+"/    component := box 
+"/                    addLabelledInputField:(resources string:'CVSRoot:')
+"/                    adjust:#right
+"/                    on:nil 
+"/                    tabable:true
+"/                    separateAtX:0.5.
+"/    component acceptOnLeave:false.
+"/    component model:cvsRootHolder.
+
+    box 
+        addHelpButtonFor:'Launcher/sourceSettings.html';
+        addAbortAndOkButtons.
+
+    "/
+    "/ show the box ...
+    "/
+    box extent:400@300.
+    box showAtPointer.
+
+    "/
+    "/ update system settings
+    "/
+    box accepted ifTrue:[
+        CVSSourceCodeManager initializeForRepository:cvsRootHolder value
+    ].
+    box destroy
+
+    "Modified: / 16.4.1998 / 17:18:16 / ca"
+    "Modified: / 12.8.1998 / 17:09:02 / cg"
+!
+
 syntaxColorConfigurationDialogFor:requestor
     |box frame exampleView y
      resources exampleText coloredText recolorAction
@@ -5602,6 +5695,202 @@
 
 !AbstractLauncherApplication::LauncherDialogs class methodsFor:'interface specs'!
 
+cvsSetupSpec
+    "This resource specification was automatically generated
+     by the UIPainter of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the UIPainter may not be able to read the specification."
+
+    "
+     UIPainter new openOnClass:AbstractLauncherApplication::LauncherDialogs andSelector:#cvsSetupSpec
+    "
+
+    <resource: #canvas>
+
+    ^ 
+     #(#FullSpec
+        #name: #cvsSetupSpec
+        #window: 
+       #(#WindowSpec
+          #label: 'CVS Setup'
+          #name: 'CVS Setup'
+          #min: #(#Point 436 316)
+          #max: #(#Point 1280 1024)
+          #bounds: #(#Rectangle 16 46 452 362)
+        )
+        #component: 
+       #(#SpecCollection
+          #collection: #(
+           #(#LabelSpec
+              #label: 'CVS SourceCodeManager setup'
+              #name: 'label'
+              #layout: #(#LayoutFrame 1 0.0 3 0 -1 1.0 20 0)
+              #translateLabel: true
+              #adjust: #left
+            )
+           #(#LabelSpec
+              #label: 'CVSRoot default:'
+              #name: 'defaultCvsRootLabel'
+              #layout: #(#LayoutFrame 0 0.0 31 0 40 0.25 48 0)
+              #level: 0
+              #translateLabel: true
+              #adjust: #right
+            )
+           #(#ComboBoxSpec
+              #name: 'cvsRootComboBox'
+              #layout: #(#LayoutFrame 44 0.25 31 0 -1 1.0 53 0)
+              #tabable: true
+              #model: #cvsRootHolder
+              #immediateAccept: true
+              #acceptOnLeave: true
+              #acceptOnReturn: true
+              #acceptOnTab: true
+              #acceptOnLostFocus: true
+              #acceptChannel: #acceptChannel
+              #acceptOnPointerLeave: false
+              #comboList: #cvsRootPrototypeList
+            )
+           #(#DividerSpec
+              #name: 'Separator1'
+              #layout: #(#LayoutFrame 0 0.0 56 0 0 1.0 60 0)
+            )
+           #(#LabelSpec
+              #label: 'CVSRoot per Module:'
+              #name: 'knownModulesLabel'
+              #layout: #(#LayoutFrame 0 0.0 69 0 40 0.25 86 0)
+              #translateLabel: true
+              #adjust: #right
+            )
+           #(#SequenceViewSpec
+              #name: 'List1'
+              #layout: #(#LayoutFrame 44 0.25 64 0 -1 1 162 0)
+              #tabable: true
+              #model: #selectedPerModuleRoot
+              #hasHorizontalScrollBar: true
+              #hasVerticalScrollBar: true
+              #miniScrollerHorizontal: true
+              #useIndex: false
+              #sequenceList: #listOfModules
+            )
+           #(#LabelSpec
+              #label: 'Module:'
+              #name: 'moduleLabel'
+              #layout: #(#LayoutFrame 0 0.0 169 0 40 0.25 186 0)
+              #translateLabel: true
+              #adjust: #right
+            )
+           #(#InputFieldSpec
+              #name: 'perModuleRootModuleEntryField'
+              #layout: #(#LayoutFrame 44 0.25 165 0 -20 1 187 0)
+              #tabable: true
+              #model: #perModuleRootModule
+              #acceptChannel: #acceptChannel
+              #acceptOnPointerLeave: false
+            )
+           #(#LabelSpec
+              #label: 'CVSRoot:'
+              #name: 'cvsRootLabel'
+              #layout: #(#LayoutFrame 0 0.0 196 0 40 0.25 213 0)
+              #translateLabel: true
+              #adjust: #right
+            )
+           #(#ComboBoxSpec
+              #name: 'perModuleRootComboBox'
+              #layout: #(#LayoutFrame 44 0.25 192 0 -1 1.0 214 0)
+              #tabable: true
+              #model: #perModuleRoot
+              #immediateAccept: true
+              #acceptOnLeave: true
+              #acceptOnReturn: true
+              #acceptOnTab: true
+              #acceptOnLostFocus: true
+              #acceptChannel: #acceptChannel
+              #acceptOnPointerLeave: false
+              #comboList: #cvsRootPrototypeList
+            )
+           #(#HorizontalPanelViewSpec
+              #name: 'HorizontalPanel1'
+              #layout: #(#LayoutFrame 44 0.25 218 0 -1 1 249 0)
+              #horizontalLayout: #fitSpace
+              #verticalLayout: #center
+              #horizontalSpace: 3
+              #verticalSpace: 3
+              #component: 
+             #(#SpecCollection
+                #collection: #(
+                 #(#ActionButtonSpec
+                    #label: 'Add/Apply'
+                    #name: 'addButton'
+                    #translateLabel: true
+                    #tabable: true
+                    #model: #addPerModuleRoot
+                    #extent: #(#Point 136 22)
+                  )
+                 #(#ActionButtonSpec
+                    #label: 'Remove'
+                    #name: 'removeButton'
+                    #translateLabel: true
+                    #tabable: true
+                    #model: #removePerModuleRoot
+                    #enableChannel: #removeEnabled
+                    #extent: #(#Point 137 22)
+                  )
+                 )
+               
+              )
+            )
+           #(#DividerSpec
+              #name: 'Separator2'
+              #layout: #(#LayoutFrame 0 0.0 -45 1 0 1.0 -34 1)
+            )
+           #(#HorizontalPanelViewSpec
+              #name: 'buttonPanel'
+              #layout: #(#LayoutFrame 0 0.0 -29 1.0 0 1.0 -3 1.0)
+              #horizontalLayout: #fitSpace
+              #verticalLayout: #center
+              #horizontalSpace: 3
+              #verticalSpace: 3
+              #ignoreInvisibleComponents: true
+              #reverseOrderIfOKAtLeft: true
+              #component: 
+             #(#SpecCollection
+                #collection: #(
+                 #(#ActionButtonSpec
+                    #label: 'cancel'
+                    #name: 'cancelButton'
+                    #translateLabel: true
+                    #tabable: true
+                    #model: #cancel
+                    #extent: #(#Point 141 21)
+                  )
+                 #(#ActionButtonSpec
+                    #label: 'help'
+                    #name: 'helpButton'
+                    #translateLabel: true
+                    #tabable: true
+                    #model: #help
+                    #extent: #(#Point 141 21)
+                  )
+                 #(#ActionButtonSpec
+                    #label: 'ok'
+                    #name: 'okButton'
+                    #translateLabel: true
+                    #tabable: true
+                    #model: #accept
+                    #isDefault: true
+                    #extent: #(#Point 140 21)
+                  )
+                 )
+               
+              )
+            )
+           )
+         
+        )
+      )
+!
+
 formatterDialogSpec
     "This resource specification was automatically generated
      by the UIPainter of ST/X."
@@ -5804,5 +6093,5 @@
 !AbstractLauncherApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.138 2000-12-07 07:51:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractLauncherApplication.st,v 1.139 2000-12-07 13:17:55 cg Exp $'
 ! !