The Trunk: Tools-tpr.784.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-tpr.784.mcz

commits-2
tim Rowledge uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-tpr.784.mcz

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

Name: Tools-tpr.784
Author: tpr
Time: 28 December 2017, 12:20:53.89794 pm
UUID: a907b96a-f612-4dc7-a38c-0ecf51f2693c
Ancestors: Tools-tpr.783

Update ArchiveViewer to use the new file dialogs.
Similarly for MessageSet & Workspace (though there are no senders of that)

=============== Diff against Tools-tpr.783 ===============

Item was changed:
  ----- Method: ArchiveViewer>>addDirectory (in category 'member operations') -----
  addDirectory
+ |  directory |
- | directory |
  self canAddMember ifFalse: [ ^self ].
+ directory := UIManager default chooseDirectory.
- directory := FileList2 modalFolderSelector.
  directory
  ifNil: [^ self].
+
  archive addTree: directory removingFirstCharacters: directory pathName size + 1.
  self memberIndex: 0.
  self changed: #memberList.!

Item was changed:
  ----- Method: ArchiveViewer>>addMember (in category 'member operations') -----
  addMember
+ | local fName |
- | result local full |
  self canAddMember ifFalse: [ ^self ].
+ fName := UIManager default chooseFileMatching: '*' .
+ fName ifNil: [ ^self ].
- result := FileList2 modalFileSelector .
- result ifNil: [ ^self ].
 
+ local := FileDirectory localNameFor: fName.
+ (archive addFile: fName as: local)
- local := result directory localNameFor: result name.
-
- full := result directory fullNameFor: result name.
-
- (archive addFile: full as: local)
  desiredCompressionMethod: ZipArchive compressionDeflated.
  self memberIndex: self members size.
  self changed: #memberList.!

Item was changed:
  ----- Method: ArchiveViewer>>extractAll (in category 'archive operations') -----
  extractAll
  | directory |
 
  self canExtractAll ifFalse: [^ self].
+ directory := UIManager default chooseDirectory.
+ directory
+ ifNil: [^ self].
+
+ UIManager default informUserDuring: [:bar| archive extractAllTo: directory informing: bar].
+
+
+ !
- directory := FileList2 modalFolderSelector ifNil: [^ self].
- UIManager default informUserDuring: [:bar| archive extractAllTo: directory informing: bar].!

Item was changed:
  ----- Method: ArchiveViewer>>openNewArchive (in category 'archive operations') -----
  openNewArchive
  |  result |
+ result := UIManager default chooseFileMatching: '*' .
- result := FileList2 modalFileSelector .
  result ifNil: [ ^self ].
+ self fileName: result
- self fileName: (result directory fullNameFor: result name).
  !

Item was changed:
  ----- Method: ArchiveViewer>>saveArchive (in category 'archive operations') -----
  saveArchive
  | result name |
 
  name := FileDirectory  localNameFor: labelString .
  self canSaveArchive ifFalse: [ ^self ].
  result := UIManager default
+ saveFilenameRequest: 'Save this zip to'
- request: 'Name this zip '
  initialAnswer:  name.
  result ifNil: [ ^self ].
 
  (archive canWriteToFileNamed: result)
  ifFalse: [ self inform: name, ' is used by one or more members
  in your archive, and cannot be overwritten.
  Try writing to another file name'.
  ^self ].
  [ archive writeToFileNamed: result ] on: Error do: [ :ex | self inform: ex description. ].
  self setLabel: name asString.
  self changed: #memberList "in case CRC's and compressed sizes got set"!

Item was changed:
  ----- Method: MessageSet>>fileOutMessage (in category 'message functions') -----
  fileOutMessage
  "Put a description of the selected method on a file, or all methods if none selected."
 
  | fileName |
  self selectedMessageName ifNotNil:
  [^super fileOutMessage].
+ fileName := UIManager default saveFilenameRequest: 'File out on which file?' initialAnswer: 'methods'.
- fileName := UIManager default request: 'File out on which file?' initialAnswer: 'methods'.
  Cursor write showWhile:
  [| internalStream |
  internalStream := WriteStream on: (String new: 1000).
  internalStream header; timeStamp.
  messageList do:
  [:methodRef|
  methodRef methodSymbol == #Comment
  ifTrue:
  [methodRef actualClass organization
  putCommentOnFile: internalStream
  numbered: 1
  moveSource: false
  forClass: methodRef actualClass]
  ifFalse:
  [methodRef actualClass
  printMethodChunk: methodRef methodSymbol
  withPreamble: true
  on: internalStream
  moveSource: false
  toFile: nil]].
  FileStream writeSourceCodeFrom: internalStream baseName: fileName isSt: true useHtml: false]!

Item was changed:
  ----- Method: Workspace>>appendContentsOfFile (in category 'menu commands') -----
  appendContentsOfFile
  "Prompt for a file, and if one is obtained, append its contents to the contents of the receiver.   Caution: as currently implemented this abandons any custom style information previously in the workspace.  Someone should fix this.  Also, for best results you should accept the contents of the workspace before requesting this."
 
+ | fName |
+ fName := UIManager default chooseFileMatching: '*' label: 'Choose file to add to workspace'.
+ fName ifNil:[^self].
+
+ FileStream oldFileNamed: fName do:[:aFileStream|
+ contents := (contents ifNil: ['']) asString, aFileStream contentsOfEntireFile].
- | aFileStream |
- (aFileStream := FileList2 modalFileSelector) ifNil: [^ self].
- contents := (contents ifNil: ['']) asString, aFileStream contentsOfEntireFile.
- aFileStream close.
  self changed: #contents!