[squeak-dev] The Inbox: Tools-ct.1067.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Oct 30 21:49:59 UTC 2021


A new version of Tools was added to project The Inbox:
http://source.squeak.org/inbox/Tools-ct.1067.mcz

==================== Summary ====================

Name: Tools-ct.1067
Author: ct
Time: 30 October 2021, 11:49:53.090219 pm
UUID: d6a13f76-a837-4fac-8763-5658d8f7919e
Ancestors: Tools-eem.1065

FileList: When adding a new file or directory that already exists, show a dialog intead of letting the primitive error passing. Analogously to checks in #deleteDirectory.

=============== Diff against Tools-eem.1065 ===============

Item was changed:
  ----- Method: FileList>>addNew:byEvaluating: (in category 'file menu action') -----
  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 := UIManager default
  						request: ('New {1} Name?' translated format: {aString translated})
  						initialAnswer: ('{1}Name' translated format: {aString translated}))
  		isEmpty ifTrue: [^ self].
  	newName := response asFileName.
+ 	(Cursor wait showWhile: [
+ 		directory fileOrDirectoryExists: newName])
+ 			ifTrue: [^ self inform: ('''{1}'' already exists' translated format: {newName})].
  	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.
  !



More information about the Squeak-dev mailing list