Let me clarify what @Peter and I mean
Choose any class, and in the class side add your #menuCommandOn:
method on the lines of
menuCommandOn: aBuilder
<worldMenu>
self showsItem ifTrue: [
(aBuilder item: self itemToken)
order: 0.1;
action: [self performItemAction]]
This way, even though the method would be invoked every time the world menu is about to pop up, it will add the menu item only if the logic behind #showsItem
enables it. Notice that the dynamic nature of the menu doesn't require you to remove menu items, instead you simply do not add them. In your case such a logic should reflect the availability of the web service.
The #itemToken
message send is a placeholder for the Symbol
you want to use to identify the item. In other words, you would probably want to inline it as a literal rather than sending the #itemToken
message. This Symbol
will be used as the item label
.
For further optional configuration features take a look at other implementors of #menuCommandOn:
.