[BUG][FIX] FileList>>addNewFile and Dir
Steve Elkins
sgelkins at bellsouth.net
Sun Nov 28 10:00:44 UTC 1999
The change set included below fixes the same bug in
FileList>>addNewFile and FileList>>addNewDirectory. The
methods were so similar I felt obliged to parameterize
them into one.
--------8<-------->8--------
'From Squeak2.7alpha of 13 November 1999 [latest update: #1660] on 28 November 1999 at 9:13:02 am'!
"Change Set: FileListBugFixes
Date: 28 November 1999
Author: Steve Elkins
Parameterizes 2 very similar FileList methods, #addNewDirectory and #addNewFile, as well as removing the same bug from each, that pushing the cancel button in the FillInTheBlank dialog gave a walkback."!
!FileList methodsFor: 'file list menu' stamp: 'sge 11/28/1999 09:03'!
addNew: aString byEvaluating: aBlock
"A parameterization of earlier versions of #addNewDirectory and
#addNewFile. Fixes the bug in each that pushing the cancel button
in the FillInTheBlank dialog gave a walkback."
| response newName index ending |
self okToChange ifFalse: [^ self].
(response _ FillInTheBlank request: 'New ',aString,' Name?'
initialAnswer: aString,'Name')
isEmpty ifTrue: [^ self].
newName _ response asFileName.
Cursor wait showWhile: [
aBlock value: newName].
self updateFileList.
index _ list indexOf: newName.
index = 0 ifTrue: [ending _ ') ',newName.
index _ list findFirst: [:line | line endsWith: ending]].
self fileListIndex: index.
! !
!FileList methodsFor: 'file list menu' stamp: 'sge 11/28/1999 09:04'!
addNewDirectory
self
addNew: 'Directory'
byEvaluating: [:newName | directory createDirectory: newName]
! !
!FileList methodsFor: 'file list menu' stamp: 'sge 11/28/1999 09:04'!
addNewFile
self
addNew: 'File'
byEvaluating: [:newName | (directory newFileNamed: newName) close]
! !
More information about the Squeak-dev
mailing list
|