Browse Source

Merge remote-tracking branch 'upstream/master'

Laurent Laffont 12 years ago
parent
commit
0e6611a7a1
7 changed files with 519 additions and 431 deletions
  1. 9 2
      css/amber.css
  2. 3 141
      js/IDE.deploy.js
  3. 7 205
      js/IDE.js
  4. 139 0
      js/Kernel.deploy.js
  5. 199 0
      js/Kernel.js
  6. 95 83
      st/IDE.st
  7. 67 0
      st/Kernel.st

+ 9 - 2
css/amber.css

@@ -264,17 +264,24 @@ body.jtalkBody {
     z-index: 1;
 }
 
+.jtalkTool .jt_commit_local {
+    position: absolute;
+    top: 129px;
+    left: 60px;
+    z-index: 1;
+}
+
 .jtalkTool .jt_rename {
     position: absolute;
     top: 129px;
-    left: 90px;
+    left: 105px;
     z-index: 1;
 }
 
 .jtalkTool .jt_delete {
     position: absolute;
     top: 129px;
-    left: 185px;
+    left: 165px;
     z-index: 1;
 }
 

File diff suppressed because it is too large
+ 3 - 141
js/IDE.deploy.js


File diff suppressed because it is too large
+ 7 - 205
js/IDE.js


+ 139 - 0
js/Kernel.deploy.js

@@ -6162,3 +6162,142 @@ smalltalk.Set);
 
 
 
+smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel');
+
+smalltalk.Transcript.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+'_open',
+smalltalk.method({
+selector: 'open',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_open", []);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_new',
+smalltalk.method({
+selector: 'new',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_shouldNotImplement", []);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_current',
+smalltalk.method({
+selector: 'current',
+fn: function (){
+var self=this;
+return self['@current'];
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_show_',
+smalltalk.method({
+selector: 'show:',
+fn: function (anObject){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [anObject]);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_cr',
+smalltalk.method({
+selector: 'cr',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_clear',
+smalltalk.method({
+selector: 'clear',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_clear", []);
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+'_register_',
+smalltalk.method({
+selector: 'register:',
+fn: function (aTranscript){
+var self=this;
+self['@current']=aTranscript;
+return self;}
+}),
+smalltalk.Transcript.klass);
+
+
+smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel');
+smalltalk.addMethod(
+'_clear',
+smalltalk.method({
+selector: 'clear',
+fn: function (){
+var self=this;
+
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+'_cr',
+smalltalk.method({
+selector: 'cr',
+fn: function (){
+var self=this;
+
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+'_show_',
+smalltalk.method({
+selector: 'show:',
+fn: function (anObject){
+var self=this;
+console.log(String(anObject._asString()));
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+'_open',
+smalltalk.method({
+selector: 'open',
+fn: function (){
+var self=this;
+
+return self;}
+}),
+smalltalk.ConsoleTranscript);
+
+
+smalltalk.addMethod(
+'_initialize',
+smalltalk.method({
+selector: 'initialize',
+fn: function (){
+var self=this;
+smalltalk.send((smalltalk.Transcript || Transcript), "_register_", [smalltalk.send(self, "_new", [])]);
+return self;}
+}),
+smalltalk.ConsoleTranscript.klass);
+
+

+ 199 - 0
js/Kernel.js

@@ -8769,3 +8769,202 @@ smalltalk.Set);
 
 
 
+smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel');
+
+smalltalk.Transcript.klass.iVarNames = ['current'];
+smalltalk.addMethod(
+unescape('_open'),
+smalltalk.method({
+selector: unescape('open'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_open", []);
+return self;},
+args: [],
+source: unescape('open%0A%20%20%20%20self%20current%20open'),
+messageSends: ["open", "current"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_new'),
+smalltalk.method({
+selector: unescape('new'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_shouldNotImplement", []);
+return self;},
+args: [],
+source: unescape('new%0A%20%20%20%20self%20shouldNotImplement'),
+messageSends: ["shouldNotImplement"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_current'),
+smalltalk.method({
+selector: unescape('current'),
+category: 'instance creation',
+fn: function (){
+var self=this;
+return self['@current'];
+return self;},
+args: [],
+source: unescape('current%0A%20%20%20%20%5Ecurrent'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_show_'),
+smalltalk.method({
+selector: unescape('show%3A'),
+category: 'printing',
+fn: function (anObject){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [anObject]);
+return self;},
+args: ["anObject"],
+source: unescape('show%3A%20anObject%0A%20%20%20%20self%20current%20show%3A%20anObject'),
+messageSends: ["show:", "current"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_cr'),
+smalltalk.method({
+selector: unescape('cr'),
+category: 'printing',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_show_", [smalltalk.send((smalltalk.String || String), "_cr", [])]);
+return self;},
+args: [],
+source: unescape('cr%0A%20%20%20%20self%20current%20show%3A%20String%20cr'),
+messageSends: ["show:", "current", "cr"],
+referencedClasses: [smalltalk.String]
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_clear'),
+smalltalk.method({
+selector: unescape('clear'),
+category: 'printing',
+fn: function (){
+var self=this;
+smalltalk.send(smalltalk.send(self, "_current", []), "_clear", []);
+return self;},
+args: [],
+source: unescape('clear%0A%20%20%20%20self%20current%20clear'),
+messageSends: ["clear", "current"],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+smalltalk.addMethod(
+unescape('_register_'),
+smalltalk.method({
+selector: unescape('register%3A'),
+category: 'instance creation',
+fn: function (aTranscript){
+var self=this;
+self['@current']=aTranscript;
+return self;},
+args: ["aTranscript"],
+source: unescape('register%3A%20aTranscript%0A%09current%20%3A%3D%20aTranscript'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Transcript.klass);
+
+
+smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel');
+smalltalk.addMethod(
+unescape('_clear'),
+smalltalk.method({
+selector: unescape('clear'),
+category: 'printing',
+fn: function (){
+var self=this;
+
+return self;},
+args: [],
+source: unescape('clear%0A%09%22no%20op%22'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+unescape('_cr'),
+smalltalk.method({
+selector: unescape('cr'),
+category: 'printing',
+fn: function (){
+var self=this;
+
+return self;},
+args: [],
+source: unescape('cr%0A%09%22no%20op%22'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+unescape('_show_'),
+smalltalk.method({
+selector: unescape('show%3A'),
+category: 'printing',
+fn: function (anObject){
+var self=this;
+console.log(String(anObject._asString()));
+return self;},
+args: ["anObject"],
+source: unescape('show%3A%20anObject%0A%09%3Cconsole.log%28String%28anObject._asString%28%29%29%29%3E'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+smalltalk.addMethod(
+unescape('_open'),
+smalltalk.method({
+selector: unescape('open'),
+category: 'actions',
+fn: function (){
+var self=this;
+
+return self;},
+args: [],
+source: unescape('open'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.ConsoleTranscript);
+
+
+smalltalk.addMethod(
+unescape('_initialize'),
+smalltalk.method({
+selector: unescape('initialize'),
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send((smalltalk.Transcript || Transcript), "_register_", [smalltalk.send(self, "_new", [])]);
+return self;},
+args: [],
+source: unescape('initialize%0A%09Transcript%20register%3A%20self%20new'),
+messageSends: ["register:", "new"],
+referencedClasses: [smalltalk.Transcript]
+}),
+smalltalk.ConsoleTranscript.klass);
+
+

+ 95 - 83
st/IDE.st

@@ -119,7 +119,7 @@ initialize
 	addClass: 'jtalkBody'.
     self appendToJQuery: '#jtalk' asJQuery.
     self 
-	addTab: Transcript current;
+	addTab: IDETranscript current;
 	addTab: Workspace new;
 	addTab: TestRunner new.
     self selectTab: self tabs last.
@@ -338,79 +338,8 @@ renderButtonsOn: html
 	onClick: [self clearWorkspace]
 ! !
 
-TabWidget subclass: #Transcript
-	instanceVariableNames: 'textarea'
-	category: 'IDE'!
-
-!Transcript methodsFor: 'accessing'!
-
-label
-    ^'Transcript'
-! !
-
-!Transcript methodsFor: 'actions'!
-
-show: anObject
-    textarea asJQuery val: textarea asJQuery val, anObject asString.
-!
-
-cr
-    textarea asJQuery val: textarea asJQuery val, String cr.
-!
-
-clear
-    textarea asJQuery val: ''
-! !
-
-!Transcript methodsFor: 'rendering'!
-
-renderBoxOn: html
-    textarea := html textarea.
-    textarea 
-	class: 'jt_transcript';
-	at: 'spellcheck' put: 'false'
-!
-
-renderButtonsOn: html
-    html button
-	with: 'Clear transcript';
-	onClick: [self clear]
-! !
-
-Transcript class instanceVariableNames: 'current'!
-
-!Transcript class methodsFor: 'instance creation'!
-
-open
-    TabManager current 
-	open;
-	selectTab: self current
-!
-
-new
-    self shouldNotImplement
-!
-
-current
-    ^current ifNil: [current := super new]
-! !
-
-!Transcript class methodsFor: 'printing'!
-
-show: anObject
-    self current show: anObject
-!
-
-cr
-    self current show: String cr
-!
-
-clear
-    self current clear
-! !
-
 TabWidget subclass: #Browser
-	instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod commitButton packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges renameButton deleteButton'
+	instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod commitButton packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges renameButton deleteButton commitLocalButton'
 	category: 'IDE'!
 
 !Browser methodsFor: 'accessing'!
@@ -587,7 +516,7 @@ compileMethodDefinition
 !
 
 compileMethodDefinitionFor: aClass
-    | compiler method source node |
+    | compiler method source node | 
     source := sourceArea val.
     selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
     compiler := Compiler new.
@@ -599,9 +528,9 @@ compileMethodDefinitionFor: aClass
     method := compiler eval: (compiler compileNode: node).
     method category: selectedProtocol.
     compiler unknownVariables do: [:each |
-        "Do not try to redeclare javascript's objects"
-        (window at: each) ifNil: [
-		(self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
+         "Do not try to redeclare javascript's objects"
+         (window at: each) ifNil: [
+	 	(self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
 			self addInstanceVariableNamed: each toClass: aClass.
 			^self compileMethodDefinitionFor: aClass]]].
     aClass addCompiledMethod: method.
@@ -789,9 +718,10 @@ renamePackage
 
   | newName |
   newName := self prompt: 'Rename package ', selectedPackage.
-  newName notEmpty ifTrue: [
+  newName ifNotNil: [
+    newName notEmpty ifTrue: [
 	Smalltalk current renamePackage: selectedPackage to: newName.
-	self updateCategoriesList]
+	self updateCategoriesList]]
 !
 
 removePackage
@@ -800,6 +730,14 @@ removePackage
 	ifTrue: [
 	    Smalltalk current removePackage: selectedPackage.
 	    self updateCategoriesList]
+!
+
+commitPackageToLocalStorage
+	| key sourceCode |
+	selectedPackage ifNotNil: [
+          	key := 'smalltalk.packages.' , selectedPackage.
+		sourceCode := (Exporter new exportPackage: selectedPackage).
+		<localStorage[key] = sourceCode>]
 ! !
 
 !Browser methodsFor: 'initialization'!
@@ -828,17 +766,22 @@ renderTopPanelOn: html
 		class: 'jt_commit';
 		title: 'Commit classes in this package to disk';
 		onClick: [self commitPackage];
-		with: 'Commit package'.
+		with: 'Commit'.
+            commitLocalButton := html button 
+		class: 'jt_commit_local';
+		title: 'Commit classes in this package to local storage';
+		onClick: [self commitPackageToLocalStorage];
+		with: 'Local'.
             renameButton := html button 
 		class: 'jt_rename';
-		title: 'Rename this package';
+		title: 'Rename package';
 		onClick: [self renamePackage];
-		with: 'Rename package'.
+		with: 'Rename'.
             deleteButton := html button 
 		class: 'jt_delete';
 		title: 'Remove this package from the system';
 		onClick: [self removePackage];
-		with: 'Remove package'.
+		with: 'Remove'.
 	    classesList := ClassesList on: self.
 	    classesList renderOn: html.
 	    protocolsList := html ul class: 'jt_column browser protocols'.
@@ -2214,6 +2157,75 @@ updateStatusDiv
 		html span with: self statusInfo]
 ! !
 
+TabWidget subclass: #IDETranscript
+	instanceVariableNames: 'textarea'
+	category: 'IDE'!
+
+!IDETranscript methodsFor: 'accessing'!
+
+label
+    ^'Transcript'
+! !
+
+!IDETranscript methodsFor: 'actions'!
+
+clear
+    textarea asJQuery val: ''
+!
+
+cr
+    textarea asJQuery val: textarea asJQuery val, String cr.
+!
+
+show: anObject
+    textarea asJQuery val: textarea asJQuery val, anObject asString.
+!
+
+open
+    TabManager current 
+	open;
+	selectTab: self
+! !
+
+!IDETranscript methodsFor: 'rendering'!
+
+renderBoxOn: html
+    textarea := html textarea.
+    textarea 
+	class: 'jt_transcript';
+	at: 'spellcheck' put: 'false'
+!
+
+renderButtonsOn: html
+    html button
+	with: 'Clear transcript';
+	onClick: [self clear]
+! !
+
+IDETranscript class instanceVariableNames: 'current'!
+
+!IDETranscript class methodsFor: 'initialization'!
+
+initialize
+	Transcript register: self current
+! !
+
+!IDETranscript class methodsFor: 'instance creation'!
+
+new
+    self shouldNotImplement
+!
+
+open
+    TabManager current 
+	open;
+	selectTab: self current
+!
+
+current
+	^current ifNil: [current := super new]
+! !
+
 !Object methodsFor: '*IDE'!
 
 inspect

+ 67 - 0
st/Kernel.st

@@ -3104,3 +3104,70 @@ includes: anObject
 	^elements includes: anObject
 ! !
 
+Object subclass: #Transcript
+	instanceVariableNames: 'textarea'
+	category: 'Kernel'!
+
+Transcript class instanceVariableNames: 'current'!
+
+!Transcript class methodsFor: 'instance creation'!
+
+open
+    self current open
+!
+
+new
+    self shouldNotImplement
+!
+
+current
+    ^current
+!
+
+register: aTranscript
+	current := aTranscript
+! !
+
+!Transcript class methodsFor: 'printing'!
+
+show: anObject
+    self current show: anObject
+!
+
+cr
+    self current show: String cr
+!
+
+clear
+    self current clear
+! !
+
+Object subclass: #ConsoleTranscript
+	instanceVariableNames: 'textarea'
+	category: 'Kernel'!
+
+!ConsoleTranscript methodsFor: 'actions'!
+
+open
+! !
+
+!ConsoleTranscript methodsFor: 'printing'!
+
+clear
+	"no op"
+!
+
+cr
+	"no op"
+!
+
+show: anObject
+	<console.log(String(anObject._asString()))>
+! !
+
+!ConsoleTranscript class methodsFor: 'initialization'!
+
+initialize
+	Transcript register: self new
+! !
+

Some files were not shown because too many files changed in this diff