#REFACTORING by exept draft
authorClaus Gittinger <cg@exept.de>
Thu, 30 Jan 2020 17:41:56 +0100
changeset 3847 f18d0b3cc419
parent 3846 94971720b6bf
child 3848 cc4d71e73e5d
#REFACTORING by exept class: FileVersionDiffBrowser added: #informationHolder removed: #infoHolder #informationUntranslated: changed: #showActivity: #updateVersionList class: FileVersionDiffBrowser class added: #openOnAllFilesMatching:changedSince:in: changed: #openOnAllFilesChangedSince:in: #openOnAllVersionsOfFile: #windowSpec #windowSpecForMultipleFiles #windowSpecForMultipleVersions
FileVersionDiffBrowser.st
--- a/FileVersionDiffBrowser.st	Wed Jan 22 16:44:15 2020 +0100
+++ b/FileVersionDiffBrowser.st	Thu Jan 30 17:41:56 2020 +0100
@@ -160,7 +160,7 @@
              uuid: '90e47868-7175-11e9-a23a-b8f6b1108e05'
              level: -1
              translateLabel: true
-             labelChannel: infoHolder
+             labelChannel: informationHolder
              adjust: left
            )
           )
@@ -313,7 +313,7 @@
              uuid: '2b3f4a44-d4fd-11e7-af82-c42c033b4871'
              level: -1
              translateLabel: true
-             labelChannel: infoHolder
+             labelChannel: informationHolder
              adjust: left
            )
           )
@@ -445,7 +445,7 @@
              uuid: '2b3f4a44-d4fd-11e7-af82-c42c033b4871'
              level: -1
              translateLabel: true
-             labelChannel: infoHolder
+             labelChannel: informationHolder
              adjust: left
            )
           )
@@ -603,29 +603,10 @@
      and the diff list is generated from the file's current version against
      the selected version in the top selection list"
 
-    |setOfFiles theBrowser filesChangedSince sinceTimestamp|
-
-    sinceTimestamp := aDateOrTimestamp asTimestamp.
-
-    setOfFiles := aSetOfFilesOrADirectoryFilename.
-    setOfFiles isFilename ifTrue:[
-        setOfFiles := setOfFiles directoryContentsAsFilenames.
-    ].
-    
-    filesChangedSince := setOfFiles 
-        select:[:fn | fn modificationTime > sinceTimestamp].
-    filesChangedSince sort:[:a :b | a name < b name].
-    
-    theBrowser := self new.
-    theBrowser allButOpenInterface:#windowSpecForMultipleFiles.
-    theBrowser beMultipleFilesVersionBrowser.
-    theBrowser fileList:filesChangedSince.
-    
-    "/ theBrowser classHolder:(ValueHolder with:aClass).
-    "/ theBrowser setupForClass:aClass againstVersion:nil.
-    theBrowser window label:(self resources string:'Versions of %1 files' with:setOfFiles size).
-    theBrowser openWindow.
-    ^ theBrowser.
+    self 
+        openOnAllFilesMatching:nil 
+        changedSince:aDateOrTimestamp 
+        in:aSetOfFilesOrADirectoryFilename
 
     "
      FileVersionDiffBrowser 
@@ -637,19 +618,65 @@
     "Modified: / 08-07-2019 / 01:36:01 / Claus Gittinger"
 !
 
