4.2.4 Registration in the World Menu
The class WorldState builds the world menu using a PragmaMenuBuilder passed to all methods defining the <worldMenu> pragma.
For example, this adds a menu entry under Help to launch ProfStefBrowser,
ProfStefBrowser class>>menuCommandOn: aBuilder
<worldMenu>
(aBuilder item: #'ProfStef Browser')
parent: #Help;
action:[self go];
help: 'Browse and create ProfStef tutorials'.
The block passed to MenuRegistration#action: selector will be executed when the ProfStefBrowser entry is clicked. So here it will send the message #go on ProfStefBrowser class.
The Help group is defined in
WorldState class>>helpOn: aBuilder
<worldMenu>
(aBuilder item: #Help)
order: 5.0;
withSeparatorAfter;
icon: MenuIcons smallHelpIcon.
MenuRegistration>>order: define the position of the group. System group has order: 4.0, so before Help group.
WorldState class>>systemOn: aBuilder
| currItem |
<worldMenu>
(aBuilder item: #System)
order: 4.0;
icon: MenuIcons smallConfigurationIcon;
with: [
(aBuilder item: #'About...')
order: 0;
action: [Smalltalk aboutThisSystem].
(aBuilder item: #'Software update')
order: 1;
precondition: [self showUpdateOptionInWorldMenu];
action: [Utilities updateFromServer];
help: 'Load latest code updates via the internet']
