Browse Source

Merge remote-tracking branch 'remotes/johnyt/announcements'

Nicolas Petton 11 years ago
parent
commit
03b598f93b

+ 3 - 3
bin/server.bat

@@ -1,3 +1,3 @@
-@cd "%~dp0\.." 
-@node server\server.js %*
-
+@cd "%~dp0\.." 
+@node .\cli\js\amber-cli.js serve %*
+

+ 4 - 1
css/helios.css

@@ -370,6 +370,9 @@ i {
     vertical-align: text-top;
 }
 
+.tool_container .pane .nav-pills i.announcement {
+    background-image: url('../images/announcement.png');
+}
 .tool_container .pane .nav-pills i.class {
     background-image: url('../images/class.png');
 }
@@ -844,4 +847,4 @@ i {
     margin: 0;
     padding: 0;
     border: 0;
-}
+}

BIN
images/announcement.png


+ 11 - 0
js/Helios-Announcements.deploy.js

@@ -28,6 +28,17 @@ smalltalk.HLAboutToChange);
 
 smalltalk.addClass('HLAnnouncement', smalltalk.Object, [], 'Helios-Announcements');
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return "announcement";
+}, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.HLAnnouncement.klass)})},
+messageSends: []}),
+smalltalk.HLAnnouncement.klass);
+
 
 smalltalk.addClass('HLCodeHandled', smalltalk.HLAnnouncement, ['code'], 'Helios-Announcements');
 smalltalk.addMethod(

+ 22 - 0
js/Helios-Announcements.js

@@ -37,9 +37,27 @@ smalltalk.HLAboutToChange);
 
 
 smalltalk.addClass('HLAnnouncement', smalltalk.Object, [], 'Helios-Announcements');
+smalltalk.HLAnnouncement.comment="I am the root of the announcement class hierarchy used in the Helios UI."
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+category: 'helios',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return "announcement";
+}, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.HLAnnouncement.klass)})},
+args: [],
+source: "heliosClass\x0a\x09^ 'announcement'",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.HLAnnouncement.klass);
 
 
 smalltalk.addClass('HLCodeHandled', smalltalk.HLAnnouncement, ['code'], 'Helios-Announcements');
+smalltalk.HLCodeHandled.comment="I am the root class of announcements emitted by `HLCodeWidget`s"
 smalltalk.addMethod(
 smalltalk.method({
 selector: "code",
@@ -98,15 +116,19 @@ smalltalk.HLCodeHandled.klass);
 
 
 smalltalk.addClass('HLDoItExecuted', smalltalk.HLCodeHandled, [], 'Helios-Announcements');
+smalltalk.HLDoItExecuted.comment="I am emitted by a `HLCodeWidget` after a DoIt has been executed."
 
 
 smalltalk.addClass('HLDoItRequested', smalltalk.HLCodeHandled, [], 'Helios-Announcements');
+smalltalk.HLDoItRequested.comment="I am emitted by a `HLCodeWidget` before a DoIt is executed."
 
 
 smalltalk.addClass('HLInspectItRequested', smalltalk.HLCodeHandled, [], 'Helios-Announcements');
+smalltalk.HLInspectItRequested.comment="I am emitted by a `HLCodeWidget` before an object is inspected."
 
 
 smalltalk.addClass('HLPrintItRequested', smalltalk.HLCodeHandled, [], 'Helios-Announcements');
+smalltalk.HLPrintItRequested.comment="I am emitted by a `HLCodeWidget` before an object is printed."
 
 
 smalltalk.addClass('HLDebuggerContextSelected', smalltalk.HLAnnouncement, ['context'], 'Helios-Announcements');

+ 11 - 0
js/Kernel-Announcements.deploy.js

@@ -268,6 +268,17 @@ messageSends: []}),
 smalltalk.SystemAnnouncement);
 
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return "announcement";
+}, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.SystemAnnouncement.klass)})},
+messageSends: []}),
+smalltalk.SystemAnnouncement.klass);
+
 
 smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
 smalltalk.addMethod(

+ 16 - 0
js/Kernel-Announcements.js

@@ -362,6 +362,22 @@ referencedClasses: []
 smalltalk.SystemAnnouncement);
 
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "heliosClass",
+category: 'helios',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+return "announcement";
+}, function($ctx1) {$ctx1.fill(self,"heliosClass",{},smalltalk.SystemAnnouncement.klass)})},
+args: [],
+source: "heliosClass\x0a\x09^ 'announcement'",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.SystemAnnouncement.klass);
+
 
 smalltalk.addClass('ClassAnnouncement', smalltalk.SystemAnnouncement, ['theClass'], 'Kernel-Announcements');
 smalltalk.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements."

+ 28 - 0
js/Kernel-Tests.deploy.js

@@ -1874,6 +1874,34 @@ messageSends: []}),
 smalltalk.StringTest.klass);
 
 
+smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testShow",
+fn: function (){
+var self=this;
+var originalTranscript;
+function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
+function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
+function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+originalTranscript=_st($Transcript())._current();
+_st($Transcript())._register_(_st($ConsoleTranscript())._new());
+_st(self)._shouldnt_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Transcript())._show_("Hello console!");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
+_st(self)._shouldnt_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Transcript())._show_(console);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
+_st($Transcript())._register_(originalTranscript);
+return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
+messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]}),
+smalltalk.ConsoleTranscriptTest);
+
+
+
 smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 33 - 0
js/Kernel-Tests.js

@@ -2344,6 +2344,39 @@ referencedClasses: ["String"]
 smalltalk.StringTest.klass);
 
 
