# HG changeset patch # User Claus Gittinger # Date 1031154894 -7200 # Node ID 01d75eba33716c8799b9153ca8ff81d1b24b2a81 # Parent bfe92816d90c0046cc8c792b97e4cff5d1e89773 *** empty log message *** diff -r bfe92816d90c -r 01d75eba3371 Move.st --- a/Move.st Wed Sep 04 17:38:55 2002 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ -"{ Package: 'stx:libtool2' }" - -FileOperations subclass:#Move - instanceVariableNames:'colOfMovedFiles' - classVariableNames:'' - poolDictionaries:'' - category:'Interface-Support' -! - - -!Move class methodsFor:'actions'! - -moveFile:aSourceFile to:aDestFile - "delete current selected files/directories - " - - |instance| - - instance := self new. - instance moveFile:aSourceFile to:aDestFile. - ^ instance -! - -moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning - "delete current selected files/directories - " - - |instance| - - instance := self new. - instance moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning. - ^ instance -! - -moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:move - "delete current selected files/directories - " - - |instance| - - instance := self new. - instance moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:move. - ^ instance -! - -moveFiles:aColOfSourceFiles to:aDirectory - "delete current selected files/directories - " - - |instance| - - instance := self new. - instance moveFiles:aColOfSourceFiles to:aDirectory. - ^ instance -! - -moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning - "delete current selected files/directories - " - - |instance| - - instance := self new. - instance moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning. - ^ instance -! - -moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move - "delete current selected files/directories - " - - |instance| - - instance := self new. - instance moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move. - ^ instance -! ! - -!Move methodsFor:'accessing'! - -colOfMovedFiles - "return the value of the instance variable 'colOfMovedFiles' (automatically generated)" - - colOfMovedFiles isNil ifTrue:[ - colOfMovedFiles := OrderedCollection new. - ]. - ^ colOfMovedFiles -! ! - -!Move methodsFor:'actions'! - -moveFile:aSourceFile to:aDestFile - - ^ self moveFile:aSourceFile to:aDestFile withOverWriteWarning:true. -! - -moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning - - ^ self moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:true -! - -moveFile:aSourceFile to:aDestFile withOverWriteWarning:overWriteWarning moveFileIfSame:move - - |newFile fileString targetDirectory targetIsDirectory suffix| - - targetIsDirectory := aDestFile isDirectory. - targetIsDirectory ifTrue:[ - targetDirectory := aDestFile. - newFile := aDestFile construct:(aSourceFile baseName). - ] ifFalse:[ - targetDirectory := aDestFile directory. - newFile := aDestFile. - ]. - "/ do not copy if destination directory doest exist. - (targetDirectory exists not) ifTrue:[ - DialogBox warn:'cant move to not existing directory ', targetDirectory asString. - result := false. - ^ self - ]. - (newFile exists) ifTrue:[ - ((newFile asString = aSourceFile asString) and:[move]) ifTrue:[ - [newFile exists] whileTrue:[ - suffix := newFile suffix. - fileString := newFile baseName withoutSuffix, self class copyMoveIfExistSuffixString, '.', suffix. - newFile := targetDirectory construct:fileString. - ]. - ] ifFalse:[ - overWriteWarning ifTrue:[ - (self fileExistDialogFor:newFile) ifFalse:[ - result := false. - ^ self. - ] - ] ifFalse:[ - result := false. - ^ self. - ] - ]. - ]. - Error handle:[:ex| - "was not able to copy it" - WarningBox warn:'on copy file - ', ex errorString. - self errorString:('on copy file - ', ex description asString). - result := false. - ] do:[ - aSourceFile moveTo:newFile. - DirectoryContents flushCachedDirectory:(aSourceFile directory). - result := true. - ]. -! - -moveFiles:aColOfSourceFiles to:aDirectory - - ^ self moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:true -! - -moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning - - ^ self moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:true -! - -moveFiles:aColOfSourceFiles to:aDirectory withOverWriteWarning:overWriteWarning moveFileIfSame:move - - |newFile suffix fileString askResult| - - (aDirectory exists not) ifTrue:[ - DialogBox warn:'cant move to not existing directory ', aDirectory asString. - result := false. - ^ self - ]. - (aDirectory isDirectory not) ifTrue:[ - DialogBox warn:'destination ', aDirectory asString, ' is not a directory'. - result := false. - ^ self - ]. - aColOfSourceFiles do:[: filename | - newFile := aDirectory construct:filename baseName. - (newFile exists) ifTrue:[ - askResult := true. - ((newFile asString = filename asString) and:[move]) ifTrue:[ - [newFile exists] whileTrue:[ - suffix := newFile suffix. - fileString := newFile baseName withoutSuffix, self class copyMoveIfExistSuffixString, '.', suffix. - newFile := aDirectory construct:fileString. - ]. - ] ifFalse:[ - overWriteWarning ifTrue:[ - askResult := (self fileExistDialogFor:newFile withCancel:true). - askResult isNil ifTrue:[ - result := false. - ^ self. - ] - ] - ]. - ]. - askResult ifTrue:[ - Error handle:[:ex| - "was not able to copy it" - result := false. - self errorString:('on move file - ', ex description asString). - ( Dialog - confirm:('error on move file - ', ex description asString) - title:'Move' - yesLabel:'Continue' - noLabel:'Abort') ifFalse:[ - ^ self. - ]. - ] do:[ - filename moveTo:newFile. - ]. - self colOfMovedFiles add:filename - ] - ]. - DirectoryContents flushCachedDirectory:aDirectory. - result := true. -! ! - -!Move class methodsFor:'documentation'! - -version - ^ '$Header$' -! ! diff -r bfe92816d90c -r 01d75eba3371 abbrev.stc --- a/abbrev.stc Wed Sep 04 17:38:55 2002 +0200 +++ b/abbrev.stc Wed Sep 04 17:54:54 2002 +0200 @@ -1,6 +1,7 @@ ColorMenu ColorMenu stx:libtool2 'Interface-UIPainter' DataSetBuilder DataSetBuilder stx:libtool2 'Interface-UIPainter' DirectoryView DirectoryView stx:libtool2 'Interface-Support' +FileOperation FileOperation stx:libtool2 'Interface-Support' FileSelectionBrowser FileSelectionBrowser stx:libtool2 'Interface-Dialogs' FontMenu FontMenu stx:libtool2 'Interface-UIPainter' HierarchicalListEditor HierarchicalListEditor stx:libtool2 'Interface-UIPainter' @@ -8,6 +9,7 @@ MenuEditor MenuEditor stx:libtool2 'Interface-UIPainter' MethodFinderWindow MethodFinderWindow stx:libtool2 'Interface-MethodFinder' MethodSelectionBrowser MethodSelectionBrowser stx:libtool2 'Interface-Dialogs' +Move Move stx:libtool2 'Interface-Support' NewInspector::NewInspectorList NewInspectorList stx:libtool2 'Interface-NewInspector' NewInspector::NewInspectorListView NewInspectorListView stx:libtool2 'Interface-NewInspector' NewInspector::NewInspectorPanelView NewInspectorPanelView stx:libtool2 'Interface-NewInspector'