AbstractFileBrowser.st
branchjv
changeset 12807 ba8c5416aa28
parent 12626 7ae48abfedac
parent 12777 0221a2b95d8c
child 12819 0ce340e972c4
--- a/AbstractFileBrowser.st	Tue May 28 22:46:27 2013 +0100
+++ b/AbstractFileBrowser.st	Fri May 31 00:35:44 2013 +0100
@@ -98,7 +98,6 @@
 "
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'accessing'!
 
 currentSelection
@@ -147,7 +146,6 @@
     RootHolder := aRoot
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'accessing-bookmarks'!
 
 addBookmark:aDirectoryPath
@@ -306,7 +304,6 @@
     self saveBookmarksIn:(self defaultBookMarksFileDirectory construct:self defaultBookMarksFilename)
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'accessing-classes'!
 
 directoryHistoryClass
@@ -315,7 +312,6 @@
     "Modified: / 21-11-2012 / 08:46:34 / cg"
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'defaults'!
 
 commandHistory
@@ -340,15 +336,17 @@
     DefaultFilters isNil ifTrue:[
         DefaultFilters := #(        '*'
                                     '*.st' 
-                                    '*.htm*' 
-                                    '*.txt' 
-                                    '*.gif' 
-                                    '*.xpm' 
-                                    '*.jpg' 
                                     '*.[h,c]*' 
+                                    '*.txt; *.htm*' 
+                                    '*.gif; *.xpm; *.jpg; *.png' 
+                                    '~*o; ~*.obj; ~*.dll;' 
                                 )
     ].
     ^ DefaultFilters.
+
+    "
+     DefaultFilters := nil
+    "
 !
 
 initialCommandFor:fileName in:aDirectory intoBox:aBox
@@ -565,7 +563,6 @@
     "Modified: / 11-05-2012 / 09:22:04 / cg"
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'help specs'!
 
 basicFlyByHelpSpec
@@ -720,7 +717,6 @@
     "Modified: / 03-11-2007 / 12:05:01 / cg"
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'image specs'!
 
 clearHistoryIcon
@@ -932,7 +928,6 @@
     ^ ToolbarIconLibrary shell20x20Icon
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'interface specs'!
 
 encodingDialogSpec
@@ -1282,7 +1277,6 @@
     "Modified: / 28-02-2012 / 11:12:38 / cg"
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'menu specs'!
 
 baseBookmarksMenuSpec
@@ -2594,7 +2588,6 @@
       )
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'menu specs-scm'!
 
 cvsMenu
@@ -2772,21 +2765,18 @@
     "Created: / 15-01-2012 / 13:12:30 / cg"
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'misc'!
 
 newLock
     ^ CodeExecutionLock new
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'resources'!
 
 classResources
     ^ FileBrowser classResources
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'utilities'!
 
 contentsOfBytesAsHexDump:data numberOfAddressDigits:addrDigits addressStart:virtualStart
@@ -2955,7 +2945,6 @@
     "Modified: / 13-02-2012 / 15:01:19 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'actions'!
 
 askForCommandFor:fileName thenDo:aBlock
@@ -3307,7 +3296,6 @@
     ]
 ! !
 
-
 !AbstractFileBrowser methodsFor:'actions bookmarks'!
 
 addBookmark
@@ -3353,7 +3341,6 @@
      self class saveBookmarks
 ! !
 
-
 !AbstractFileBrowser methodsFor:'actions history'!
 
 addToCommandHistory:aCommandString for:aFilename
@@ -3406,7 +3393,6 @@
     ].
 ! !
 
-
 !AbstractFileBrowser methodsFor:'applications'!
 
 applicationNamed:anApplicationName ifPresentDo:aBlock
@@ -3423,7 +3409,6 @@
     ^ self applications at:#DirectoryContentsBrowser ifAbsent:nil.
 ! !
 
-
 !AbstractFileBrowser methodsFor:'aspects'!
 
 applications
@@ -3780,7 +3765,6 @@
     self aspectFor:#rootHolder put:aHolder
 ! !
 
-
 !AbstractFileBrowser methodsFor:'aspects handling'!
 
 aspectFor:something ifAbsent:aBlock
@@ -3890,7 +3874,6 @@
     "Modified: / 14-10-2010 / 19:16:38 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'aspects-filter'!
 
 filter:aString
@@ -3932,39 +3915,62 @@
     "return a two-arg filterblock on the files path- and base-name. This block should return true for files
      to be shown"
 
-    | filterString filterStrings filters showHidden yesOrNo filterBlock ignoreCase|
+    | filterString filterStrings filters notFilters showHidden filterBlock ignoreCase|
 
     filterString := self filterModel value.
     filterString = '' ifTrue:[filterString := '*'].
     ignoreCase := "ignoreCaseInPattern ? "(Filename isCaseSensitive not).
 
     filterStrings := filterString asCollectionOfSubstringsSeparatedBy:$;.
