On 8 June 2011 09:36, Stéphane Ducasse <[email protected]> wrote:
> Hi guys
>
> some of you may find the following working document of high interest. Pay 
> attention this is a bit draft and incomplete.
>
>        http://code.google.com/p/pharo/wiki/ActionsInPharoOneDotThree
>

>>>>>Tools are now accessed via Smalltalk tools aTool and they should be 
>>>>>registered via .. @@igor please add something here@@

A tool at class side should implement #registerToolsOn: method.

This method will be executed automatically for all classes, when you issue
Smalltalk resetTools

If you don't want to reset all tools (to defaults) , but instead add
new tools when package installed
just send #registerToolsOn:  in #initialize method of your tool class
with 'Smalltalk tools' as argument:

SomeTool class>>initialize

self registerToolsOn: Smalltalk tools

A typical #registerToolsOn: implementation:

SomeTool class>>registerToolsOn: registry

     registry register: self as: #someTool

And to access registered tool, now you can use 'Smalltalk tools someTool' idiom.


Note, that with tools registry, you are no longer need to keep (and
implement) a singleton pattern per each tool class,
which requires it , i.e.
SomeTool default doSomething.

instead, with using registry, you can register a sole tool instance
(or class) to registry , and then just write
Smalltalk tools someTool doSomething.

This means that multiple tools now can get rid of singleton.

> Stef

-- 
Best regards,
Igor Stasenko AKA sig.

Reply via email to