[squeak-dev] The Trunk: Network-tpr.256.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Apr 19 18:50:09 UTC 2022


tim Rowledge uploaded a new version of Network to project The Trunk:
http://source.squeak.org/trunk/Network-tpr.256.mcz

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

Name: Network-tpr.256
Author: tpr
Time: 19 April 2022, 11:50:07.882533 am
UUID: a08939a3-537b-445e-b51c-a7839a609f4e
Ancestors: Network-ct.255

Use the new ToolBuilder ability to show a list of options - typically a small number, maybe with a cancel button etc - as opposed to an arbitrary list of values. This separates it out from the chooseFrom:... protocol.
Also update "UIManager default" with "Project uiManager"

=============== Diff against Network-ct.255 ===============

Item was changed:
  ----- Method: NameLookupFailure>>defaultAction (in category 'handling') -----
  defaultAction
  	"Backward compatibility"
  	| response |
+ 	response := (Project uiManager
+ 					chooseOptionFrom: #( 'Retry' 'Give Up')
+ 					title: self messageText).
+ 	^ response = 2 ifFalse: [self retry]!
- 	response := (UIManager default  chooseFrom: #( 'Retry' 'Give Up')
- 			title: self messageText).
- 	^ response = 2
- 		ifFalse: [self retry]!

Item was changed:
  ----- Method: ServerDirectory>>newFileNamed: (in category 'file directory') -----
  newFileNamed: fullName
  	"Create a RemoteFileStream.  If the file exists, and complain.  fullName is directory path, and does include name of the server.  Or it can just be a fileName.  Only write the data upon close."
  
  	| file remoteStrm selection |
  
  	file := self asServerFileNamed: fullName.
  	file readWrite.
+ 	file isTypeFile ifTrue: 
+ 		[^ FileStream newFileNamed: (file fileNameRelativeTo: self)].
- 	file isTypeFile ifTrue: [
- 		^ FileStream newFileNamed: (file fileNameRelativeTo: self)].
  	file exists 
+ 		ifTrue: 
+ 			[selection := Project uiManager 
+ 							chooseOptionFrom: #('overwrite that file' 'choose another name' 'cancel')
+ 							title: (file fullNameFor: file fileName) , '
- 		ifTrue: [
- 			selection := UIManager default 
- 				chooseFrom: #('overwrite that file' 'choose another name' 'cancel')
- 				title: (file fullNameFor: file fileName) , '
  already exists.']
  		ifFalse: [selection := 1].
  
  	selection = 1 ifTrue:
  		[remoteStrm := RemoteFileStream on: (String new: 2000).
  		remoteStrm remoteFile: file.
  		remoteStrm dataIsValid.	"empty stream is the real contents!!"
  		^ remoteStrm].	"no actual writing till close"
+ 	selection = 2 ifTrue: 
+ 		[^ self newFileNamed:
+ 			(Project uiManager
+ 				request: 'Enter a new file name'
- 	selection = 2 ifTrue: [
- 		^ self newFileNamed:
- 			(UIManager default request: 'Enter a new file name'
  				initialAnswer: file fileName)].
  	^ nil	"cancel"!

Item was changed:
  ----- Method: ServerDirectory>>openFTPClient (in category 'dis/connect') -----
  openFTPClient
  
  	| loginSuccessful |
+ 	client ifNotNil:
+ 		[client isConnected
- 	client
- 		ifNotNil: [client isConnected
  			ifTrue: [^client]
  			ifFalse: [client := nil]].
  	client := FTPClient openOnHostNamed: server.
  	client ifNil: [^nil].
  	loginSuccessful := false.
  	[loginSuccessful]
+ 		whileFalse: 
+ 			[[loginSuccessful := true.
- 		whileFalse: [
- 			[loginSuccessful := true.
  			client loginUser: self user password: self password]
  				on: LoginFailedException
  				do: [:ex | 
  					| what |
  					passwordHolder := nil.
+ 					what := Project uiManager
+ 								chooseOptionFrom: #('enter password' 'give up') 
+ 								title: 'Would you like to try another password?'.
- 					what := UIManager default 
- 						chooseFrom: #('enter password' 'give up') 
- 						title: 'Would you like to try another password?'.
  					what = 1 ifFalse: [ ^nil].
  					loginSuccessful := false]].
  	client changeDirectoryTo: directory.
  	^client!



More information about the Squeak-dev mailing list