+    filterStrings := filterStrings
+                select:[:eachFilter | eachFilter withoutSeparators notEmpty].
+
     filters := filterStrings
-                collect:[:eachPattern |
+                reject:[:eachFilter | eachFilter withoutSeparators startsWith:'~']
+                thenCollect:
+                    [:eachPattern |
                         |pattern|
 
                         pattern := eachPattern withoutSeparators.
-                        yesOrNo := true.
-                        (pattern startsWith:'~') ifTrue:[
-                            yesOrNo := false.
-                            pattern := pattern copyFrom:2.
-                        ].
                         "JV@2012-03-05: Add implict star at the beggining and at the end of pattern,
                          that's how most of the other applications behave - do what most users expect"
                         pattern first == $* ifFalse:[pattern := '*' , pattern].
                         pattern last  == $* ifFalse:[pattern := pattern , '*'].
 
-                        yesOrNo ifTrue:[
-                            [:name :baseName | pattern match:baseName ignoreCase:ignoreCase]
-                        ] ifFalse:[
-                            [:name :baseName | (pattern match:baseName ignoreCase:ignoreCase) not]
-                        ].
+                        [:name :baseName | pattern match:baseName ignoreCase:ignoreCase]
                     ].
 
-    filters size == 1 ifTrue:[ 
+    notFilters := filterStrings
+                select:[:eachFilter | eachFilter withoutSeparators startsWith:'~']
+                thenCollect:
+                    [:eachPattern |
+                        |pattern|
+
+                        pattern := eachPattern withoutSeparators.
+                        pattern := (pattern copyFrom:2) withoutSeparators.
+                        [:name :baseName | pattern match:baseName ignoreCase:ignoreCase]
+                    ].
+
+
+    (filters size == 1 and:[notFilters isEmpty]) ifTrue:[ 
         filterBlock := filters first 
     ] ifFalse:[
-        filterBlock := [:name :baseName | filters contains:[:aFilter | aFilter value:name value:baseName ]].
+        filters isEmpty ifTrue:[
+            filterBlock := [:name :baseName | 
+                               (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not
+                           ].
+        ] ifFalse:[
+            notFilters isEmpty ifTrue:[
+                filterBlock := [:name :baseName | 
+                                   (filters contains:[:aFilter | aFilter value:name value:baseName ])
+                               ].
+            ] ifFalse:[
+                filterBlock := [:name :baseName | 
+                                   (filters contains:[:aFilter | aFilter value:name value:baseName ])
+                                   and:[ (notFilters contains:[:aFilter | aFilter value:name value:baseName ]) not ]
+                               ].
+            ]
+        ]
     ].
 
     showHidden := self showHiddenFiles value.
@@ -3982,7 +3988,6 @@
     ^ self aspectFor:#shownFiles ifAbsent:['-/-' asValue]
 ! !
 
-
 !AbstractFileBrowser methodsFor:'aspects-history'!
 
 dirHistory
@@ -4013,7 +4018,6 @@
     ^ self aspectFor:#fileHistory ifAbsent:[OrderedSet new]
 ! !
 
-
 !AbstractFileBrowser methodsFor:'aspects-visibility'!
 
 activityVisibilityChannel
@@ -4243,7 +4247,6 @@
     ^ self directoryContentsBrowser viewType
 ! !
 
-
 !AbstractFileBrowser methodsFor:'background processing'!
 
 executeCommand:cmd
@@ -4326,7 +4329,6 @@
     process resume.
 ! !
 
-
 !AbstractFileBrowser methodsFor:'change & update'!
 
 currentFileNameHolderChanged
@@ -4454,7 +4456,6 @@
     self updateCurrentDirectory
 ! !
 
-
 !AbstractFileBrowser methodsFor:'clipboard'!
 
 canPaste
@@ -4506,7 +4507,6 @@
     self canPaste value:true.
 ! !
 
-
 !AbstractFileBrowser methodsFor:'drag & drop'!
 
 canDropFiles:dropedObjects for:filename 
@@ -4638,7 +4638,6 @@
     "Created: / 13-10-2006 / 18:26:41 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'file operations'!
 
 copyFile:aSourceFile to:aDestFile
@@ -5152,7 +5151,6 @@
     "Modified: / 04-12-2006 / 13:15:24 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu accessing'!
 
 bookmarksMenu
@@ -5387,7 +5385,6 @@
     "Modified: / 09-09-2012 / 13:07:45 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu actions'!
 
 doCompareTwoFiles
@@ -5478,7 +5475,6 @@
     "Created: / 29-12-2010 / 11:03:00 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu actions-file'!
 
 copyFiles
@@ -5525,7 +5521,6 @@
     ].
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu actions-help'!
 
 openAboutThisApplication
@@ -5538,9 +5533,18 @@
     HTMLDocumentView openFullOnDocumentationFile:relativeDocPath
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu actions-scm-cvs'!
 
+commitFilesToCVS:files
+    |numFiles|
+
+    (numFiles := files size) > 0 ifTrue:[
+        self withActivityIndicationDo:[
+            self cvsCommitFiles:files
+        ]
+    ]
+!
+
 cvsAddAndCommit
     self cvsAddAndCommitAsBinary:false
 !
@@ -5606,16 +5610,23 @@
 !
 
 cvsCommit
-    |nSel log logArg msg cmd selectedFiles sel executionBlock nameString|
+    |selectedFiles|
 
     selectedFiles:= self currentSelectedFiles.
-    nSel := selectedFiles size.
-
-    nSel == 1 ifTrue:[
-        msg := resources string:'Enter log message for checkIn of "%1"' with:(selectedFiles first baseName)
+    self cvsCommitFiles:selectedFiles
+!
+
+cvsCommitFiles:files
+    |nFiles log logTmp s logArg msg executionBlock nameString |
+
+    nFiles := files size.
+    nFiles == 0 ifTrue:[^ self].
+
+    nFiles == 1 ifTrue:[
+        msg := resources string:'Enter log message for checkIn of "%1"' with:(files first baseName)
     ] ifFalse:[
-        nSel > 1 ifTrue:[
-            msg := resources string:'Enter log message for %1 files to checkIn' with:nSel printString
+        nFiles > 1 ifTrue:[
+            msg := resources string:'Enter log message for %1 files to checkIn' with:nFiles printString
         ] ifFalse:[
             msg := resources string:'Enter log message for checkIn'
         ]
@@ -5628,34 +5639,37 @@
         initialAnswer:nil.
 
     log isNil ifTrue:[^ self].
+    log := log replChar:$"  withString:'\"'.
 
     OperatingSystem isMSWINDOWSlike ifTrue:[
-        logArg := '-m "' , log , '"'.
+        "/ save the log message into another tempFile ...
+        logTmp := Filename newTemporary.
+        s := logTmp writeStream.
+        s nextPutAll:log.
+        s close.
+
+        logArg := '-F "', logTmp pathName, '"'.
     ] ifFalse:[
         logArg := '-m ''' , log , ''''.
     ].
 
-    sel := self currentSelectedObjects.
-    sel isEmpty ifTrue:[ ^ self ].
-
     executionBlock := [:stream |
-        log notNil ifTrue:[
-            sel size > 0 ifTrue:[
-                sel do:[:fn |
-                    | dir nameArg |
-
-                    nameArg := '"',fn baseName,'"'.
-                    dir := fn directory.
-                    cmd := 'cvs commit ',logArg,' ' , nameArg.
-                    (self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream.
-                ]
+        [
+            files do:[:fn |
+                | dir nameArg cmd |
+
+                nameArg := '"',fn baseName,'"'.
+                dir := fn directory.
+                cmd := 'cvs commit ',logArg,' ' , nameArg.
+stream showCR:fn pathName.
+                (self getExecutionBlockForCommand:cmd inDirectory:dir) value:stream.
             ] 
-        ]
+        ] ensure:[
+            logTmp notNil ifTrue:[ logTmp remove ].
+        ].
     ].
     nameString := 'Command> cvs commit'.
     self makeExecutionResultProcessFor:executionBlock withName:nameString.
-
-    "Modified: / 04-12-2006 / 13:16:39 / cg"
 !
 
 cvsCompareWithNewest
@@ -5866,7 +5880,6 @@
     ]
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu actions-scm-mercurial'!
 
 mercurialAdd
@@ -6016,7 +6029,6 @@
     "Created: / 15-01-2012 / 19:43:08 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu actions-tools'!
 
 allFilesInSelectedDirectoriesForWhich:aBlock
@@ -6553,12 +6565,12 @@
         path := dir baseName , '/' , path.
         dir := dir directory.
         dir isNil ifTrue:[
-            Dialog warning:'Could not find a path from "stx" to the current directory.'.
+            Dialog warn:'Could not find a path from "stx" to the current directory.'.
             "/ should ask the user for a packageID and proceed...
             ^  self.
         ].
     ].
-    packageID := path copyWithoutLast:1.
+    packageID := path copyButLast:1.
     Smalltalk loadPackage:packageID fromDirectory:packageDir asAutoloaded:true
 !
 
@@ -7982,7 +7994,7 @@
         |sig msg label labels values action proceedValue isRedef redefKind|
 
         isRedef := false.
-        sig := ex signal.
+        sig := ex creator.
         (dontAskSignals notNil and:[dontAskSignals includesKey:sig]) ifTrue:[
             action := #continue    
         ] ifFalse:[
@@ -8176,7 +8188,6 @@
     "Modified: / 04-12-2006 / 13:15:28 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu queries-cvs'!
 
 canCvsAddAndCommit
@@ -8198,7 +8209,6 @@
         ].
 ! !
 
-
 !AbstractFileBrowser methodsFor:'menu queries-tools'!
 
 anySTFilesOrDirectoriesPresent
@@ -8388,7 +8398,6 @@
     ^ false
 ! !
 
-
 !AbstractFileBrowser methodsFor:'presentation'!
 
 getModeString:modeBits
@@ -8428,7 +8437,6 @@
     ^ modeString
 ! !
 
-
 !AbstractFileBrowser methodsFor:'private'!
 
 theSingleSelectedDirectoryOrHomeDir
@@ -8447,7 +8455,6 @@
     ^ dirs anElement.
 ! !
 
-
 !AbstractFileBrowser methodsFor:'queries'!
 
 cBrowserLoaded
@@ -8600,7 +8607,6 @@
     ^ OperatingSystem isUNIXlike
 ! !
 
-
 !AbstractFileBrowser methodsFor:'queries-file'!
 
 allItemsOfCurrentDirectory
@@ -8801,7 +8807,6 @@
     ^ self recursiveAnyFilesPresentWithSuffix:'st'
 ! !
 
-
 !AbstractFileBrowser methodsFor:'selection'!
 
 currentSelectedDirectories
@@ -8855,7 +8860,6 @@
     "Modified: / 04-12-2006 / 13:15:04 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'sorting'!
 
 currentSortOrder
@@ -8938,7 +8942,6 @@
     "Modified: / 18-09-2007 / 09:42:47 / cg"
 ! !
 
-
 !AbstractFileBrowser methodsFor:'startup & release'!
 
 makeDependent
@@ -8980,7 +8983,6 @@
     "Modified: / 25-07-2006 / 09:12:45 / cg"
 ! !
 
-
 !AbstractFileBrowser::Clipboard methodsFor:'accessing'!
 
 files
@@ -9007,7 +9009,6 @@
     method := something.
 ! !
 
-
 !AbstractFileBrowser::CodeExecutionLock methodsFor:'accessing'!
 
 locked
@@ -9019,7 +9020,6 @@
     ^ locked
 ! !
 
-
 !AbstractFileBrowser::CodeExecutionLock methodsFor:'actions'!
 
 doIfUnLocked:aBlock
@@ -9037,21 +9037,18 @@
     ]
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory class methodsFor:'defaults'!
 
 defaultHistorySize
     ^ 50
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory class methodsFor:'instance creation'!
 
 new
     ^ (super new) initializeHistory.
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory methodsFor:'accessing'!
 
 historySize
@@ -9063,7 +9060,6 @@
     historySize := aNumber
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory methodsFor:'actions'!
 
 addToHistory:aPath
@@ -9072,7 +9068,7 @@
     pathToAdd := aPath.
     (pathToAdd endsWith:(Filename separator)) ifTrue:[
         pathToAdd asFilename isRootDirectory ifFalse:[
-            pathToAdd := pathToAdd copyWithoutLast:(Filename separator asString size).    
+            pathToAdd := pathToAdd copyButLast:(Filename separator asString size).    
         ]    
     ].
 
@@ -9157,7 +9153,6 @@
     ].
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory methodsFor:'initialization'!
 
 initializeHistory
@@ -9169,7 +9164,6 @@
     backForwardIndex := backForwardList size.
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory methodsFor:'queries'!
 
 canBackward
@@ -9255,7 +9249,6 @@
     ^ retPath.
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem class methodsFor:'instance creation'!
 
 path:aPath
@@ -9263,7 +9256,6 @@
     ^ self new path:aPath
 ! !
 
-
 !AbstractFileBrowser::DirectoryHistory::DirectoryHistoryItem methodsFor:'accessing'!
 
 asFilename
@@ -9299,7 +9291,6 @@
     ^ self path asString
 ! !
 
-
 !AbstractFileBrowser::SaveAspectItem class methodsFor:'instance creation'!
 
 withValue:aValue isHolder:aBoolean
@@ -9312,7 +9303,6 @@
     ^ instance
 ! !
 
-
 !AbstractFileBrowser::SaveAspectItem methodsFor:'accessing'!
 
 isHolder
@@ -9339,15 +9329,14 @@
     value := something.
 ! !
 
-
 !AbstractFileBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.517 2013-03-31 20:12:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.521 2013-05-28 10:34:21 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.517 2013-03-31 20:12:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.521 2013-05-28 10:34:21 cg Exp $'
 !
 
 version_HG