#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Tue, 21 Jun 2016 10:26:33 +0200
changeset 16711 bcaef4ee8e9a
parent 16710 3db036345074
child 16712 a083596f33f2
child 16713 6fc5c0d48f98
#UI_ENHANCEMENT by cg class: VersionDiffBrowser changed: #updateLabels
VersionDiffBrowser.st
--- a/VersionDiffBrowser.st	Tue Jun 21 10:20:57 2016 +0200
+++ b/VersionDiffBrowser.st	Tue Jun 21 10:26:33 2016 +0200
@@ -2298,32 +2298,34 @@
     "update the labels of the diff text view. Show the version numbers
      of the class."
 
-    |theVersionA theVersionB builder revInfo labelA labelB date author|
-
+    |theVersionA theVersionB builder makeLabel|
+
+    makeLabel :=
+        [:theVersion |
+            |label date author revInfo|
+            
+            label := theVersion.
+            versionInfoList notNil ifTrue:[
+                revInfo := versionInfoList detect:[:info | (info at:#revision) = theVersion] ifNone:nil.
+                revInfo notNil ifTrue:[
+                    date := (Timestamp readGeneralizedFrom:(revInfo at:#date)) asDate.
+                    author := (revInfo at:#author) ? '?'.
+                    label := theVersion , ' [',date printString,' by ',author,']'.
+                ].
+            ].
+            label
+        ].
+        
     builder := self builder.
     (theVersionA := self versionA) notNil ifTrue:[
-        labelA := theVersionA.
-        revInfo := versionInfoList detect:[:info | (info at:#revision) = theVersionA value] ifNone:nil.
-        revInfo notNil ifTrue:[
-            date := (Timestamp readGeneralizedFrom:(revInfo at:#date)) asDate.
-            author := (revInfo at:#author) ? '?'.
-            labelA := theVersionA , ' [',date printString,' by ',author,']'.
-        ].
-        self diffTextLabelA value:labelA.
+        self diffTextLabelA value:(makeLabel value:theVersionA).
         self onlyInALabelHolder value:('Only in ' , theVersionA).
         (self componentAt:#OnlyInALabel)
             foregroundColor:Color white;
             backgroundColor:Color green darkened.
     ].
     (theVersionB :=self versionB) notNil ifTrue:[
-        labelB := theVersionB.
-        revInfo := versionInfoList detect:[:info | (info at:#revision) = theVersionB value] ifNone:nil.
-        revInfo notNil ifTrue:[
-            date := (Timestamp readGeneralizedFrom:(revInfo at:#date)) asDate.
-            author := (revInfo at:#author) ? '?'.
-            labelA := theVersionB , ' [',date printString,' by ',author,']'.
-        ].
-        self diffTextLabelB value:labelB.
+        self diffTextLabelB value:(makeLabel value:theVersionB).
         self onlyInBLabelHolder value:('Only in ' , theVersionB).
         (self componentAt:#OnlyInBLabel)
             foregroundColor:Color white;