How to reinitialize SpCodePresenter commands?

SD
stephane ducasse
Thu, Aug 24, 2023 6:55 PM

Hi

I wanted to extend SpCodePresenter so I created a new command and I added the new command manually in

codeNavigationCommandsGroupWith: aPresenter

| group |
group := (CmCommandGroup named: 'Code search') asSpecGroup
	         description: 'Search the system from code selection.';
	         beDisplayedAsSubMenu;
	         yourself.

self flag: #TODO. "This looks like a very bad way to do this :P"
{
	KyoBrowseClassCommand . 
	^^^^
	SpBrowseClassCommand.
	SpBrowseImplementorsCommand.
	SpBrowseSendersCommand.
	SpBrowseMethodReferencesCommand.
	SpBrowseMethodsMatchingStringInsensitiveCommand.
	SpBrowseMethodsMatchingStringSensitiveCommand.
	SpBrowseMethodsContainingStringCommand } do: [ :commandClass |
	group register: (commandClass forSpecContext: aPresenter) ].

^ group

My command worked but when I changed
from

KyoBrowseClassCommand  class >> defaultShortcutKey

^ $k command mac  | $k control win | $k control unix

to

KyoBrowseClassCommand class >> defaultShortcutKey

^ $k command mac , $b command mac | $k control win | $k control unix

I could not open the playground
So I reverted my changes but I cannot find the way to reinitialize SpCodePresenter

S

Hi I wanted to extend SpCodePresenter so I created a new command and I added the new command manually in codeNavigationCommandsGroupWith: aPresenter | group | group := (CmCommandGroup named: 'Code search') asSpecGroup description: 'Search the system from code selection.'; beDisplayedAsSubMenu; yourself. self flag: #TODO. "This looks like a very bad way to do this :P" { KyoBrowseClassCommand . ^^^^ SpBrowseClassCommand. SpBrowseImplementorsCommand. SpBrowseSendersCommand. SpBrowseMethodReferencesCommand. SpBrowseMethodsMatchingStringInsensitiveCommand. SpBrowseMethodsMatchingStringSensitiveCommand. SpBrowseMethodsContainingStringCommand } do: [ :commandClass | group register: (commandClass forSpecContext: aPresenter) ]. ^ group My command worked but when I changed from KyoBrowseClassCommand class >> defaultShortcutKey ^ $k command mac | $k control win | $k control unix to KyoBrowseClassCommand class >> defaultShortcutKey ^ $k command mac , $b command mac | $k control win | $k control unix I could not open the playground So I reverted my changes but I cannot find the way to reinitialize SpCodePresenter S
EL
Esteban Lorenzano
Thu, Aug 24, 2023 8:10 PM

Hi,

This is not cached, commands are calculated each time (hence, there is no reset).

Esteban

On 24 Aug 2023, at 20:55, stephane ducasse stephane.ducasse@inria.fr wrote:

Hi

I wanted to extend SpCodePresenter so I created a new command and I added the new command manually in

codeNavigationCommandsGroupWith: aPresenter

| group |
group := (CmCommandGroup named: 'Code search') asSpecGroup
             description: 'Search the system from code selection.';
             beDisplayedAsSubMenu;
             yourself.

self flag: #TODO. "This looks like a very bad way to do this :P"
{
    KyoBrowseClassCommand . 
    ^^^^
    SpBrowseClassCommand.
    SpBrowseImplementorsCommand.
    SpBrowseSendersCommand.
    SpBrowseMethodReferencesCommand.
    SpBrowseMethodsMatchingStringInsensitiveCommand.
    SpBrowseMethodsMatchingStringSensitiveCommand.
    SpBrowseMethodsContainingStringCommand } do: [ :commandClass |
    group register: (commandClass forSpecContext: aPresenter) ].

^ group

My command worked but when I changed
from

KyoBrowseClassCommand  class >> defaultShortcutKey

^ $k command mac  | $k control win | $k control unix

to

KyoBrowseClassCommand class >> defaultShortcutKey

^ $k command mac , $b command mac | $k control win | $k control unix

I could not open the playground
So I reverted my changes but I cannot find the way to reinitialize SpCodePresenter

S

Hi, This is not cached, commands are calculated each time (hence, there is no reset). Esteban > On 24 Aug 2023, at 20:55, stephane ducasse <stephane.ducasse@inria.fr> wrote: > > Hi > > I wanted to extend SpCodePresenter so I created a new command and I added the new command manually in > > codeNavigationCommandsGroupWith: aPresenter > > | group | > group := (CmCommandGroup named: 'Code search') asSpecGroup > description: 'Search the system from code selection.'; > beDisplayedAsSubMenu; > yourself. > > self flag: #TODO. "This looks like a very bad way to do this :P" > { > KyoBrowseClassCommand . > ^^^^ > SpBrowseClassCommand. > SpBrowseImplementorsCommand. > SpBrowseSendersCommand. > SpBrowseMethodReferencesCommand. > SpBrowseMethodsMatchingStringInsensitiveCommand. > SpBrowseMethodsMatchingStringSensitiveCommand. > SpBrowseMethodsContainingStringCommand } do: [ :commandClass | > group register: (commandClass forSpecContext: aPresenter) ]. > > ^ group > > My command worked but when I changed > from > > KyoBrowseClassCommand class >> defaultShortcutKey > > ^ $k command mac | $k control win | $k control unix > > to > > KyoBrowseClassCommand class >> defaultShortcutKey > > ^ $k command mac , $b command mac | $k control win | $k control unix > > I could not open the playground > So I reverted my changes but I cannot find the way to reinitialize SpCodePresenter > > S