About the Registering File list
Stephane Ducasse
ducasse at iam.unibe.ch
Thu Jan 31 11:31:01 UTC 2002
Hi
I'm fixing some of the problems with the file list. Now I have a question.
Right now a reader registers in the following way:
B3DScene class >>initialize
FileList registerFileReader: self
B3DScene class>>fileReaderServicesForSuffix: suffix
^(suffix = '3ds') | (suffix = '*')
ifTrue: [
{SimpleServiceEntry
provider: self
label: 'Open 3DS file'
selector: #open3DSFile:}]
ifFalse: [#()]
So the file list only knows the classes and not the services which have been
register.
The first question is then how to get some specific services
A possible answer would be to call
col := OrderedCollection new.
FileList allReader
do: [:each | res := each fileReaderServicesForSuffix: '*'.
res isEmpty
ifFalse: [col add: each ]].
col
The problem is that every reader developers has to not forget to put the
(suffix = '*') in the fileReaderServicesForSuffix method
A possible solution would be to have a method such as
B3DScene class>>registeredServices
^ {SimpleServiceEntry
provider: self
label: 'Open 3DS file'
selector: #open3DSFile:}
B3DScene class>>fileReaderServicesForSuffix: suffix
^(suffix = '3ds') | (suffix = '*')
ifTrue: [
self registeredServices]
ifFalse: [#()]
The second question is should we register classes or services. With classes,
when I'm looking for the services that fileIn for example I have to look for
all the classes get their services select the right one.
With services I would just goes over the services.
Any ideas pros and cons.
Stef
More information about the Squeak-dev
mailing list
|