Browse Source

Fixes #837

- adds Package >> classTemplate
- adds Behavior >> methodTemplate
- use templates in the system browser
Nicolas Petton 11 years ago
parent
commit
f8e775c771

+ 35 - 0
js/Helios-Announcements.js

@@ -551,6 +551,41 @@ smalltalk.addClass('HLShowCommentToggled', globals.HLAnnouncement, [], 'Helios-A
 smalltalk.addClass('HLShowInstanceToggled', globals.HLAnnouncement, [], 'Helios-Announcements');
 
 
+smalltalk.addClass('HLShowTemplate', globals.HLAnnouncement, ['template'], 'Helios-Announcements');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "template",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+var $1;
+$1=self["@template"];
+return $1;
+},
+args: [],
+source: "template\x0a\x09^ template",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLShowTemplate);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "template:",
+protocol: 'accessing',
+fn: function (aString){
+var self=this;
+self["@template"]=aString;
+return self},
+args: ["aString"],
+source: "template: aString\x0a\x09template := aString",
+messageSends: [],
+referencedClasses: []
+}),
+globals.HLShowTemplate);
+
+
+
 smalltalk.addClass('HLSourceCodeSaved', globals.HLAnnouncement, [], 'Helios-Announcements');
 
 });

+ 136 - 2
js/Helios-Browser.js

@@ -806,6 +806,34 @@ referencedClasses: []
 }),
 globals.HLBrowserModel);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showClassTemplate",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLShowTemplate(){return globals.HLShowTemplate||(typeof HLShowTemplate=="undefined"?nil:HLShowTemplate)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=self._selectedPackage();
+if(($receiver = $1) == nil || $receiver == null){
+$1;
+} else {
+var package_;
+package_=$receiver;
+$2=_st($HLShowTemplate())._new();
+_st($2)._template_(_st(package_)._classTemplate());
+$3=_st($2)._yourself();
+_st(self._announcer())._announce_($3);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"showClassTemplate",{},globals.HLBrowserModel)})},
+args: [],
+source: "showClassTemplate\x0a\x09self selectedPackage ifNotNil: [ :package |\x0a\x09\x09self announcer announce: (HLShowTemplate new\x0a\x09\x09\x09template: package classTemplate;\x0a\x09\x09\x09yourself) ]",
+messageSends: ["ifNotNil:", "selectedPackage", "announce:", "announcer", "template:", "new", "classTemplate", "yourself"],
+referencedClasses: ["HLShowTemplate"]
+}),
+globals.HLBrowserModel);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "showComment",
@@ -911,6 +939,34 @@ referencedClasses: ["HLShowInstanceToggled"]
 }),
 globals.HLBrowserModel);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "showMethodTemplate",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLShowTemplate(){return globals.HLShowTemplate||(typeof HLShowTemplate=="undefined"?nil:HLShowTemplate)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2,$3;
+$1=self._selectedClass();
+if(($receiver = $1) == nil || $receiver == null){
+$1;
+} else {
+var theClass;
+theClass=$receiver;
+$2=_st($HLShowTemplate())._new();
+_st($2)._template_(_st(theClass)._methodTemplate());
+$3=_st($2)._yourself();
+_st(self._announcer())._announce_($3);
+};
+return self}, function($ctx1) {$ctx1.fill(self,"showMethodTemplate",{},globals.HLBrowserModel)})},
+args: [],
+source: "showMethodTemplate\x0a\x09self selectedClass ifNotNil: [ :theClass |\x0a\x09\x09self announcer announce: (HLShowTemplate new\x0a\x09\x09\x09template: theClass methodTemplate;\x0a\x09\x09\x09yourself) ]",
+messageSends: ["ifNotNil:", "selectedClass", "announce:", "announcer", "template:", "new", "methodTemplate", "yourself"],
+referencedClasses: ["HLShowTemplate"]
+}),
+globals.HLBrowserModel);
+
 
 smalltalk.addMethod(
 smalltalk.method({
@@ -1234,6 +1290,34 @@ referencedClasses: []
 }),
 globals.HLClassesListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelected=="undefined"?nil:HLClassSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $1,$2;
+globals.HLClassesListWidget.superclass.fn.prototype._focus.apply(_st(self), []);
+$1=self._selectedItem();
+if(($receiver = $1) == nil || $receiver == null){
+$2=self._model();
+$ctx1.sendIdx["model"]=1;
+_st($2)._showClassTemplate();
+} else {
+var class_;
+class_=$receiver;
+_st(_st(self._model())._announcer())._announce_(_st($HLClassSelected())._on_(class_));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLClassesListWidget)})},
+args: [],
+source: "focus\x0a\x09super focus.\x0a\x09\x0a\x09self selectedItem \x0a\x09\x09ifNil: [ self model showClassTemplate ]\x0a\x09\x09ifNotNil: [ :class |\x0a\x09\x09\x09self model announcer announce: (HLClassSelected on: class) ]",
+messageSends: ["focus", "ifNil:ifNotNil:", "selectedItem", "showClassTemplate", "model", "announce:", "announcer", "on:"],
+referencedClasses: ["HLClassSelected"]
+}),
+globals.HLClassesListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "focusMethodsListWidget",
@@ -2546,6 +2630,29 @@ referencedClasses: []
 }),
 globals.HLMethodsListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+globals.HLMethodsListWidget.superclass.fn.prototype._focus.apply(_st(self), []);
