comment/format in: #update:with:from:
authorClaus Gittinger <cg@exept.de>
Tue, 19 Apr 2011 12:42:04 +0200
changeset 9848 74fc0d845a9b
parent 9847 439880a7a123
child 9849 68ad7519769a
comment/format in: #update:with:from: changed: #addPerModuleRoot #basicReadSettings #hasUnsavedChanges #windowSpec
PerforceSourceCodeManagementSettingsAppl.st
--- a/PerforceSourceCodeManagementSettingsAppl.st	Tue Apr 19 11:54:51 2011 +0200
+++ b/PerforceSourceCodeManagementSettingsAppl.st	Tue Apr 19 12:42:04 2011 +0200
@@ -22,7 +22,7 @@
 !
 
 Object subclass:#ModuleManager
-	instanceVariableNames:'manager module settings'
+	instanceVariableNames:'manager module settings app'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:P4SourceCodeManagementSettingsAppl
@@ -74,258 +74,261 @@
 
     <resource: #canvas>
 
-    ^
+    ^ 
      #(FullSpec
-	name: windowSpec
-	window:
+        name: windowSpec
+        window: 
        (WindowSpec
-	  label: 'Source Code Manager Settings'
-	  name: 'Source Code Manager Settings'
-	  min: (Point 10 10)
-	  bounds: (Rectangle 0 0 726 653)
-	)
-	component:
+          label: 'Source Code Manager Settings'
+          name: 'Source Code Manager Settings'
+          min: (Point 10 10)
+          bounds: (Rectangle 0 0 726 653)
+        )
+        component: 
        (SpecCollection
-	  collection: (
-	   (VerticalPanelViewSpec
-	      name: 'VerticalPanel2'
-	      layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
-	      horizontalLayout: fit
-	      verticalLayout: topSpace
-	      horizontalSpace: 3
-	      verticalSpace: 20
-	      component:
-	     (SpecCollection
-		collection: (
-		 (VerticalPanelViewSpec
-		    name: 'VerticalPanel3'
-		    horizontalLayout: fit
-		    verticalLayout: top
-		    horizontalSpace: 3
-		    verticalSpace: 4
-		    component:
-		   (SpecCollection
-		      collection: (
-		       (ViewSpec
-			  name: 'Box3'
-			  component:
-			 (SpecCollection
-			    collection: (
-			     (LabelSpec
-				label: 'Perforce Command or Path:'
-				name: 'Label22'
-				layout: (LayoutFrame 0 0.0 59 0 60 0.25 81 0)
-				level: 0
-				translateLabel: true
-				adjust: right
-			      )
-			     (InputFieldSpec
-				name: 'EntryField8'
-				layout: (LayoutFrame 66 0.25 59 0 -5 1 81 0)
-				tabable: true
-				model: perforceExecutableHolder
-				acceptChannel: acceptChannel
-				acceptOnPointerLeave: true
-			      )
-			     (LabelSpec
-				label: 'Default Perforce Root'
-				name: ''
-				layout: (LayoutFrame 0 0.0 22 0 60 0.25 44 0)
-				level: 0
-				translateLabel: true
-				adjust: right
-			      )
-			     (LabelSpec
-				label: 'client:user:pass@host:port '
-				name: 'Label18'
-				layout: (LayoutFrame 4 0.0 40 0 64 0.25 55 0)
-				style: (FontDescription helvetica medium roman 10)
-				level: 0
-				translateLabel: true
-				adjust: right
-			      )
-			     (ComboBoxSpec
-				name: 'cvsRootComboBox'
-				layout: (LayoutFrame 66 0.25 28 0 -5 1 50 0)
-				tabable: true
-				model: defaultSettingsHolder
-				immediateAccept: true
-				acceptOnLeave: true
-				acceptOnReturn: true
-				acceptOnTab: true
-				acceptOnLostFocus: true
-				acceptChannel: acceptChannel
-				acceptOnPointerLeave: true
-				comboList: defaultSettingsPrototypeList
-			      )
-			     )
-
-			  )
-			  extent: (Point 726 105)
-			)
-		       (ViewSpec
-			  name: 'ManagerSetupBoxx'
-			  component:
-			 (SpecCollection
-			    collection: (
-			     (FramedBoxSpec
-				label: 'Per Module Manager Setup'
-				name: 'PerModuleManagerSetup'
-				layout: (LayoutFrame 0 0 -1 0 0 1 -3 1)
-				labelPosition: topLeft
-				translateLabel: true
-				component:
-			       (SpecCollection
-				  collection: (
-				   (DataSetSpec
-				      name: 'Table1'
-				      layout: (LayoutFrame 5 0 5 0 0 1 180 0)
-				      model: selectedPerModuleRoot
-				      hasHorizontalScrollBar: true
-				      hasVerticalScrollBar: true
-				      dataList: listOfModules
-				      useIndex: false
-				      columnHolder: tableColumns
-				    )
-				   (HorizontalPanelViewSpec
-				      name: 'HorizontalPanel11'
-				      layout: (LayoutFrame 5 0 -25 1 -1 1 0 1)
-				      horizontalLayout: fitSpace
-				      verticalLayout: center
-				      horizontalSpace: 3
-				      verticalSpace: 3
-				      component:
-				     (SpecCollection
-					collection: (
-					 (ActionButtonSpec
-					    label: 'Add/Apply'
-					    name: 'Button2'
-					    translateLabel: true
-					    tabable: true
-					    model: addPerModuleRoot
-					    extent: (Point 340 22)
-					  )
-					 (ActionButtonSpec
-					    label: 'Remove'
-					    name: 'Button3'
-					    translateLabel: true
-					    tabable: true
-					    model: removePerModuleRoot
-					    enableChannel: removeEnabled
-					    extent: (Point 341 22)
-					  )
-					 )
-
-				      )
-				    )
-				   )
-
-				)
-			      )
-			     )
-
-			  )
-			  extent: (Point 726 250)
-			)
-		       (FramedBoxSpec
-			  label: 'Source Cache'
-			  name: 'FramedBox2'
-			  labelPosition: topLeft
-			  translateLabel: true
-			  component:
-			 (SpecCollection
-			    collection: (
-			     (ViewSpec
-				name: 'Box4'
-				layout: (LayoutFrame 0 0 0 0 0 1 30 0)
-				component:
-			       (SpecCollection
-				  collection: (
-				   (LabelSpec
-				      label: 'Source Cache Dir:'
-				      name: 'Label23'
-				      layout: (LayoutFrame 0 0.0 0 0 60 0.25 22 0)
-				      translateLabel: true
-				      adjust: right
-				    )
-				   (InputFieldSpec
-				      name: 'EntryField9'
-				      layout: (LayoutFrame 64 0.25 0 0 0 1 22 0)
-				      model: sourceCacheDir
-				      immediateAccept: false
-				      acceptOnReturn: true
-				      acceptOnTab: true
-				      acceptOnLostFocus: true
-				      acceptOnPointerLeave: true
-				    )
-				   )
-
-				)
-			      )
-			     (HorizontalPanelViewSpec
-				name: 'HorizontalPanel12'
-				layout: (LayoutFrame 44 0.25 33 0 0 1 67 0)
-				horizontalLayout: fitSpace
-				verticalLayout: center
-				horizontalSpace: 3
-				verticalSpace: 3
-				component:
-			       (SpecCollection
-				  collection: (
-				   (ActionButtonSpec
-				      label: 'Flush Cache now'
-				      name: 'Button4'
-				      translateLabel: true
-				      tabable: true
-				      model: flushSourceCache
-				      extent: (Point 234 22)
-				    )
-				   (ActionButtonSpec
-				      label: 'Condense Cache now'
-				      name: 'Button5'
-				      translateLabel: true
-				      tabable: true
-				      model: condenseSourceCache
-				      extent: (Point 235 22)
-				    )
-				   )
-
-				)
-			      )
-			     )
-
-			  )
-			  extent: (Point 726 95)
-			)
-		       (ViewSpec
-			  name: 'VerboseBox'
-			  component:
-			 (SpecCollection
-			    collection: (
-			     (CheckBoxSpec
-				label: 'Verbose (Trace Access on Transcript)'
-				name: 'CheckBox6'
-				layout: (LayoutFrame 30 0 5 0 -5 1 27 0)
-				model: verboseSourceCodeAccess
-				translateLabel: true
-			      )
-			     )
-
-			  )
-			  extent: (Point 726 25)
-			)
-		       )
-
-		    )
-		    extent: (Point 726 768)
-		  )
-		 )
-
-	      )
-	    )
-	   )
-
-	)
+          collection: (
+           (VerticalPanelViewSpec
+              name: 'VerticalPanel2'
+              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
+              horizontalLayout: fit
+              verticalLayout: topSpace
+              horizontalSpace: 3
+              verticalSpace: 20
+              component: 
+             (SpecCollection
+                collection: (
+                 (VerticalPanelViewSpec
+                    name: 'VerticalPanel3'
+                    horizontalLayout: fit
+                    verticalLayout: top
+                    horizontalSpace: 3
+                    verticalSpace: 4
+                    component: 
+                   (SpecCollection
+                      collection: (
+                       (ViewSpec
+                          name: 'Box3'
+                          component: 
+                         (SpecCollection
+                            collection: (
+                             (LabelSpec
+                                label: 'Perforce Command or Path:'
+                                name: 'Label22'
+                                layout: (LayoutFrame 0 0.0 59 0 60 0.25 81 0)
+                                level: 0
+                                translateLabel: true
+                                adjust: right
+                              )
+                             (InputFieldSpec
+                                name: 'EntryField8'
+                                layout: (LayoutFrame 66 0.25 59 0 -5 1 81 0)
+                                tabable: true
+                                model: perforceExecutableHolder
+                                immediateAccept: false
+                                acceptOnLostFocus: true
+                                acceptChannel: acceptChannel
+                                acceptOnPointerLeave: true
+                              )
+                             (LabelSpec
+                                label: 'Default Perforce Root'
+                                name: ''
+                                layout: (LayoutFrame 0 0.0 22 0 60 0.25 44 0)
+                                level: 0
+                                translateLabel: true
+                                adjust: right
+                              )
+                             (LabelSpec
+                                label: 'client:user:pass@host:port '
+                                name: 'Label18'
+                                layout: (LayoutFrame 4 0.0 40 0 64 0.25 55 0)
+                                style: (FontDescription helvetica medium roman 10)
+                                level: 0
+                                translateLabel: true
+                                adjust: right
+                              )
+                             (ComboBoxSpec
+                                name: 'cvsRootComboBox'
+                                layout: (LayoutFrame 66 0.25 28 0 -5 1 50 0)
+                                tabable: true
+                                model: defaultSettingsHolder
+                                immediateAccept: true
+                                acceptOnLeave: true
+                                acceptOnReturn: true
+                                acceptOnTab: true
+                                acceptOnLostFocus: true
+                                acceptChannel: acceptChannel
+                                acceptOnPointerLeave: true
+                                comboList: defaultSettingsPrototypeList
+                              )
+                             )
+                           
+                          )
+                          extent: (Point 726 105)
+                        )
+                       (ViewSpec
+                          name: 'ManagerSetupBoxx'
+                          component: 
+                         (SpecCollection
+                            collection: (
+                             (FramedBoxSpec
+                                label: 'Per Module Manager Setup'
+                                name: 'PerModuleManagerSetup'
+                                layout: (LayoutFrame 0 0 -1 0 0 1 -3 1)
+                                labelPosition: topLeft
+                                translateLabel: true
+                                component: 
+                               (SpecCollection
+                                  collection: (
+                                   (DataSetSpec
+                                      name: 'Table1'
+                                      layout: (LayoutFrame 5 0 5 0 0 1 180 0)
+                                      model: selectedPerModuleRoot
+                                      hasHorizontalScrollBar: true
+                                      hasVerticalScrollBar: true
+                                      dataList: listOfModules
+                                      useIndex: false
+                                      columnHolder: tableColumns
+                                      beDependentOfRows: true
+                                    )
+                                   (HorizontalPanelViewSpec
+                                      name: 'HorizontalPanel11'
+                                      layout: (LayoutFrame 5 0 -25 1 -1 1 0 1)
+                                      horizontalLayout: fitSpace
+                                      verticalLayout: center
+                                      horizontalSpace: 3
+                                      verticalSpace: 3
+                                      component: 
+                                     (SpecCollection
+                                        collection: (
+                                         (ActionButtonSpec
+                                            label: 'Add/Apply'
+                                            name: 'Button2'
+                                            translateLabel: true
+                                            tabable: true
+                                            model: addPerModuleRoot
+                                            extent: (Point 340 22)
+                                          )
+                                         (ActionButtonSpec
+                                            label: 'Remove'
+                                            name: 'Button3'
+                                            translateLabel: true
+                                            tabable: true
+                                            model: removePerModuleRoot
+                                            enableChannel: removeEnabled
+                                            extent: (Point 341 22)
+                                          )
+                                         )
+                                       
+                                      )
+                                    )
+                                   )
+                                 
+                                )
+                              )
+                             )
+                           
+                          )
+                          extent: (Point 726 250)
+                        )
+                       (FramedBoxSpec
+                          label: 'Source Cache'
+                          name: 'FramedBox2'
+                          labelPosition: topLeft
+                          translateLabel: true
+                          component: 
+                         (SpecCollection
+                            collection: (
+                             (ViewSpec
+                                name: 'Box4'
+                                layout: (LayoutFrame 0 0 0 0 0 1 30 0)
+                                component: 
+                               (SpecCollection
+                                  collection: (
+                                   (LabelSpec
+                                      label: 'Source Cache Dir:'
+                                      name: 'Label23'
+                                      layout: (LayoutFrame 0 0.0 0 0 60 0.25 22 0)
+                                      translateLabel: true
+                                      adjust: right
+                                    )
+                                   (InputFieldSpec
+                                      name: 'EntryField9'
+                                      layout: (LayoutFrame 64 0.25 0 0 0 1 22 0)
+                                      model: sourceCacheDir
+                                      immediateAccept: false
+                                      acceptOnReturn: true
+                                      acceptOnTab: true
+                                      acceptOnLostFocus: true
+                                      acceptOnPointerLeave: true
+                                    )
+                                   )
+                                 
+                                )
+                              )
+                             (HorizontalPanelViewSpec
+                                name: 'HorizontalPanel12'
+                                layout: (LayoutFrame 44 0.25 33 0 0 1 67 0)
+                                horizontalLayout: fitSpace
+                                verticalLayout: center
+                                horizontalSpace: 3
+                                verticalSpace: 3
+                                component: 
+                               (SpecCollection
+                                  collection: (
+                                   (ActionButtonSpec
+                                      label: 'Flush Cache now'
+                                      name: 'Button4'
+                                      translateLabel: true
+                                      tabable: true
+                                      model: flushSourceCache
+                                      extent: (Point 234 22)
+                                    )
+                                   (ActionButtonSpec
+                                      label: 'Condense Cache now'
+                                      name: 'Button5'
+                                      translateLabel: true
+                                      tabable: true
+                                      model: condenseSourceCache
+                                      extent: (Point 235 22)
+                                    )
+                                   )
+                                 
+                                )
+                              )
+                             )
+                           
+                          )
+                          extent: (Point 726 95)
+                        )
+                       (ViewSpec
+                          name: 'VerboseBox'
+                          component: 
+                         (SpecCollection
+                            collection: (
+                             (CheckBoxSpec
+                                label: 'Verbose (Trace Access on Transcript)'
+                                name: 'CheckBox6'
+                                layout: (LayoutFrame 30 0 5 0 -5 1 27 0)
+                                model: verboseSourceCodeAccess
+                                translateLabel: true
+                              )
+                             )
+                           
+                          )
+                          extent: (Point 726 25)
+                        )
+                       )
+                     
+                    )
+                    extent: (Point 726 768)
+                  )
+                 )
+               
+              )
+            )
+           )
+         
+        )
       )
 ! !
 
@@ -396,15 +399,16 @@
 
     app := ManagerPerModuleApp openFromSourceCodeManagementSettingsApp:self.
     app canceled ifFalse:[
-	moduleManager := ModuleManager new.
-	app moduleHolder value isEmptyOrNil ifTrue:[
-	    self information:'Adding without module name not allowed'.
-	    ^ self.
-	].
-	moduleManager module:app moduleHolder value.
-	moduleManager settings:app settingsHolder value.
-	self listOfModules add:moduleManager.
-	self updateModifiedChannel.
+        moduleManager := ModuleManager newForApplication:self.
+        app moduleHolder value isEmptyOrNil ifTrue:[
+            self information:'Adding without module name not allowed'.
+            ^ self.
+        ].
+        moduleManager module:app moduleHolder value.
+        moduleManager settings:app settingsHolder value.
+        moduleManager settings:app settingsHolder value.
+        self listOfModules add:moduleManager.
+        self updateModifiedChannel.
     ].
     "Modified: / 08-11-2006 / 19:27:39 / cg"
 !
@@ -419,7 +423,7 @@
     moduleAndSettings := PerforceSourceCodeManager repositoryInfoPerModule copy.
     moduleAndSettings notEmptyOrNil ifTrue:[
         moduleAndSettings keysAndValuesDo:[:module :settings|
-            moduleManager := ModuleManager new.
+            moduleManager := ModuleManager newForApplication:self.
             moduleManager module:module.
             moduleManager settings:settings.
             self listOfModules add:moduleManager.
@@ -658,52 +662,28 @@
 update:something with:aParameter from:changedObject
     "/ common
     changedObject == sourceCacheDir ifTrue:[
-	self sourceDirChanged.
-	self updateModifiedChannel.
-	^ self
+        self sourceDirChanged.
+        self updateModifiedChannel.
+        ^ self
     ].
 
     changedObject == selectedPerModuleRoot ifTrue:[
-	self selectedPerModuleRootChanged.
-	^ self
+        self selectedPerModuleRootChanged.
+        ^ self
     ].
 
     changedObject == self listOfModules ifTrue:[
-	self updateModifiedChannel.
+        self updateModifiedChannel.
     ].
 
     changedObject == defaultSettingsHolder ifTrue:[
-	self updateModifiedChannel.
+        self updateModifiedChannel.
     ].
 
 
     super update:something with:aParameter from:changedObject
 
     "Modified: / 09-11-2006 / 14:41:10 / cg"
-!
-
-updateConnectEnableHolders
-
-
-    |userPassAndHost sel|
-
-    userPassAndHost := self getStoreElementsFromSettingsString:self defaultSettingsHolder value.
-    self storeConnectEnabled
-	value:(userPassAndHost first notEmptyOrNil
-	       and:[ userPassAndHost second notEmptyOrNil
-	       and:[ userPassAndHost third notEmptyOrNil ]]).
-
-    sel := self selectedPerModuleRoot value.
-    sel notEmptyOrNil ifTrue:[
-	(sel managerClass = StoreSourceCodeManager) ifTrue:[
-	    userPassAndHost := self getStoreElementsFromSettingsString:sel settings.
-	    self storeConnectInModuleEnabled
-		value:(userPassAndHost first notEmptyOrNil
-		       and:[ userPassAndHost second notEmptyOrNil
-		       and:[ userPassAndHost third notEmptyOrNil ]]).
-	    ^ self.
-	].
-    ].
 ! !
 
 !P4SourceCodeManagementSettingsAppl methodsFor:'help'!
@@ -770,7 +750,9 @@
         ((PerforceSourceCodeManager repositoryInfoPerModule includesKey:module) and:[(PerforceSourceCodeManager repositoryInfoPerModule at:module) = info])
         ifFalse:[^ true].
     ].
-
+    self perforceExecutableHolder value ~= PerforceSourceCodeManager perforceExecutable ifTrue:[
+        ^true
+    ].
     ^ false
 
     "Modified: / 19-04-2011 / 10:54:31 / cg"
@@ -1085,8 +1067,26 @@
     ^ super postOpenWith:aBuilder
 ! !
 
+!P4SourceCodeManagementSettingsAppl::ModuleManager class methodsFor:'instance creation'!
+
+newForApplication:anApplication
+    |instance|
+
+    instance := self new.
+    instance app:anApplication.
+    ^instance
+! !
+
 !P4SourceCodeManagementSettingsAppl::ModuleManager methodsFor:'accessing'!
 
+app
+    ^ app
+!
+
+app:something
+    app := something.
+!
+
 manager
     ^ manager
 !
@@ -1109,6 +1109,9 @@
 
 settings:something
     settings := something.
+    app notNil ifTrue:[
+        app listOfModules changed.
+    ].
 ! !
 
 !P4SourceCodeManagementSettingsAppl::ModuleManager methodsFor:'comparing'!
@@ -1132,5 +1135,5 @@
 !P4SourceCodeManagementSettingsAppl class methodsFor:'documentation'!
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagementSettingsAppl.st,v 1.2 2011-04-19 09:08:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagementSettingsAppl.st,v 1.3 2011-04-19 10:42:04 cg Exp $'
 ! !