[Pharo-users] Calypso documentation? Or understanding menu building

Tim Mackinnon tim at testit.works
Tue Feb 12 17:41:07 EST 2019


Thanks Denis - lots for me to look through there. I’ll also add a PR to add those documentation links to the Calypso readme.

Tim

> On 12 Feb 2019, at 19:32, Denis Kudriashov <dionisiydk at gmail.com> wrote:
> 
> Hi Tim
> 
> вт, 12 февр. 2019 г. в 13:42, Tim Mackinnon <tim at testit.works>:
> Is there any documentation on Calypso   application contexts? I am trying to add a menu item to a package tag (the bit underneath a package - which I often call a sub-package).
> 
> Only class comments are available for Calypso. Also there are a Commander booklet  <https://github.com/SquareBracketAssociates/Booklet-Infrastructure>which describes contexts and ClassAnnotation github readme <https://github.com/pharo-ide/ClassAnnotation> (together with class comments).
>  
> 
> I’ve specified: 
> 
> ^CmdContextMenuActivation 
>                 byItemOf: ClyQueryMenuGroup for: RPackage asCalypsoItemContext 
> 
> 
> The #for: argument of command activations is a context where command should be available. Context describes condition where given command (its activation strategy) should be visible for users.
> In your example "RPackage asCalypsoItemContext" is an instance of ClyBrowserItemContext which matches any selected package in the browser (when a kind of RPackage is selected).
> And that's why you do not see it on selected tag because the tag is not a package.
> 
> But that puts my menu on the package and not the tag 
> - and if I use the inspect extra menu in calypso, I get what looks to be something that could help me determine what I want but I’m struggling to understand what ClyTaggedClassGroup does, and what a context is all about.
> 
> Inspect command opens inspector of actually selected object which is an instance of ClyTaggedClassGroup in that case (try inspect selected method and you will get a CompiledMethod).
> Children of package in browser are instances of ClyClassGroup and subclasses. So they are not raw tags. If you need a command for a tag you should add a command for ClyTaggedClassGroup items:
> 
> ^CmdContextMenuActivation 
>                 byItemOf: ClyQueryMenuGroup for: ClyTaggedClassGroup asCalypsoItemContext 
> 
> Look for example at SycPromotePackageFromTagCommand class>>#fullBrowserMenuActivation which is defined this way.
> 
> There are other kind of contexts which can be used in command annotations. For example if you want a command for selected method only in full browser then you should use ClyMethodContextOfFullBrowser:
> 
> ^CmdContextMenuActivation byItemOf: ClyQueryMenuGroup for: ClyMethodContextOfFullBrowser 
> 
> it can be confusing that simple class is used in this case. But underhood it is converted to the instance of context where command should be available.
>  
> 
> Has anyone else played around with this at all?
> 
> Ideally I want to have a menu appear on all the tags underneath a particular package - and possibly including that package (or maybe not - I haven’t decided as I want to try it in the wild).
> 
> While I’m at it - I have quite understood how to create submenu’s either - as I’d like to have several commands all as sub items of a menu item “Exercism”.
> 
> Look at commander booklet. It includes example.
>  
> 
> Tim
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190212/05a467f0/attachment.html>


More information about the Pharo-users mailing list