Tools_ProjectList.st
changeset 10249 219f8553b31b
parent 9467 5010291ffd71
child 10364 934e0840d81e
--- a/Tools_ProjectList.st	Thu Jul 07 15:38:31 2011 +0200
+++ b/Tools_ProjectList.st	Thu Jul 07 15:38:48 2011 +0200
@@ -14,7 +14,8 @@
 "{ NameSpace: Tools }"
 
 BrowserList subclass:#ProjectList
-	instanceVariableNames:'projectList projectNameList selectionIndexHolder'
+	instanceVariableNames:'projectList projectNameList selectionIndexHolder worker
+		workerQueue'
 	classVariableNames:'AdditionalEmptyProjects HideModules'
 	poolDictionaries:''
 	category:'Interface-Browsers-New'
@@ -582,6 +583,16 @@
     "Modified: / 10-11-2006 / 17:15:15 / cg"
 ! !
 
+!ProjectList methodsFor:'initialization'!
+
+initialize
+
+    super initialize.
+    workerQueue := SharedQueue new
+
+    "Created: / 14-12-2010 / 15:41:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ProjectList methodsFor:'private'!
 
 allShownProjects
@@ -721,6 +732,33 @@
     ChangeSet removeDependent:self.
 !
 
+markEntry: rawEntry at: index forBeingManagedBySVN: package
+
+    | branch mark |    
+    self hasSubversionSupport ifFalse:[^rawEntry].
+    package = PackageId noProjectID ifTrue:[^rawEntry].
+
+    ^rawEntry.
+
+    workerQueue nextPut:
+        [
+        | repo newEntry |
+        repo := (Smalltalk at:#SVN::RepositoryManager) current 
+                    repositoryForPackage: package onlyFromCache: false.
+        repo ifNotNil:[
+            mark := ' [SVN]'.
+            branch := repo workingCopy branchOrNil.
+            branch ifNotNil:[mark := ' [SVN: ', branch path,']'].
+            newEntry := rawEntry , (mark asText colorizeAllWith: Color gray).
+            self projectNameList value at: index put: newEntry.
+            self projectNameList changed.
+        ]].
+    ^rawEntry
+
+    "Created: / 14-12-2010 / 15:59:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 17-12-2010 / 11:52:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 nameListFor:aProjectList
     "
      self basicNew
@@ -787,18 +825,25 @@
                 rawEntry := (thisC copyFrom:prefix size+1) asStringWith:$/.
             ].
 
+
             (packagesInChangeSet includes:this) ifTrue:[
                 rawEntry := rawEntry , self class markForBeingInChangeList.
                 rawEntry := self colorizeForChangedCode:rawEntry.
             ].
             entry := (String new:indent) , rawEntry.
+            (self hasSubversionSupport and:[this first ~= $*]) ifTrue:[
+                entry := self markEntry: entry at: projectNameList size + 1
+                                 forBeingManagedBySVN: this.
+            ].
         ].
         projectNameList add:entry.
     ].
+    self startWorker.        
     ^ projectNameList.
 
     "Created: / 17-02-2000 / 23:43:05 / cg"
     "Modified: / 16-01-2007 / 15:51:45 / cg"
+    "Modified: / 16-12-2010 / 17:29:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 release
@@ -807,6 +852,22 @@
     projectList removeDependent:self.
 !
 
+startWorker
+
+    worker ifNil:
+        [worker := 
+            [[workerQueue notEmpty ] whileTrue:
+                [| job |
+                job := workerQueue next.
+                job value].
+            worker := nil.
+            ] newProcess.
+        worker resume].
+
+    "Created: / 14-12-2010 / 15:49:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 16-12-2010 / 17:35:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 updateList
     |newList oldList newNameList oldNameList oldSelection newSelection selectedProjectsHolder|
 
@@ -868,10 +929,6 @@
 
 !ProjectList class methodsFor:'documentation'!
 
-version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_ProjectList.st,v 1.45 2010-05-07 12:27:36 cg Exp $'
-!
-
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools_ProjectList.st,v 1.45 2010-05-07 12:27:36 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools_ProjectList.st,v 1.46 2011-07-07 13:38:48 vrany Exp $'
 ! !