[squeak-dev] Dropping a morph gives me a funny menu
H. Hirzel
hannes.hirzel at gmail.com
Sat Mar 25 16:41:20 UTC 2017
FileServices allInstances size
gives
0
only class methods.
There is
FileServices initialize.
The #initialize method looks for classes which implement
#fileReaderServicesForFile:suffix: and asks them to register.
The list of classes which implement #fileReaderServicesForFile:suffix:
is given by
(Smalltalk allClasses select: [:aClass|
(aClass class includesSelector: #fileReaderServicesForFile:suffix:)])
sorted: [:a :b | a name < b name]
It is
{AnimatedImageMorph . ArchiveViewer . BookMorph . ChangeList .
ChangeSet . DummyToolWorkingWithFileList . EventRecorderMorph .
FileContentsBrowser . FileDirectory . FilePackage . FileStream . Form
. GZipReadStream . GZipWriteStream . InternalTranslator .
MCVersionReader . MczInstaller . Morph . NaturalLanguageTranslator .
Object . Preferences . ProjectViewMorph . SARInstaller . ScorePlayer .
ScorePlayerMorph . TTCFont . TTFontReader}
in Squeak 5.1.
The CornerGripMorph is _not_ in this list.
So
FileService initialize
should do the job.
It has as code
initialize
"FileServices initialize"
Smalltalk allClassesDo:[:aClass|
(aClass class includesSelector: #fileReaderServicesForFile:suffix:)
ifTrue:[self registerFileReader: aClass]].
It does not do it. The double entry of 'Load as morph' still appears.
What #initialize needs to do it to reset the FileReaderRegistry class variable
FileReaderRegistry := nil.
So the updated #initialize method should look like
initialize
"FileServices initialize"
FileReaderRegistry := nil.
Smalltalk allClassesDo:[:aClass|
(aClass class includesSelector: #fileReaderServicesForFile:suffix:)
ifTrue:[self registerFileReader: aClass]].
Then after
FileServices initialize
the CornerGripMorph is no longer included.
Note: In spite of this generic direct initialisation mechanism 10
#initialize methods on the class side directly reference FileServices.
And MczInstaller has #registerForFileList which references
FileServices.
So we would need to check if with this change
FileReaderRegistry := nil.
we still get enough registrations. That is to check each class which
references FileServices.
On 3/25/17, Edgar De Cleene <edgardec2005 at gmail.com> wrote:
> You are right.
> FileServices unregisterFileReader: CornerGripMorph solves the issue and
> can’t see any use of having a CornerGripMorph outside of the .image
>
>> On Mar 25, 2017, at 08:31, Tobias Pape <Das.Linux at gmx.de> wrote:
>>
>> CornerGripMorph
>
>
More information about the Squeak-dev
mailing list
|