+$1=self._selectedItem();
+if(($receiver = $1) == nil || $receiver == null){
+_st(self._model())._showMethodTemplate();
+} else {
+$1;
+};
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLMethodsListWidget)})},
+args: [],
+source: "focus\x0a\x09super focus.\x0a\x09\x0a\x09self selectedItem ifNil: [\x0a\x09\x09self model showMethodTemplate ]",
+messageSends: ["focus", "ifNil:", "selectedItem", "showMethodTemplate", "model"],
+referencedClasses: []
+}),
+globals.HLMethodsListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "isOverridden:",
@@ -3199,6 +3306,32 @@ referencedClasses: []
 }),
 globals.HLPackagesListWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "focus",
+protocol: 'actions',
+fn: function (){
+var self=this;
+function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+globals.HLPackagesListWidget.superclass.fn.prototype._focus.apply(_st(self), []);
+$1=self._selectedItem();
+if(($receiver = $1) == nil || $receiver == null){
+$1;
+} else {
+var package_;
+package_=$receiver;
+_st(_st(self._model())._announcer())._announce_(_st($HLPackageSelected())._on_(package_));
+};
+return self}, function($ctx1) {$ctx1.fill(self,"focus",{},globals.HLPackagesListWidget)})},
+args: [],
+source: "focus\x0a\x09super focus.\x0a\x09self selectedItem ifNotNil: [ :package |\x0a\x09\x09self model announcer announce: (HLPackageSelected on: package) ]",
+messageSends: ["focus", "ifNotNil:", "selectedItem", "announce:", "announcer", "model", "on:"],
+referencedClasses: ["HLPackageSelected"]
+}),
+globals.HLPackagesListWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "focusClassesListWidget",
@@ -3429,11 +3562,12 @@ protocol: 'actions',
 fn: function (aPackage){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
+globals.HLPackagesListWidget.superclass.fn.prototype._selectItem_.apply(_st(self), [aPackage]);
 _st(self._model())._selectedPackage_(aPackage);
 return self}, function($ctx1) {$ctx1.fill(self,"selectItem:",{aPackage:aPackage},globals.HLPackagesListWidget)})},
 args: ["aPackage"],
-source: "selectItem: aPackage\x0a\x09self model selectedPackage: aPackage",
-messageSends: ["selectedPackage:", "model"],
+source: "selectItem: aPackage\x0a\x09super selectItem: aPackage.\x0a\x09self model selectedPackage: aPackage",
+messageSends: ["selectItem:", "selectedPackage:", "model"],
 referencedClasses: []
 }),
 globals.HLPackagesListWidget);

