<div class="gmail_quote">On Tue, Mar 18, 2008 at 10:59 AM, David Röthlisberger <<a href="mailto:squeak@c3com.ch">squeak@c3com.ch</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">First, create a subclass of OBCommand. Then you need to implement at least the<br></div>
methods #execute, #label and #isActive (have a look at eg. OBCmdNewClassTemplate).<br>
Finally, you can add a method called eg. 'cmdAIDATemplate' to OBCodeBrowser or a<br>
subclass of it. It is important that this method starts with 'cmd'. When you then<br>
start a new system browser, the command should be available (if #isActive answers<br>
true for the selected class).</blockquote><div><br class="webkit-block-placeholder"></div><div>When I do this, I get TWO menu items, and if no class is selected in the class pane, I get one all by itself. I just copied the normal new class template code to execute as follows:</div>
<div><br class="webkit-block-placeholder"></div><div><div>'From Squeak3.9.1 of 2 March 2008 [latest update: #7075] on 18 March 2008 at 3:58:54 pm'!</div><div>OBCommand subclass: #OBCmdNewWebAppTemplate</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>instanceVariableNames: ''</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>classVariableNames: ''</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>poolDictionaries: ''</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>category: 'WebAppBuilder'!</div>
<div><br class="webkit-block-placeholder"></div><div>!OBCmdNewWebAppTemplate methodsFor: 'as yet unclassified' stamp: 'rjriv 3/18/2008 15:58'!</div><div>execute</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>| class definition |</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>class := target theNonMetaClass.</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>definition := (OBClassDefinition </div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>environment: class environment </div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>template: (Class template: class category)).</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>requestor announce: (OBDefinitionChanged definition: definition)! !</div>
<div><br class="webkit-block-placeholder"></div><div>!OBCmdNewWebAppTemplate methodsFor: 'as yet unclassified' stamp: 'rjriv 3/18/2008 15:43'!</div><div>isActive</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^true.! !</div>
<div><br class="webkit-block-placeholder"></div><div>!OBCmdNewWebAppTemplate methodsFor: 'as yet unclassified' stamp: 'rjriv 3/18/2008 15:36'!</div><div>label</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>^ 'new web app template'! !</div>
<div><br class="webkit-block-placeholder"></div><div>Rob</div><div><br class="webkit-block-placeholder"></div></div></div>