-openOnAllVersionsOfFile:aFilename
+openOnAllFilesMatching:matchPatternOrNil changedSince:aDateOrTimestamp in:aSetOfFilesOrADirectoryFilename
+    "create a FileVersionDiffBrowser instance and set the list of files.
+     When a file is selected, the version list is extracted,
+     and the diff list is generated from the file's current version against
+     the selected version in the top selection list"
+
+    |setOfFiles theBrowser filesMatching filesChangedSince sinceTimestamp|
+
+    sinceTimestamp := aDateOrTimestamp asTimestamp.
+
+    setOfFiles := aSetOfFilesOrADirectoryFilename.
+    setOfFiles isFilename ifTrue:[
+        setOfFiles := setOfFiles directoryContentsAsFilenames.
+    ].
+    (matchPatternOrNil isEmptyOrNil or:[matchPatternOrNil = '*']) ifTrue:[
+        filesMatching := setOfFiles
+    ] ifFalse:[
+        filesMatching := setOfFiles select:[:fn | fn baseName matches:matchPatternOrNil].
+    ].
+    filesChangedSince := filesMatching select:[:fn | fn modificationTime > sinceTimestamp].
+    filesChangedSince sort:[:a :b | a name < b name].
+    
+    theBrowser := self new.
+    theBrowser allButOpenInterface:#windowSpecForMultipleFiles.
+    theBrowser beMultipleFilesVersionBrowser.
+    theBrowser fileList:filesChangedSince.
+    
+    "/ theBrowser classHolder:(ValueHolder with:aClass).
+    "/ theBrowser setupForClass:aClass againstVersion:nil.
+    theBrowser window label:(self resources string:'Versions of %1 files' with:filesChangedSince size).
+    theBrowser openWindow.
+    ^ theBrowser.
+
+    "
+     FileVersionDiffBrowser 
+        openOnAllFilesMatching:'*.st'
+        changedSince:(Date today - 7 days) 
+        in:('../../libbasic' asFilename files).
+    "
+
+    "Created: / 07-07-2019 / 18:58:01 / Claus Gittinger"
+    "Modified: / 08-07-2019 / 01:36:01 / Claus Gittinger"
+!
+
+openOnAllVersionsOfFile:aFilenameOrString
     "create a VersionDiffBrowser instance and set the file. 
      The diff is generated from aFilename's current version against
      the selected version in the top selection list"
 
-    |theBrowser|
+    |theBrowser fileName|
+
+    fileName := aFilenameOrString asFilename.
 
     theBrowser := self new.
     theBrowser allButOpenInterface:#windowSpecForMultipleVersions.
     theBrowser beMultipleVersionBrowser.
-    theBrowser fileHolder value:aFilename.
-    theBrowser setupForAllVersionsOfFile:aFilename.
-    theBrowser window label:(self resources string:'Versions of %1' with:aFilename baseName).
+    theBrowser fileHolder value:fileName.
+    theBrowser setupForAllVersionsOfFile:fileName.
+    theBrowser window label:(self resources string:'Versions of %1' with:fileName baseName).
     theBrowser openWindow.
     ^ theBrowser.
 
@@ -913,7 +940,7 @@
     "Created: / 07-07-2019 / 19:47:13 / Claus Gittinger"
 !
 
-infoHolder
+informationHolder
     ^ infoHolder.
 
     "Modified: / 08-05-2019 / 11:05:10 / Claus Gittinger"
@@ -1124,7 +1151,7 @@
 showActivity:someMessage
     "some activityNotification shalt be communicated to the user."
 
-    infoHolder value:someMessage.
+    self information:someMessage.
 
     "Created: / 28-05-2019 / 15:26:34 / Claus Gittinger"
 !
@@ -1270,7 +1297,7 @@
     numShown := versionList size - 1.
     newNumShown := (numShown + 50) max:30.
 
-    infoHolder value:'Getting version log...'.
+    self information:'Getting version log...'.
     partialLog := sourceCodeManager revisionLogOfFile:fn numberOfRevisions:newNumShown.
 
     partialLog isNil ifTrue:[
@@ -1549,12 +1576,6 @@
     "Modified: / 08-07-2019 / 01:24:35 / Claus Gittinger"
 !
 
-informationUntranslated:msg
-    self infoHolder value:msg
-
-    "Created: / 09-08-2018 / 15:40:52 / Claus Gittinger"
-!
-
 resetSelectionHolders
     "
     reset all selection holders when a new change set is given.