Hi Dennis - I’ve been reading the book you mentioned and looking through the 
code as well as your examples and I feel a bit more comfortable with what’s 
going on - however I am stumped about how you do an OR context (vs. an AND 
context).

I would like my menu item to appear for either a selected RPackage OR a 
ClyTaggedClassGroup - I thought I had it with:

RPackage asCalypsoItemContext, ClyTaggedClassGroup  asCalypsoItemContext (to 
get a composite context) but then I realised that the composite is an AND.

Is there some way to create an OR context, or do I simply have to create 
multiple commands?

Tim


> On 12 Feb 2019, at 19:32, Denis Kudriashov <dionisi...@gmail.com> wrote:
> 
> Hi Tim
> 
> вт, 12 февр. 2019 г. в 13:42, Tim Mackinnon <tim@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
> 
> 
> 

Reply via email to