+ 22 - 3
js/Helios-Workspace.js

@@ -1598,6 +1598,7 @@ function $HLClassSelected(){return globals.HLClassSelected||(typeof HLClassSelec
 function $HLPackageSelected(){return globals.HLPackageSelected||(typeof HLPackageSelected=="undefined"?nil:HLPackageSelected)}
 function $HLProtocolSelected(){return globals.HLProtocolSelected||(typeof HLProtocolSelected=="undefined"?nil:HLProtocolSelected)}
 function $HLSourceCodeFocusRequested(){return globals.HLSourceCodeFocusRequested||(typeof HLSourceCodeFocusRequested=="undefined"?nil:HLSourceCodeFocusRequested)}
+function $HLShowTemplate(){return globals.HLShowTemplate||(typeof HLShowTemplate=="undefined"?nil:HLShowTemplate)}
 return smalltalk.withContext(function($ctx1) { 
 var $1,$2;
 $1=_st(self._browserModel())._announcer();
@@ -1625,12 +1626,14 @@ _st($1)._on_send_to_($HLPackageSelected(),"onPackageSelected:",self);
 $ctx1.sendIdx["on:send:to:"]=11;
 _st($1)._on_send_to_($HLProtocolSelected(),"onProtocolSelected:",self);
 $ctx1.sendIdx["on:send:to:"]=12;
-$2=_st($1)._on_send_to_($HLSourceCodeFocusRequested(),"onSourceCodeFocusRequested",self);
+_st($1)._on_send_to_($HLSourceCodeFocusRequested(),"onSourceCodeFocusRequested",self);
+$ctx1.sendIdx["on:send:to:"]=13;
+$2=_st($1)._on_send_to_($HLShowTemplate(),"onShowTemplate:",self);
 return self}, function($ctx1) {$ctx1.fill(self,"observeBrowserModel",{},globals.HLBrowserCodeWidget)})},
 args: [],
-source: "observeBrowserModel\x0a\x09self browserModel announcer\x0a\x09\x09on: HLSaveSourceCode\x0a\x09\x09send: #onSaveIt\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowInstanceToggled\x0a\x09\x09send: #onShowInstanceToggled\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeSaved\x0a\x09\x09send: #onSourceCodeSaved\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLAboutToChange\x0a\x09\x09send: #onBrowserAboutToChange:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLParseErrorRaised\x0a\x09\x09send: #onParseError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLCompileErrorRaised\x0a\x09\x09send: #onCompileError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLUnknownVariableErrorRaised\x0a\x09\x09send: #onUnknownVariableError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLInstVarAdded \x0a\x09\x09send: #onInstVarAdded\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLMethodSelected \x0a\x09\x09send: #onMethodSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLClassSelected \x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLPackageSelected \x0a\x09\x09send: #onPackageSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLProtocolSelected \x0a\x09\x09send: #onProtocolSelected: \x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeFocusRequested \x0a\x09\x09send: #onSourceCodeFocusRequested\x0a\x09\x09to: self",
+source: "observeBrowserModel\x0a\x09self browserModel announcer\x0a\x09\x09on: HLSaveSourceCode\x0a\x09\x09send: #onSaveIt\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowInstanceToggled\x0a\x09\x09send: #onShowInstanceToggled\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeSaved\x0a\x09\x09send: #onSourceCodeSaved\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLAboutToChange\x0a\x09\x09send: #onBrowserAboutToChange:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLParseErrorRaised\x0a\x09\x09send: #onParseError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLCompileErrorRaised\x0a\x09\x09send: #onCompileError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLUnknownVariableErrorRaised\x0a\x09\x09send: #onUnknownVariableError:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLInstVarAdded \x0a\x09\x09send: #onInstVarAdded\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLMethodSelected \x0a\x09\x09send: #onMethodSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLClassSelected \x0a\x09\x09send: #onClassSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLPackageSelected \x0a\x09\x09send: #onPackageSelected:\x0a\x09\x09to: self;\x0a\x09\x09\x0a    \x09on: HLProtocolSelected \x0a\x09\x09send: #onProtocolSelected: \x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLSourceCodeFocusRequested \x0a\x09\x09send: #onSourceCodeFocusRequested\x0a\x09\x09to: self;\x0a\x09\x09\x0a\x09\x09on: HLShowTemplate\x0a\x09\x09send: #onShowTemplate:\x0a\x09\x09to: self",
 messageSends: ["on:send:to:", "announcer", "browserModel"],
-referencedClasses: ["HLSaveSourceCode", "HLShowInstanceToggled", "HLSourceCodeSaved", "HLAboutToChange", "HLParseErrorRaised", "HLCompileErrorRaised", "HLUnknownVariableErrorRaised", "HLInstVarAdded", "HLMethodSelected", "HLClassSelected", "HLPackageSelected", "HLProtocolSelected", "HLSourceCodeFocusRequested"]
+referencedClasses: ["HLSaveSourceCode", "HLShowInstanceToggled", "HLSourceCodeSaved", "HLAboutToChange", "HLParseErrorRaised", "HLCompileErrorRaised", "HLUnknownVariableErrorRaised", "HLInstVarAdded", "HLMethodSelected", "HLClassSelected", "HLPackageSelected", "HLProtocolSelected", "HLSourceCodeFocusRequested", "HLShowTemplate"]
 }),
 globals.HLBrowserCodeWidget);
 
