**** new version from Christian
authorClaus Gittinger <cg@exept.de>
Fri, 01 Jun 2012 10:33:29 +0200
changeset 11530 ba6b2f17e30d
parent 11529 3d943384d373
child 11531 f5f8306664d7
**** new version from Christian
PerforceSourceCodeManagementSettingsAppl.st
--- a/PerforceSourceCodeManagementSettingsAppl.st	Thu May 31 12:15:15 2012 +0200
+++ b/PerforceSourceCodeManagementSettingsAppl.st	Fri Jun 01 10:33:29 2012 +0200
@@ -9,33 +9,31 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-"{ Package: 'stx:libtool' }"
-
 AbstractSourceCodeManagementSettingsAppl subclass:#PerforceSourceCodeManagementSettingsAppl
-	instanceVariableNames:'selectedPerModuleRoot perforceExecutableHolder
-		listOfPerforceModules defaultSettingsHolder tableColumns
-		defaultSettingsPrototypeList'
-	classVariableNames:'RecentlyUsedCVSRoots RecentlyUsedStoreHosts
-		RecentlyUsedSmallTeamHosts LastStoreHost LastStoreUser
-		LastStorePassword'
-	poolDictionaries:''
-	category:'System-SourceCodeManagement'
+        instanceVariableNames:'selectedPerModuleRoot perforceExecutableHolder
+                listOfPerforceModules defaultSettingsHolder tableColumns
+                defaultSettingsPrototypeList'
+        classVariableNames:'RecentlyUsedCVSRoots RecentlyUsedStoreHosts
+                RecentlyUsedSmallTeamHosts LastStoreHost LastStoreUser
+                LastStorePassword'
+        poolDictionaries:''
+        category:'System-SourceCodeManagement'
 !
 
 ApplicationModel subclass:#ManagerPerModuleApp
-	instanceVariableNames:'moduleHolder acceptChannel settingsHolder
-		sourceCodeManagementSettingsApp acceptEnableChannel canceled
-		defaultSettingsPrototypeList'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:PerforceSourceCodeManagementSettingsAppl
+        instanceVariableNames:'moduleHolder acceptChannel settingsHolder
+                sourceCodeManagementSettingsApp acceptEnableChannel canceled
+                defaultSettingsPrototypeList'
+        classVariableNames:''
+        poolDictionaries:''
+        privateIn:PerforceSourceCodeManagementSettingsAppl
 !
 
 Object subclass:#ModuleManager
-	instanceVariableNames:'manager module settings app'
-	classVariableNames:''
-	poolDictionaries:''
-	privateIn:PerforceSourceCodeManagementSettingsAppl
+        instanceVariableNames:'manager module settings app check checkIcon'
+        classVariableNames:''
+        poolDictionaries:''
+        privateIn:PerforceSourceCodeManagementSettingsAppl
 !
 
 !PerforceSourceCodeManagementSettingsAppl class methodsFor:'documentation'!
@@ -190,7 +188,7 @@
           label: 'Source Code Manager Settings'
           name: 'Source Code Manager Settings'
           min: (Point 10 10)
-          bounds: (Rectangle 0 0 740 642)
+          bounds: (Rectangle 0 0 767 642)
         )
         component: 
        (SpecCollection
@@ -216,11 +214,19 @@
                        (CheckBoxSpec
                           label: 'Show in Browser Menus'
                           name: 'CheckBox1'
-                          layout: (LayoutFrame 0 0 5 0 0 1 27 0)
+                          layout: (LayoutFrame 0 0 5 0 -150 1 27 0)
+                          activeHelpKey: shownInBrowserMenus
                           model: shownInBrowserMenusHolder
-                                activeHelpKey: shownInBrowserMenus
                           translateLabel: true
                         )
+                       (ActionButtonSpec
+                          label: 'Check'
+                          name: 'Button6'
+                          layout: (LayoutFrame -150 1 5 0 -5 1 27 0)
+                          translateLabel: true
+                          labelChannel: checkLabel
+                          model: checkPerforceSettings
+                        )
                        (ViewSpec
                           name: 'Box3'
                           layout: (LayoutFrame 0 0 36 0 0 1 0 1)
@@ -284,7 +290,7 @@
                        )
                      
                     )
-                    extent: (Point 740 138)
+                    extent: (Point 767 138)
                   )
                  (ViewSpec
                     name: 'ManagerSetupBoxx'
@@ -327,7 +333,7 @@
                                       translateLabel: true
                                       tabable: true
                                       model: addPerModuleRoot
-                                      extent: (Point 345 22)
+                                      extent: (Point 361 22)
                                     )
                                    (ActionButtonSpec
                                       label: 'Remove'
@@ -336,7 +342,7 @@
                                       tabable: true
                                       model: removePerModuleRoot
                                       enableChannel: removeEnabled
-                                      extent: (Point 346 22)
+                                      extent: (Point 361 22)
                                     )
                                    )
                                  
