Status: Accepted
Owner:
[hidden email]
Labels: Milestone-1.4
New issue 4406 by
[hidden email]: compare toolResgistry comment with
this one, and produce a better one
http://code.google.com/p/pharo/issues/detail?id=4406A 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.
_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker