#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Mon, 01 Jan 2018 10:58:48 +0100
changeset 17867 235d0edd6ffa
parent 17866 6a5f75df356b
child 17868 fa8c5a7bef99
#UI_ENHANCEMENT by cg class: FileBrowser changed: #fileFindDuplicates #openAboutThisApplication class: FileBrowser class changed: #toolsMenuSpec
FileBrowser.st
--- a/FileBrowser.st	Sat Dec 30 23:41:11 2017 +0100
+++ b/FileBrowser.st	Mon Jan 01 10:58:48 2018 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1991 by Claus Gittinger
               All Rights Reserved
@@ -1218,6 +1220,9 @@
             #enabled: #anySTFilesPresent
           )
          #(#MenuItem
+            #label: '-'
+          )
+         #(#MenuItem
             #label: 'Editor'
             #translateLabel: true
             #value: #openEditor
@@ -1251,10 +1256,7 @@
             #enabled: #hasJavaAndSelection
           )
          #(#MenuItem
-            #label: 'Image Inspector'
-            #translateLabel: true
-            #value: #openImageInspector
-            #enabled: #hasSelection
+            #label: '-'
           )
          #(#MenuItem
             #label: 'Image'
@@ -1313,6 +1315,9 @@
             #value: #openSlideShow
           )
          #(#MenuItem
+            #label: '-'
+          )
+         #(#MenuItem
             #label: 'File Differences...'
             #translateLabel: true
             #value: #openDiffView
@@ -2617,80 +2622,18 @@
 !
 
 fileFindDuplicates
-    "scan directory for duplicate files"
-
-    |fileNames dir infoDir filesBySize
-     result info|
+    "scan directory for duplicate files; show info in codeView"
+
+    |duplicatesDictionary info|
 
     (self askIfModified:'contents has not been saved.\\Modifications will be lost when you proceed.'
               yesButton:'Proceed') ifFalse:[^ self].
 
     self withWaitCursorDo:[
-        result := Dictionary new.
-
-        dir := currentDirectory asFilename.
-        fileNames := dir directoryContentsAsFilenames reject:[:fn | fn isDirectory ].
-
-        infoDir := Dictionary new.
-        fileNames do:[:fn |
-            infoDir at:fn put:(fn info)
-        ].
-
-        "/ for each, get the file's size.
-        "/ in a first pass, look for files of the same size and
-        "/ compare them ...
-
-        filesBySize := Dictionary new.
-        infoDir keysAndValuesDo:[:fn :info |
-            |sz entry|
-
-            sz := info size.
-            entry := filesBySize at:sz ifAbsentPut:[Set new].
-            entry add:fn.
-        ].
-
-        "/ any of same size ?
-
-        filesBySize do:[:entry |
-            |files|
-
-            entry size > 1 ifTrue:[
-                files := entry asArray.
-                1 to:files size-1 do:[:idx1 |
-                    idx1+1 to:files size do:[:idx2 |
-                        |fn1 fn2|
-
-                        fn1 := files at:idx1.
-                        fn2 := files at:idx2.
-
-                        (result at:fn2 ifAbsent:nil) ~= fn1 ifTrue:[
-                            "/ compare the files
-                            (fn1 sameContentsAs:fn2) ifTrue:[
-"/                                Transcript show:'Same: '; show:fn1 baseName; show:' and '; showCR:fn2 baseName.
-                                result at:fn1 put:fn2.
-                            ]
-                        ]
-                    ]
-                ]
-            ]
-        ].
-
-        result := result associations.
-        result := result collect:[:assoc |
-                                        |f1 f2|
-
-                                        f1 := assoc key baseName.
-                                        f2 := assoc value baseName.
-                                        f1 < f2 ifTrue:[
-                                            f2 -> f1
-                                        ] ifFalse:[
-                                            f1 -> f2
-                                        ]
-                                ].
-        result sort:[:f1 :f2 | f2 value < f1 value].
+        duplicatesDictionary := AbstractFileBrowser fileFindDuplicatesIn:{ currentDirectory asFilename }.
 
         info := OrderedCollection new.
-        result do:[:assoc |
+        duplicatesDictionary do:[:assoc |
             |fn1 fn2|
 
             fn1 := assoc key.
@@ -4475,7 +4418,9 @@
 openAboutThisApplication
     "opens an about box for this application."
 
-    Dialog aboutClass:self class.
+    Dialog 
+        aboutClass:(self class) 
+        withText:(resources stringWithCRs:'This is the original, outdated filebrowser.\More features are provided by FilebrowserV2.').
 
     "Modified: / 12-09-2006 / 17:20:41 / cg"
 !