@@ -349,7 +355,7 @@
                        )
                      
                     )
-                    extent: (Point 740 250)
+                    extent: (Point 767 250)
                   )
                  (FramedBoxSpec
                     label: 'Source Cache'
@@ -403,7 +409,7 @@
                                 translateLabel: true
                                 tabable: true
                                 model: flushSourceCache
-                                extent: (Point 238 22)
+                                extent: (Point 250 22)
                               )
                              (ActionButtonSpec
                                 label: 'Condense Cache now'
@@ -411,7 +417,7 @@
                                 translateLabel: true
                                 tabable: true
                                 model: condenseSourceCache
-                                extent: (Point 239 22)
+                                extent: (Point 250 22)
                               )
                              )
                            
@@ -420,7 +426,7 @@
                        )
                      
                     )
-                    extent: (Point 740 95)
+                    extent: (Point 767 95)
                   )
                  (ViewSpec
                     name: 'VerboseBox'
@@ -437,7 +443,7 @@
                        )
                      
                     )
-                    extent: (Point 740 25)
+                    extent: (Point 767 25)
                   )
                  )
                
@@ -447,8 +453,37 @@
          
         )
       )
+! !
 
-    "Modified: / 11-01-2012 / 15:39:42 / cg"
+!PerforceSourceCodeManagementSettingsAppl class methodsFor:'menu specs'!
+
+menuPerModule
+    "This resource specification was automatically generated
+     by the MenuEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the MenuEditor may not be able to read the specification."
+
+
+    "
+     MenuEditor new openOnClass:PerforceSourceCodeManagementSettingsAppl andSelector:#menuPerModule
+     (Menu new fromLiteralArrayEncoding:(PerforceSourceCodeManagementSettingsAppl menuPerModule)) startUp
+    "
+
+    <resource: #menu>
+
+    ^ 
+     #(Menu
+        (
+         (MenuItem
+            label: 'Check'
+            itemValue: checkPerforceSettings
+            translateLabel: true
+          )
+         )
+        nil
+        nil
+      )
 ! !
 
 !PerforceSourceCodeManagementSettingsAppl class methodsFor:'queries'!
@@ -471,7 +506,7 @@
      the DataSetBuilder may not be able to read the specification."
 
     "
-     DataSetBuilder new openOnClass:P4SourceCodeManagementSettingsAppl andSelector:#tableColumns
+     DataSetBuilder new openOnClass:PerforceSourceCodeManagementSettingsAppl andSelector:#tableColumns
     "
 
     <resource: #tableColumns>
@@ -481,17 +516,29 @@
          label: 'Module'
          labelButtonType: Button
          usePreferredWidth: true
+         width: 100
+         minWidth: 100
          model: module
+         menuFromApplication: false
        )
       (DataSetColumnSpec
          label: 'Settings'
          labelButtonType: Button
          editorType: InputField
          model: settings
+         menuFromApplication: false
+         isResizeable: false
+       )
+      (DataSetColumnSpec
+         label: 'Check'
+         labelButtonType: Button
+         model: check
+         menuFromApplication: false
+         doubleClickedSelector: doubleClick
          isResizeable: false
        )
       )
-
+    
 ! !
 
 !PerforceSourceCodeManagementSettingsAppl methodsFor:'actions'!
@@ -535,7 +582,6 @@
         ].
         moduleManager module:app moduleHolder value.
         moduleManager settings:app settingsHolder value.
-        moduleManager settings:app settingsHolder value.
         self listOfModules add:moduleManager.
         self updateModifiedChannel.
     ].
@@ -574,7 +620,7 @@
 !
 
 basicSaveSettings