+smalltalk.addClass('ConsoleTranscriptTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testShow",
+category: 'tests',
+fn: function (){
+var self=this;
+var originalTranscript;
+function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
+function $ConsoleTranscript(){return smalltalk.ConsoleTranscript||(typeof ConsoleTranscript=="undefined"?nil:ConsoleTranscript)}
+function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
+return smalltalk.withContext(function($ctx1) { 
+originalTranscript=_st($Transcript())._current();
+_st($Transcript())._register_(_st($ConsoleTranscript())._new());
+_st(self)._shouldnt_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Transcript())._show_("Hello console!");
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
+_st(self)._shouldnt_raise_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st($Transcript())._show_(console);
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1)})}),$Error());
+_st($Transcript())._register_(originalTranscript);
+return self}, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},smalltalk.ConsoleTranscriptTest)})},
+args: [],
+source: "testShow\x0a| originalTranscript |\x0aoriginalTranscript := Transcript current.\x0aTranscript register: ConsoleTranscript new.\x0a\x0aself shouldnt: [ Transcript show: 'Hello console!' ] raise: Error.\x0aself shouldnt: [ Transcript show: console ] raise: Error.\x0a\x0aTranscript register: originalTranscript.",
+messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"],
+referencedClasses: ["Transcript", "ConsoleTranscript", "Error"]
+}),
+smalltalk.ConsoleTranscriptTest);
+
+
+
 smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
 smalltalk.addMethod(
 smalltalk.method({

+ 1 - 1
js/Kernel-Transcript.deploy.js

@@ -36,7 +36,7 @@ selector: "show:",
 fn: function (anObject){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-console.log(String(string._asString()));
+console.log(String(_st(anObject)._asString()));
 return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
 messageSends: []}),
 smalltalk.ConsoleTranscript);

+ 2 - 2
js/Kernel-Transcript.js

@@ -53,10 +53,10 @@ category: 'printing',
 fn: function (anObject){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
-console.log(String(string._asString()));
+console.log(String(_st(anObject)._asString()));
 return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
 args: ["anObject"],
-source: "show: anObject\x0a\x09<console.log(String(string._asString()))>",
+source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String(_st(anObject)._asString()))>",
 messageSends: [],
 referencedClasses: []
 }),

+ 18 - 0
st/Helios-Announcements.st

@@ -16,10 +16,20 @@ actionBlock: aBlock
 Object subclass: #HLAnnouncement
 	instanceVariableNames: ''
 	package: 'Helios-Announcements'!
+!HLAnnouncement commentStamp!
+I am the root of the announcement class hierarchy used in the Helios UI.!
+
+!HLAnnouncement class methodsFor: 'helios'!
+
+heliosClass
+	^ 'announcement'
+! !
 
 HLAnnouncement subclass: #HLCodeHandled
 	instanceVariableNames: 'code'
 	package: 'Helios-Announcements'!
+!HLCodeHandled commentStamp!
+I am the root class of announcements emitted by `HLCodeWidget`s!
 
 !HLCodeHandled methodsFor: 'accessing'!
 
@@ -45,18 +55,26 @@ on: aCodeModel
 HLCodeHandled subclass: #HLDoItExecuted
 	instanceVariableNames: ''
 	package: 'Helios-Announcements'!
+!HLDoItExecuted commentStamp!
+I am emitted by a `HLCodeWidget` after a DoIt has been executed.!
 
 HLCodeHandled subclass: #HLDoItRequested
 	instanceVariableNames: ''
 	package: 'Helios-Announcements'!
+!HLDoItRequested commentStamp!
+I am emitted by a `HLCodeWidget` before a DoIt is executed.!
 
 HLCodeHandled subclass: #HLInspectItRequested
 	instanceVariableNames: ''
 	package: 'Helios-Announcements'!
+!HLInspectItRequested commentStamp!
+I am emitted by a `HLCodeWidget` before an object is inspected.!
 
 HLCodeHandled subclass: #HLPrintItRequested
 	instanceVariableNames: ''
 	package: 'Helios-Announcements'!
+!HLPrintItRequested commentStamp!
+I am emitted by a `HLCodeWidget` before an object is printed.!
 
 HLAnnouncement subclass: #HLDebuggerContextSelected
 	instanceVariableNames: 'context'

+ 6 - 0
st/Kernel-Announcements.st

@@ -159,6 +159,12 @@ theClass: aClass
 	theClass := aClass
 ! !
 
+!SystemAnnouncement class methodsFor: 'helios'!
+
+heliosClass
+	^ 'announcement'
+! !
+
 SystemAnnouncement subclass: #ClassAnnouncement
 	instanceVariableNames: 'theClass'
 	package: 'Kernel-Announcements'!

+ 17 - 0
st/Kernel-Tests.st

@@ -890,6 +890,23 @@ collectionClass
 	^ String
 ! !
 
+TestCase subclass: #ConsoleTranscriptTest
+	instanceVariableNames: ''
+	package: 'Kernel-Tests'!
+
+!ConsoleTranscriptTest methodsFor: 'tests'!
+
+testShow
+| originalTranscript |
+originalTranscript := Transcript current.
+Transcript register: ConsoleTranscript new.
+
+self shouldnt: [ Transcript show: 'Hello console!!' ] raise: Error.
+self shouldnt: [ Transcript show: console ] raise: Error.
+
+Transcript register: originalTranscript.
+! !
+
 TestCase subclass: #JSObjectProxyTest
 	instanceVariableNames: ''
 	package: 'Kernel-Tests'!

+ 2 - 1
st/Kernel-Transcript.st

@@ -23,7 +23,8 @@ cr
 !
 
 show: anObject
-	<console.log(String(string._asString()))>
+"Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy."
+<console.log(String(_st(anObject)._asString()))>
 ! !
 
 !ConsoleTranscript class methodsFor: 'initialization'!