The Trunk: Tools-pre.882.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-pre.882.mcz

commits-2
Patrick Rein uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-pre.882.mcz

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

Name: Tools-pre.882
Author: pre
Time: 3 September 2019, 4:53:34.544361 pm
UUID: f593a50e-ceef-8045-b6b7-f36d63cb01dd
Ancestors: Tools-mt.881

Deprecates file reader registration methods on FileList

=============== Diff against Tools-mt.881 ===============

Item was removed:
- ----- Method: FileList class>>allRegisteredServices (in category 'file reader registration') -----
- allRegisteredServices
- "self allRegisteredServices"
-
- | col |
- col := OrderedCollection new.
- self registeredFileReaderClasses do: [:each | col addAll: (each services)].
- ^ col!

Item was removed:
- ----- Method: FileList class>>detectService:ifNone: (in category 'file reader registration') -----
- detectService: aBlock ifNone: anotherBlock
- "self detectService: [:each | each selector = #fileIn:] ifNone: [nil]"
-
- ^ self allRegisteredServices
- detect: aBlock
- ifNone: anotherBlock!

Item was removed:
- ----- Method: FileList class>>isReaderNamedRegistered: (in category 'file reader registration') -----
- isReaderNamedRegistered: aSymbol
- "return if a given reader class has been registered. Note that this is on purpose that the argument is
- a symbol and not a class"
-
- ^ (self registeredFileReaderClasses collect: [:each | each name]) includes: aSymbol
- !

Item was removed:
- ----- Method: FileList class>>itemsForDirectory: (in category 'file reader registration') -----
- itemsForDirectory: aFileDirectory
- "Answer a list of services appropriate when no file is selected."
-
- | services |
- services := OrderedCollection new.
- self registeredFileReaderClasses do: [:reader |
- reader ifNotNil: [services addAll: (reader fileReaderServicesForDirectory: aFileDirectory) ]].
- ^ services!

Item was removed:
- ----- Method: FileList class>>itemsForFile: (in category 'file reader registration') -----
- itemsForFile: fullName
- "Answer a list of services appropriate for a file of the given full name"
-
- | services suffix |
- suffix := self suffixOf: fullName.
- services := OrderedCollection new.
- self registeredFileReaderClasses do: [:reader |
- reader ifNotNil: [services addAll: (reader fileReaderServicesForFile: fullName suffix: suffix)]].
- ^ services!

Item was removed:
- ----- Method: FileList class>>registerFileReader: (in category 'file reader registration') -----
- registerFileReader: aProviderClass
- "register the given class as providing services for reading files"
-
- | registeredReaders |
- registeredReaders := self registeredFileReaderClasses.
- (registeredReaders includes: aProviderClass)
- ifFalse: [ registeredReaders addLast: aProviderClass ]!

Item was removed:
- ----- Method: FileList class>>registeredFileReaderClasses (in category 'file reader registration') -----
- registeredFileReaderClasses
- FileReaderRegistry := nil. "wipe it out"
- ^FileServices registeredFileReaderClasses
- !

Item was removed:
- ----- Method: FileList class>>suffixOf: (in category 'file reader registration') -----
- suffixOf: aName
- "Answer the file extension of the given file"
- ^ aName
- ifNil:
- ['']
- ifNotNil:
- [(FileDirectory extensionFor: aName) asLowercase]!

Item was removed:
- ----- Method: FileList class>>unregisterFileReader: (in category 'file reader registration') -----
- unregisterFileReader: aProviderClass
- "unregister the given class as providing services for reading files"
-
- self registeredFileReaderClasses remove: aProviderClass ifAbsent: [nil]!

Item was changed:
  ----- Method: FileList2 class>>endingSpecs (in category 'blue ui') -----
  endingSpecs
  "Answer a collection of specs to build the selective 'find anything' tool called by the Navigator. This version uses the services registry to do so."
  "FileList2 morphicViewGeneralLoaderInWorld: World"
  | categories specs rejects |
  rejects := #(addFileToNewZip: compressFile: openInZipViewer: extractAllFrom: openOn:).
  categories := #(
  ('Art' ('bmp' 'gif' 'jpg' 'jpeg' 'form' 'png' 'pcx' 'xbm' 'xpm' 'ppm' 'pbm'))
  ('Morphs' ('morph' 'morphs' 'sp'))
  ('Projects' ('extseg' 'project' 'pr'))
  ('MIDI' ('mid' 'midi'))
  ('Music' ('mp3'))
  ('Movies' ('movie' 'mpg' 'mpeg' 'qt' 'mov'))
  ('Flash' ('swf'))
  ).
 
  "('Books' ('bo'))"
  "('Code' ('st' 'cs'))"
  "('TrueType' ('ttf'))"
  "('3ds' ('3ds'))"
  "('Tape' ('tape'))"
  "('Wonderland' ('wrl'))"
  "('HTML' ('htm' 'html'))"
 
  categories first at: 2 put: ImageReadWriter allTypicalFileExtensions.
  specs := OrderedCollection new.
  categories do: [ :cat | | catSpecs catServices okExtensions services |
  services := Dictionary new.
  catSpecs := Array new: 3.
  catServices := OrderedCollection new.
  okExtensions := Set new.
 
+ cat second do: [ :ext | (FileServices itemsForFile: (FileDirectory default fullPathFor: ('fred.',ext))) do: [ :i |
- cat second do: [ :ext | (FileList itemsForFile: (FileDirectory default fullPathFor: ('fred.',ext))) do: [ :i |
  (rejects includes: i selector) ifFalse: [
  okExtensions add: ext.
  services at: i label put: i ]]].
  services do: [ :svc | catServices add: svc ].
  services isEmpty ifFalse: [
  catSpecs at: 1 put: cat first;
  at: 2 put: okExtensions;
  at: 3 put: catServices.
  specs add: catSpecs ]
  ].
  ^specs
  !