-    |client settings repositoryInfoPerModule|
+    |client repositoryInfoPerModule|
 
     self hasManager ifTrue:[
         | nm fn|
@@ -605,13 +651,7 @@
         PerforceSourceCodeManager repositoryInfoPerModule:repositoryInfoPerModule.
         PerforceSourceCodeManager perforceExecutable:((self perforceExecutableHolder value ? '') withoutSeparators).
         client := self defaultSettingsHolder value.
-        client notNil ifTrue:[
-            settings := PerforceSourceCodeManager getPerforceSettingsFromString:client.
-            PerforceSourceCodeManager perforceClient:(settings at:#client ifAbsent:nil).
-            PerforceSourceCodeManager perforceUser:(settings at:#user ifAbsent:nil).
-            PerforceSourceCodeManager perforcePort:(settings at:#port ifAbsent:nil).
-            PerforceSourceCodeManager perforcePassword:(settings at:#password ifAbsent:nil).
-        ].
+        PerforceSourceCodeManager setDefaultPerforceSettingsFromString:client.
         PerforceSourceCodeManager verboseSourceCodeAccess:self verboseSourceCodeAccess value.
         PerforceSourceCodeManager shownInBrowserMenus:self shownInBrowserMenusHolder value. 
     ].
@@ -621,6 +661,38 @@
     "Modified: / 10-01-2012 / 00:21:59 / cg"
 !
 
+checkPerforceSettings
+
+    |result icon|
+
+    PerforceSourceCodeManager perforceError handle:[:ex|
+        self warn:ex description.
+        ^false
+    ] do:[
+        result := PerforceSourceCodeManager checkPerforceSettings:(self defaultSettingsHolder value) forPackage:nil.
+        result ifTrue:[
+            icon := GenericToolbarIconLibrary ledGreen14x14.
+        ] ifFalse:[
+            icon := GenericToolbarIconLibrary ledRed14x14.
+        ].
+        self checkLabel value:(LabelAndIcon label:'Check' icon:icon).
+    ].
+    ^false
+!
+
+condenseSourceCache
+    self withWaitCursorDo:[ AbstractSourceCodeManager condenseSourceCache ].
+    Method flushSourceStreamCache.
+
+    "Modified: / 28-11-2006 / 12:21:33 / cg"
+!
+
+flushSourceCache
+    self withWaitCursorDo:[ AbstractSourceCodeManager flushSourceCache ].
+
+    "Modified: / 30-09-2011 / 13:33:51 / cg"
+!
+
 removePerModuleRoot
 
     |module|
@@ -633,6 +705,25 @@
 
 !PerforceSourceCodeManagementSettingsAppl methodsFor:'aspects'!
 
+checkLabel
+    <resource: #uiAspect>
+
+    "automatically generated by UIPainter ..."
+
+    "*** the code below creates a default model when invoked."
+    "*** (which may not be the one you wanted)"
+    "*** Please change as required and accept it in the browser."
+    "*** (and replace this comment by something more useful ;-)"
+
+    checkLabel isNil ifTrue:[
+        checkLabel := 'Check' asValue.
+"/ if your app needs to be notified of changes, uncomment one of the lines below:
+"/       checkLabel addDependent:self.
+"/       checkLabel onChangeSend:#checkLabelChanged to:self.
+    ].
+    ^ checkLabel.
+!
+
 defaultSettingsHolder
 
     defaultSettingsHolder isNil ifTrue:[
@@ -873,9 +964,9 @@
      the UIPainter may not be able to read the specification."
 
     "
-     UIPainter new openOnClass:P4SourceCodeManagementSettingsAppl::ManagerPerModuleApp andSelector:#windowSpec
-     P4SourceCodeManagementSettingsAppl::ManagerPerModuleApp new openInterface:#windowSpec
-     P4SourceCodeManagementSettingsAppl::ManagerPerModuleApp open
+     UIPainter new openOnClass:PerforceSourceCodeManagementSettingsAppl::ManagerPerModuleApp andSelector:#windowSpec
+     PerforceSourceCodeManagementSettingsAppl::ManagerPerModuleApp new openInterface:#windowSpec
+     PerforceSourceCodeManagementSettingsAppl::ManagerPerModuleApp open
     "
 
     <resource: #canvas>
@@ -971,6 +1062,8 @@
                        (ComboBoxSpec
                           name: 'ComboBox1'
                           model: settingsHolder
+                          immediateAccept: false
+                          acceptOnLostFocus: true
                           acceptOnPointerLeave: false
                           comboList: defaultSettingsPrototypeList
                           extent: (Point 465 20)
@@ -1169,6 +1262,34 @@
     app := something.
 !
 
+check
+
+    |icon|
+
+    check isNil ifTrue:[
+        ^'unchecked'
+    ].
+    check ifTrue:[
+        icon := GenericToolbarIconLibrary ledGreen14x14.
+    ] ifFalse:[
+        icon := GenericToolbarIconLibrary ledRed14x14.
+    ].
+
+    ^icon
+!
+
+check:something
+    check := something.
+!
+
+checkIcon
+    ^ checkIcon
+!
+
+checkIcon:something
+    checkIcon := something.
+!
+
 manager
     ^ manager
 !
@@ -1196,6 +1317,19 @@
     ].
 ! !
 
+!PerforceSourceCodeManagementSettingsAppl::ModuleManager methodsFor:'actions'!
+
+doubleClick
+
+    PerforceSourceCodeManager perforceError handle:[:ex|
+        self warn:ex description.
+        check := false.
+    ] do:[
+        check := PerforceSourceCodeManager checkPerforceSettings:settings forPackage:module.
+    ].
+    self changed.
+! !
+
 !PerforceSourceCodeManagementSettingsAppl::ModuleManager methodsFor:'comparing'!
 
 < aModuleManager
@@ -1217,11 +1351,11 @@
 !PerforceSourceCodeManagementSettingsAppl class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagementSettingsAppl.st,v 1.21 2012-03-02 13:51:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagementSettingsAppl.st,v 1.22 2012-06-01 08:33:29 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagementSettingsAppl.st,v 1.21 2012-03-02 13:51:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/PerforceSourceCodeManagementSettingsAppl.st,v 1.22 2012-06-01 08:33:29 cg Exp $'
 !
 
 version_SVN