At the very least, the contents of the block controlled by #stsConfirm: should be extracted to its own method accepting a boolean as an argument. This would provide a better code example, and allow scripting of the enabling of the toolbar.
Here's what I'm suggesting:
- Code: Select all
toggleEmulatedToolbar
(System stsConfirm: 'This will close all windows. Continue?')
ifTrue: [self useEmulatedToolbar: self useEmulatedToolbar not]
- Code: Select all
useEmulatedToolbar: aBoolean
| etBaseToolsMappings etToolsMappings |
self setUseEmulatedToolbar: aBoolean.
etToolsMappings := EtTools browserMappings.
etBaseToolsMappings := EtBaseTools browserMappings.
CommonWidgets reinitialize.
EtTools browserMappings: etToolsMappings.
EtBaseTools browserMappings: etBaseToolsMappings
With this refactoring, I could add "EtTools useEmulatedToolbar: true" to my abt.cnf file, and always be sure of getting the emulated toolbar.
Strictly speaking, had I been implementing this, I would have used the name #useEmulatedToolbar: for the method currently named #setUseEmulatedToolbar:, since the getter for that value is #useEmulatedToolbar and it's a simple setter. This would have allowed me to use #setUseEmulatedToolbar: more correctly.