@@ -1958,6 +1961,22 @@ referencedClasses: []
 }),
 globals.HLBrowserCodeWidget);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "onShowTemplate:",
+protocol: 'reactions',
+fn: function (anAnnouncement){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+self._contents_(_st(anAnnouncement)._template());
+return self}, function($ctx1) {$ctx1.fill(self,"onShowTemplate:",{anAnnouncement:anAnnouncement},globals.HLBrowserCodeWidget)})},
+args: ["anAnnouncement"],
+source: "onShowTemplate: anAnnouncement\x0a\x09self contents: anAnnouncement template",
+messageSends: ["contents:", "template"],
+referencedClasses: []
+}),
+globals.HLBrowserCodeWidget);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "onSourceCodeFocusRequested",

+ 51 - 0
js/Kernel-Classes.js

@@ -638,6 +638,57 @@ referencedClasses: []
 }),
 globals.Behavior);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "methodTemplate",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$7,$8,$6,$9,$5,$10,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_("messageSelectorAndArgumentNames");
+$ctx2.sendIdx["nextPutAll:"]=1;
+$3=_st($String())._lf();
+$ctx2.sendIdx["lf"]=1;
+$4=_st($String())._tab();
+$ctx2.sendIdx["tab"]=1;
+$2=_st($3).__comma($4);
+$ctx2.sendIdx[","]=1;
+_st(stream)._nextPutAll_($2);
+$ctx2.sendIdx["nextPutAll:"]=2;
+_st(stream)._nextPutAll_("\x22comment stating purpose of message\x22");
+$ctx2.sendIdx["nextPutAll:"]=3;
+$7=_st($String())._lf();
+$ctx2.sendIdx["lf"]=2;
+$8=_st($String())._lf();
+$ctx2.sendIdx["lf"]=3;
+$6=_st($7).__comma($8);
+$ctx2.sendIdx[","]=3;
+$9=_st($String())._tab();
+$ctx2.sendIdx["tab"]=2;
+$5=_st($6).__comma($9);
+$ctx2.sendIdx[","]=2;
+_st(stream)._nextPutAll_($5);
+$ctx2.sendIdx["nextPutAll:"]=4;
+_st(stream)._nextPutAll_("| temporary variable names |");
+$ctx2.sendIdx["nextPutAll:"]=5;
+_st(stream)._nextPutAll_(_st(_st($String())._lf()).__comma(_st($String())._tab()));
+$ctx2.sendIdx["nextPutAll:"]=6;
+$10=_st(stream)._nextPutAll_("statements");
+return $10;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},globals.Behavior)})},
+args: [],
+source: "methodTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream \x0a\x09\x09\x09nextPutAll: 'messageSelectorAndArgumentNames';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: '\x22comment stating purpose of message\x22';\x0a\x09\x09\x09nextPutAll: String lf, String lf, String tab;\x0a\x09\x09\x09nextPutAll: '| temporary variable names |';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'statements' ]",
+messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab"],
+referencedClasses: ["String"]
+}),
+globals.Behavior);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "methods",

