#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Fri, 24 Aug 2018 19:41:26 +0200
changeset 18353 569d5ec8a6d2
parent 18352 ee486b3355c7
child 18354 f4919fbc9baa
#FEATURE by cg class: Tools::NewSystemBrowser class definition added: #updateClassIsUpToDateFor:revision:using: changed: #updatePackageInfoForClass:
Tools__NewSystemBrowser.st
--- a/Tools__NewSystemBrowser.st	Fri Aug 24 14:01:23 2018 +0200
+++ b/Tools__NewSystemBrowser.st	Fri Aug 24 19:41:26 2018 +0200
@@ -59,7 +59,7 @@
 		ShowMethodTemplateWhenProtocolIsSelected
 		SkipCompilabilityChecksForFastCheckin SynchronousUpdate
 		ShowAboutToRewriteConfirmer AlwaysDoThisIfMethodNotInList
-		LastClassSearchPattern'
+		LastClassSearchPattern NewestRevisionPerClass'
 	poolDictionaries:''
 	category:'Interface-Browsers-New'
 !
@@ -58003,6 +58003,30 @@
     "Modified: / 09-11-2017 / 08:19:39 / cg"
 !
 
+updateClassIsUpToDateFor:aClass revision:revision using:aSourceCodeManager
+    "start a background job to fetch the newest revision nr,
+     and change the packageLabel if a newer version is in the repository"
+
+    |newestRevisionHolder|
+
+    NewestRevisionPerClass isNil ifTrue:[
+        NewestRevisionPerClass := Dictionary new.
+    ].
+    newestRevisionHolder := NewestRevisionPerClass at:aClass name ifAbsent:nil.
+    newestRevisionHolder isNil ifTrue:[
+        newestRevisionHolder := 
+            CachedValue
+                compute:[
+                    aSourceCodeManager newestRevisionOf:aClass
+                ]
+                validityDuration:15 minutes.
+        NewestRevisionPerClass at:aClass name put:newestRevisionHolder
+    ].
+    newestRevisionHolder value ~= revision ifTrue:[
+        navigationState packageLabelHolder value:(navigationState packageLabelHolder value withColor:Color red).
+    ]
+!
+
 updatePackageInfoBarIfSourceCodeManagersDoesNotMatchForClass: aClass
     "Show a warning in package info bar if configured source code manager
      does not match the source code manager for source access"
@@ -58078,6 +58102,13 @@
             aClass wasAutoloaded ifTrue:[
                 loadInfo := loadInfo , ' {Auto}'.
             ].
+            UserPreferences current immediateCheckClassVersionAgainstRepository ifTrue:[
+                (sourceCodeManager notNil and:[revision notNil]) ifTrue:[
+                    "/ start a background job to fetch the newest revision nr,
+                    "/ and change the packageLabel if a newer version is in the repository
+                    self updateClassIsUpToDateFor:aClass revision:revision using:sourceCodeManager
+                ]                
+            ]                
         ] ifFalse:[
             loadInfo := ' {Unloaded}'.
         ].