--- a/AbstractFileBrowser.st Tue Apr 26 12:32:12 2005 +0200
+++ b/AbstractFileBrowser.st Tue Apr 26 14:16:00 2005 +0200
@@ -2082,7 +2082,7 @@
!AbstractFileBrowser methodsFor:'actions'!
askForCommandFor:fileName thenDo:aBlock
- "setup and launch a querybox to ask for unix command.
+ "setup and launch a querybox to ask for a unix command.
Then evaluate aBlock passing the command-string as argument."
|box osName commandString|
@@ -2459,8 +2459,6 @@
!AbstractFileBrowser methodsFor:'aspects'!
applications
- "returns the list of registered applications
- "
^ aspects at:#applications
!
@@ -2660,13 +2658,13 @@
!AbstractFileBrowser methodsFor:'aspects handling'!
aspectFor:something ifAbsent:aBlock
- "returns the model for an aspect
- "
+ "returns the model for an aspect; these are stored in a common dictionary"
+
^ self aspectFor:something ifAbsent:aBlock notPresentDo:nil
!
aspectFor:aKey ifAbsent:aBlock notPresentDo:notPresentBlock
- "return the model for an aspect"
+ "returns the model for an aspect; these are stored in a common dictionary"
|holder saveAspectItem aspect|
@@ -2703,10 +2701,14 @@
!
aspectFor:something put:aValueHolder
+ "stores the model for an aspect; these are stored in a common dictionary"
+
aspects at:something put:aValueHolder
!
aspects
+ "returns the common aspect dictionary"
+
^ aspects
!
@@ -2855,8 +2857,7 @@
!AbstractFileBrowser methodsFor:'aspects-visibility'!
activityVisibilityChannel
- " activityVisibilityChannel switches the activity indicator on/off
- "
+ " activityVisibilityChannel switches the activity indicator on/off"
^ self aspectFor:#activityVisibilityChannel ifAbsent:[ false asValue ].
!
@@ -3196,8 +3197,6 @@
!
copyFilesToClipBoard:colOfFiles
- "defete current selected files/directories
- "
self putInClipBoard:colOfFiles as:#copy.
!
@@ -3239,34 +3238,62 @@
!AbstractFileBrowser methodsFor:'drag & drop'!
canDropFiles:dropedObjects for:filename
- | filenameDirString filenameDir|
+ |filenameDirString filenameDir|
dropedObjects isEmpty ifTrue:[^ false].
+
filenameDir := self getDirWithoutFileName:filename.
filenameDir isWritable ifFalse:[^ false].
+
filenameDirString := filenameDir asString.
dropedObjects do:[:aDropObject |
- |dropFileName dropFileNameString|
- dropFileName := aDropObject theObject.
- dropFileNameString := dropFileName asString.
- dropFileName isDirectory ifTrue:[
- (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[
- self notify:'Cannot drop a directory into one of its parent directories'.
- ^ false
- ]
- ] ifFalse:[
- | physicalPathName |
- physicalPathName := dropFileName physicalPathName.
- (filenameDirString = dropFileName directory asString
- or:[ aDropObject isFileInArchive not and:[physicalPathName notNil
- and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[
- self notify:'Cannot drop a file into same directory'.
- ^ false
- ]
+ (self canDropObject:aDropObject into:filenameDir) ifFalse:[^ false].
+"/ |dropFileName dropFileNameString physicalPathName|
+"/
+"/ dropFileName := aDropObject theObject.
+"/ dropFileNameString := dropFileName asString.
+"/ dropFileName isDirectory ifTrue:[
+"/ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[
+"/ self notify:'Cannot drop a directory into one of its parent directories'.
+"/ ^ false
+"/ ]
+"/ ] ifFalse:[
+"/ physicalPathName := dropFileName physicalPathName.
+"/ (filenameDirString = dropFileName directory asString
+"/ or:[ aDropObject isFileInArchive not and:[physicalPathName notNil
+"/ and:[ filenameDirString = physicalPathName asFilename directory asString]]]) ifTrue:[
+"/ self notify:'Cannot drop a file into same directory'.
+"/ ^ false
+"/ ]
+"/ ]
+ ].
+ self notify:nil.
+ ^ true
+!
+
+canDropObject:aDropObject into:aDirectory
+ |filenameDirString dropFileName dropFileNameString physicalPathName|
+
+ dropFileName := aDropObject theObject.
+ dropFileNameString := dropFileName asString.
+ dropFileName isDirectory ifTrue:[
+ filenameDirString := aDirectory asString.
+ (self fileName:filenameDirString startsWith:dropFileNameString) ifTrue:[
+ self notify:'Cannot drop a directory into one of its parent directories'.
+ ^ false
]
- ].
- ^ true
+ ] ifFalse:[
+ physicalPathName := dropFileName physicalPathName.
+ (aDirectory = dropFileName directory
+ or:[ aDropObject isFileInArchive not
+ and:[physicalPathName notNil
+ and:[ aDirectory = physicalPathName asFilename directory]]]) ifTrue:[
+ self notify:'Cannot drop a file into same directory'.
+ ^ false
+ ]
+ ].
+ ^ true.
!
doStartDrag:aDropSource in:aView
@@ -3302,8 +3329,6 @@
!
copyFiles:aColOfSourceFiles to:aDirectory
- "copy aColOfSourceFiles to aDirectory
- "
|copy|
self withWaitCursorDo:[
@@ -5729,7 +5754,6 @@
!AbstractFileBrowser methodsFor:'menu queries-tools'!
anySTFilesPresent
-
^ self anyFilesPresentWithSuffix:'st'
!
@@ -6044,7 +6068,6 @@
!
anyFilesPresentWithSuffix:suffix
-
|directories|
directories := self currentDirectories value.
@@ -6099,16 +6122,16 @@
!
fileName:aFilename1 startsWith:aFilename2
-
-" check if aFilename2 starts with the same directories like aFilename1 "
+ " check if aFilename2 is a prefix of aFilename1"
| file1 file2 |
- aFilename2 isNil ifTrue:[ ^ false].
- aFilename1 isNil ifTrue:[ ^ false].
+ (aFilename2 isNil or:[aFilename1 isNil]) ifTrue:[ ^ false].
file1 := aFilename1 asFilename.
file2 := aFilename2 asFilename.
+
file2 isRootDirectory ifTrue:[ ^ true].
+
((file1 isDirectory)
and:[(file2 isDirectory)
and:[file1 directory = file2 directory]]) ifTrue:[
@@ -6693,5 +6716,5 @@
!AbstractFileBrowser class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.289 2005-04-25 14:33:08 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/AbstractFileBrowser.st,v 1.290 2005-04-26 12:16:00 cg Exp $'
! !