+ 46 - 0
js/Kernel-Infrastructure.js

@@ -1461,6 +1461,52 @@ referencedClasses: []
 }),
 globals.Package);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "classTemplate",
+protocol: 'accessing',
+fn: function (){
+var self=this;
+function $String(){return globals.String||(typeof String=="undefined"?nil:String)}
+return smalltalk.withContext(function($ctx1) { 
+var $3,$4,$2,$5,$6,$7,$1;
+$1=_st($String())._streamContents_((function(stream){
+return smalltalk.withContext(function($ctx2) {
+_st(stream)._nextPutAll_("Object");
+$ctx2.sendIdx["nextPutAll:"]=1;
+_st(stream)._nextPutAll_(" subclass: #NameOfSubclass");
+$ctx2.sendIdx["nextPutAll:"]=2;
+$3=_st($String())._lf();
+$ctx2.sendIdx["lf"]=1;
+$4=_st($String())._tab();
+$ctx2.sendIdx["tab"]=1;
+$2=_st($3).__comma($4);
+$ctx2.sendIdx[","]=1;
+_st(stream)._nextPutAll_($2);
+$ctx2.sendIdx["nextPutAll:"]=3;
+$5=_st(stream)._nextPutAll_("instanceVariableNames: ''");
+$ctx2.sendIdx["nextPutAll:"]=4;
+$5;
+$6=_st("'".__comma(_st($String())._lf())).__comma(_st($String())._tab());
+$ctx2.sendIdx[","]=2;
+_st(stream)._nextPutAll_($6);
+$ctx2.sendIdx["nextPutAll:"]=5;
+_st(stream)._nextPutAll_("package: '");
+$ctx2.sendIdx["nextPutAll:"]=6;
+_st(stream)._nextPutAll_(self._name());
+$ctx2.sendIdx["nextPutAll:"]=7;
+$7=_st(stream)._nextPutAll_("'");
+return $7;
+}, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"classTemplate",{},globals.Package)})},
+args: [],
+source: "classTemplate\x0a\x09^ String streamContents: [ :stream |\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: 'Object';\x0a\x09\x09\x09nextPutAll: ' subclass: #NameOfSubclass';\x0a\x09\x09\x09nextPutAll: String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'instanceVariableNames: '''''.\x0a\x09\x09stream\x0a\x09\x09\x09nextPutAll: '''', String lf, String tab;\x0a\x09\x09\x09nextPutAll: 'package: ''';\x0a\x09\x09\x09nextPutAll: self name;\x0a\x09\x09\x09nextPutAll: '''' ]",
+messageSends: ["streamContents:", "nextPutAll:", ",", "lf", "tab", "name"],
+referencedClasses: ["String"]
+}),
+globals.Package);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "classes",

+ 14 - 0
st/Helios-Announcements.st

@@ -286,6 +286,20 @@ HLAnnouncement subclass: #HLShowInstanceToggled
 	instanceVariableNames: ''
 	package: 'Helios-Announcements'!
 
+HLAnnouncement subclass: #HLShowTemplate
+	instanceVariableNames: 'template'
+	package: 'Helios-Announcements'!
+
+!HLShowTemplate methodsFor: 'accessing'!
+
+template
+	^ template
+!
+
+template: aString
+	template := aString
+! !
+
 HLAnnouncement subclass: #HLSourceCodeSaved
 	instanceVariableNames: ''
 	package: 'Helios-Announcements'!

+ 37 - 0
st/Helios-Browser.st

@@ -283,6 +283,20 @@ setClassComment: aString
 	self environment
 		setClassCommentOf: self selectedClass theNonMetaClass
 		to: aString
+!
+
+showClassTemplate
+	self selectedPackage ifNotNil: [ :package |
+		self announcer announce: (HLShowTemplate new
+			template: package classTemplate;
+			yourself) ]
+!
+
+showMethodTemplate
+	self selectedClass ifNotNil: [ :theClass |
+		self announcer announce: (HLShowTemplate new
+			template: theClass methodTemplate;
+			yourself) ]
 ! !
 
 !HLBrowserModel methodsFor: 'commands actions'!
@@ -422,6 +436,15 @@ label
 
 !HLClassesListWidget methodsFor: 'actions'!
 
+focus
+	super focus.
+	
+	self selectedItem 
+		ifNil: [ self model showClassTemplate ]
+		ifNotNil: [ :class |
+			self model announcer announce: (HLClassSelected on: class) ]
+!
+
 focusMethodsListWidget
 	self model announcer announce: HLMethodsListFocus new
 !
@@ -925,6 +948,13 @@ selectorsInProtocol: aString
 
 !HLMethodsListWidget methodsFor: 'actions'!
 
+focus
+	super focus.
+	
+	self selectedItem ifNil: [
+		self model showMethodTemplate ]
+!
+
 observeModel
 	self model announcer 
 		on: HLProtocolSelected 
@@ -1125,6 +1155,12 @@ commitPackage
 	self model commitPackage
 !
 
+focus
+	super focus.
+	self selectedItem ifNotNil: [ :package |
+		self model announcer announce: (HLPackageSelected on: package) ]
+!
+
 focusClassesListWidget
 	self model announcer announce: HLClassesListFocus new
 !
@@ -1153,6 +1189,7 @@ observeSystem
 !
 
 selectItem: aPackage
+	super selectItem: aPackage.
 	self model selectedPackage: aPackage
 ! !
 

+ 8 - 0
st/Helios-Workspace.st

@@ -561,6 +561,10 @@ observeBrowserModel
 		
 		on: HLSourceCodeFocusRequested 
 		send: #onSourceCodeFocusRequested
+		to: self;
+		
+		on: HLShowTemplate
+		send: #onShowTemplate:
 		to: self
 !
 
@@ -699,6 +703,10 @@ onShowInstanceToggled
 	self contents: self browserModel selectedClass definition
 !
 
+onShowTemplate: anAnnouncement
+	self contents: anAnnouncement template
+!
+
 onSourceCodeFocusRequested
 	self focus
 !

+ 12 - 0
st/Kernel-Classes.st

@@ -129,6 +129,18 @@ methodDictionary
 	return dict>
 !
 
+methodTemplate
+	^ String streamContents: [ :stream |
+		stream 
+			nextPutAll: 'messageSelectorAndArgumentNames';
+			nextPutAll: String lf, String tab;
+			nextPutAll: '"comment stating purpose of message"';
+			nextPutAll: String lf, String lf, String tab;
+			nextPutAll: '| temporary variable names |';
+			nextPutAll: String lf, String tab;
+			nextPutAll: 'statements' ]
+!
+
 methods
 	^ self methodDictionary values
 !

+ 14 - 0
st/Kernel-Infrastructure.st

@@ -559,6 +559,20 @@ basicTransport
 	<return self.transport>
 !
 
+classTemplate
+	^ String streamContents: [ :stream |
+		stream
+			nextPutAll: 'Object';
+			nextPutAll: ' subclass: #NameOfSubclass';
+			nextPutAll: String lf, String tab;
+			nextPutAll: 'instanceVariableNames: '''''.
+		stream
+			nextPutAll: '''', String lf, String tab;
+			nextPutAll: 'package: ''';
+			nextPutAll: self name;
+			nextPutAll: '''' ]
+!
+
 definition
 	^ String streamContents: [ :stream |
 		stream