resin 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. data/README.markdown +2 -0
  2. data/amber/bin/nodecompile.js +3 -3
  3. data/amber/css/amber.css +47 -23
  4. data/amber/images/off.amber.png +0 -0
  5. data/amber/images/offHover.amber.png +0 -0
  6. data/amber/images/sprite.amber.png +0 -0
  7. data/amber/images/tinylogo.amber.png +0 -0
  8. data/amber/js/Benchfib.deploy.js +34 -34
  9. data/amber/js/Benchfib.js +49 -49
  10. data/amber/js/Canvas.deploy.js +937 -937
  11. data/amber/js/Canvas.js +1622 -1622
  12. data/amber/js/Compiler-Tests.deploy.js +97 -0
  13. data/amber/js/Compiler-Tests.js +137 -0
  14. data/amber/js/Compiler.deploy.js +1030 -924
  15. data/amber/js/Compiler.js +1613 -1467
  16. data/amber/js/Documentation.deploy.js +417 -417
  17. data/amber/js/Documentation.js +728 -728
  18. data/amber/js/Examples.deploy.js +24 -13
  19. data/amber/js/Examples.js +36 -19
  20. data/amber/js/IDE.deploy.js +1583 -1527
  21. data/amber/js/IDE.js +2586 -2510
  22. data/amber/js/Kernel-Announcements.deploy.js +19 -19
  23. data/amber/js/Kernel-Announcements.js +28 -28
  24. data/amber/js/Kernel-Classes.deploy.js +332 -229
  25. data/amber/js/Kernel-Classes.js +532 -384
  26. data/amber/js/Kernel-Collections.deploy.js +1516 -1712
  27. data/amber/js/Kernel-Collections.js +2436 -2712
  28. data/amber/js/Kernel-Exceptions.deploy.js +85 -62
  29. data/amber/js/Kernel-Exceptions.js +131 -98
  30. data/amber/js/Kernel-Methods.deploy.js +326 -378
  31. data/amber/js/Kernel-Methods.js +473 -525
  32. data/amber/js/Kernel-Objects.deploy.js +1777 -2428
  33. data/amber/js/Kernel-Objects.js +2599 -3426
  34. data/amber/js/Kernel-Tests.deploy.js +871 -772
  35. data/amber/js/Kernel-Tests.js +1207 -1083
  36. data/amber/js/Kernel-Transcript.deploy.js +57 -57
  37. data/amber/js/Kernel-Transcript.js +94 -94
  38. data/amber/js/SUnit.deploy.js +116 -116
  39. data/amber/js/SUnit.js +211 -211
  40. data/amber/js/amber.js +10 -11
  41. data/amber/js/boot.js +132 -156
  42. data/amber/js/init.js +2 -2
  43. data/amber/js/parser.js +2095 -3014
  44. data/amber/js/parser.pegjs +1 -1
  45. data/amber/st/Benchfib.st +22 -22
  46. data/amber/st/Canvas.st +471 -471
  47. data/amber/st/Compiler-Tests.st +471 -0
  48. data/amber/st/Compiler.st +858 -794
  49. data/amber/st/Examples.st +22 -5
  50. data/amber/st/IDE.st +1326 -1291
  51. data/amber/st/Kernel-Announcements.st +2 -2
  52. data/amber/st/Kernel-Classes.st +148 -90
  53. data/amber/st/Kernel-Collections.st +950 -1061
  54. data/amber/st/Kernel-Exceptions.st +33 -25
  55. data/amber/st/Kernel-Methods.st +151 -151
  56. data/amber/st/Kernel-Objects.st +891 -1036
  57. data/amber/st/Kernel-Tests.st +622 -544
  58. data/amber/st/Kernel-Transcript.st +38 -38
  59. data/amber/st/SUnit.st +53 -53
  60. metadata +27 -20
@@ -1,17 +1,23 @@
1
1
  Smalltalk current createPackage: 'Examples' properties: #{}!
2
2
  Widget subclass: #Counter
3
3
  instanceVariableNames: 'count header'
4
- category: 'Examples'!
4
+ package: 'Examples'!
5
+ !Counter commentStamp!
6
+ This is a trivial Widget example mimicking the classic Counter example in Seaside.
7
+ In order to play with it, just select the doit below and press the Do it button in the far right corner.
8
+ Then take a look in the HTML document above the IDE.
9
+
10
+ Counter new appendToJQuery: 'body' asJQuery!
5
11
 
6
12
  !Counter methodsFor: 'actions'!
7
13
 
8
- increase
9
- count := count + 1.
14
+ decrease
15
+ count := count - 1.
10
16
  header contents: [:html | html with: count asString]
11
17
  !
12
18
 
13
- decrease
14
- count := count - 1.
19
+ increase
20
+ count := count + 1.
15
21
  header contents: [:html | html with: count asString]
16
22
  ! !
17
23
 
@@ -36,3 +42,14 @@ renderOn: html
36
42
  onClick: [self decrease]
37
43
  ! !
38
44
 
45
+ !Counter class methodsFor: 'example'!
46
+
47
+ tryExample
48
+ "In order to play with the Counter, just select the
49
+ doit below and press the Do it button. Then take a
50
+ look in the HTML document above the IDE."
51
+
52
+ "Counter tryExample"
53
+ self new appendToJQuery: 'body' asJQuery
54
+ ! !
55
+
@@ -1,299 +1,207 @@
1
1
  Smalltalk current createPackage: 'IDE' properties: #{}!
2
- Widget subclass: #TabManager
3
- instanceVariableNames: 'selectedTab tabs opened ul input'
4
- category: 'IDE'!
5
-
6
- !TabManager methodsFor: 'accessing'!
7
-
8
- tabs
9
- ^tabs ifNil: [tabs := Array new]
10
- !
11
-
12
- labelFor: aWidget
13
- | label maxSize |
14
- maxSize := 15.
15
- label := aWidget label copyFrom: 0 to: (aWidget label size min: maxSize).
16
- aWidget label size > maxSize ifTrue: [
17
- label := label, '...'].
18
- ^label
19
- ! !
20
-
21
- !TabManager methodsFor: 'actions'!
22
-
23
- updateBodyMargin
24
- self setBodyMargin: '#jtalk' asJQuery height
25
- !
26
-
27
- updatePosition
28
- <jQuery('#jtalk').css('top', '').css('bottom', '0px')>
29
- !
30
-
31
- removeBodyMargin
32
- self setBodyMargin: 0
33
- !
34
-
35
- setBodyMargin: anInteger
36
- '.jtalkBody' asJQuery css: 'margin-bottom' put: anInteger asString, 'px'
37
- !
38
-
39
- onResize: aBlock
40
- <jQuery('#jtalk').resizable({
41
- handles: 'n',
42
- resize: aBlock,
43
- minHeight: 230
44
- })>
45
- !
46
-
47
- onWindowResize: aBlock
48
- <jQuery(window).resize(aBlock)>
49
- !
2
+ Widget subclass: #ClassesList
3
+ instanceVariableNames: 'browser ul nodes'
4
+ package: 'IDE'!
50
5
 
51
- open
52
- opened ifFalse: [
53
- 'body' asJQuery addClass: 'jtalkBody'.
54
- '#jtalk' asJQuery show.
55
- ul asJQuery show.
56
- self updateBodyMargin.
57
- selectedTab show.
58
- opened := true]
59
- !
6
+ !ClassesList methodsFor: 'accessing'!
60
7
 
61
- close
62
- opened ifTrue: [
63
- '#jtalk' asJQuery hide.
64
- ul asJQuery hide.
65
- selectedTab hide.
66
- self removeBodyMargin.
67
- 'body' asJQuery removeClass: 'jtalkBody'.
68
- opened := false]
8
+ browser
9
+ ^browser
69
10
  !
70
11
 
71
- newBrowserTab
72
- Browser open
12
+ browser: aBrowser
13
+ browser := aBrowser
73
14
  !
74
15
 
75
- selectTab: aWidget
76
- self open.
77
- selectedTab := aWidget.
78
- self tabs do: [:each |
79
- each hide].
80
- aWidget show.
81
-
82
- self update
16
+ category
17
+ ^self browser selectedPackage
83
18
  !
84
19
 
85
- closeTab: aWidget
86
- self removeTab: aWidget.
87
- self selectTab: self tabs last.
88
- aWidget remove.
89
- self update
20
+ getNodes
21
+ | classes children others |
22
+ classes := self browser classes.
23
+ children := #().
24
+ others := #().
25
+ classes do: [:each |
26
+ (classes includes: each superclass)
27
+ ifFalse: [children add: each]
28
+ ifTrue: [others add: each]].
29
+ ^children collect: [:each |
30
+ ClassesListNode on: each browser: self browser classes: others level: 0]
90
31
  !
91
32
 
92
- search: aString
93
- | searchedClass |
94
- searchedClass := Smalltalk current at: aString.
95
- searchedClass isClass
96
- ifTrue: [Browser openOn: searchedClass]
97
- ifFalse: [ReferencesBrowser search: aString]
98
- ! !
99
-
100
- !TabManager methodsFor: 'adding/Removing'!
101
-
102
- addTab: aWidget
103
- self tabs add: aWidget.
104
- aWidget appendToJQuery: '#jtalk' asJQuery.
105
- aWidget hide
33
+ nodes
34
+ nodes ifNil: [nodes := self getNodes].
35
+ ^nodes
106
36
  !
107
37
 
108
- removeTab: aWidget
109
- self tabs remove: aWidget.
110
- self update
111
- ! !
112
-
113
- !TabManager methodsFor: 'initialization'!
114
-
115
- initialize
116
- super initialize.
117
- opened := true.
118
- [:html | html div id: 'jtalk'] appendToJQuery: 'body' asJQuery.
119
- 'body' asJQuery
120
- addClass: 'jtalkBody'.
121
- self appendToJQuery: '#jtalk' asJQuery.
122
- self
123
- addTab: IDETranscript current;
124
- addTab: Workspace new;
125
- addTab: TestRunner new.
126
- self selectTab: self tabs last.
127
- self
128
- onResize: [self updateBodyMargin; updatePosition];
129
- onWindowResize: [self updatePosition]
38
+ resetNodes
39
+ nodes := nil
130
40
  ! !
131
41
 
132
- !TabManager methodsFor: 'rendering'!
42
+ !ClassesList methodsFor: 'rendering'!
133
43
 
134
44
  renderOn: html
135
- html div id: 'logo'.
136
- self renderToolbarOn: html.
137
45
  ul := html ul
138
- id: 'jtalkTabs';
46
+ class: 'jt_column browser classes';
139
47
  yourself.
140
- self renderTabs
141
- !
142
-
143
- renderTabFor: aWidget on: html
144
- | li |
145
- li := html li.
146
- selectedTab = aWidget ifTrue: [
147
- li class: 'selected'].
148
- li with: [
149
- html span class: 'ltab'.
150
- html span
151
- class: 'mtab';
152
- with: [
153
- aWidget canBeClosed ifTrue: [
154
- html span
155
- class: 'close';
156
- with: 'x';
157
- onClick: [self closeTab: aWidget]].
158
- html span with: (self labelFor: aWidget)].
159
- html span class: 'rtab'];
160
- onClick: [self selectTab: aWidget]
48
+ self updateNodes
161
49
  !
162
50
 
163
- renderTabs
51
+ updateNodes
164
52
  ul contents: [:html |
165
- self tabs do: [:each |
166
- self renderTabFor: each on: html].
167
- html li
168
- class: 'newtab';
169
- with: [
170
- html span class: 'ltab'.
171
- html span class: 'mtab'; with: ' + '.
172
- html span class: 'rtab'];
173
- onClick: [self newBrowserTab]]
174
- !
175
-
176
- renderToolbarOn: html
177
- html div
178
- id: 'jt_toolbar';
179
- with: [
180
- input := html input
181
- class: 'implementors';
182
- yourself.
183
- input onKeyPress: [:event |
184
- event keyCode = 13 ifTrue: [
185
- self search: input asJQuery val]].
186
- html div id: 'jt_close'; onClick: [self close]]
53
+ self nodes do: [:each |
54
+ each renderOn: html]]
187
55
  ! !
188
56
 
189
- !TabManager methodsFor: 'updating'!
57
+ !ClassesList class methodsFor: 'instance creation'!
190
58
 
191
- update
192
- self renderTabs
59
+ on: aBrowser
60
+ ^self new
61
+ browser: aBrowser;
62
+ yourself
193
63
  ! !
194
64
 
195
- TabManager class instanceVariableNames: 'current'!
65
+ Widget subclass: #ClassesListNode
66
+ instanceVariableNames: 'browser theClass level nodes'
67
+ package: 'IDE'!
196
68
 
197
- !TabManager class methodsFor: 'instance creation'!
69
+ !ClassesListNode methodsFor: ''!
198
70
 
199
- current
200
- ^current ifNil: [current := super new]
201
- !
71
+ renderOn: html
72
+ | li cssClass |
73
+ cssClass := ''.
74
+ li := html li
75
+ onClick: [self browser selectClass: self theClass].
76
+ li asJQuery html: self label.
202
77
 
203
- new
204
- self shouldNotImplement
205
- ! !
78
+ self browser selectedClass = self theClass ifTrue: [
79
+ cssClass := cssClass, ' selected'].
206
80
 
207
- Widget subclass: #TabWidget
208
- instanceVariableNames: 'div'
209
- category: 'IDE'!
81
+ self theClass comment isEmpty ifFalse: [
82
+ cssClass := cssClass, ' commented'].
210
83
 
211
- !TabWidget methodsFor: 'accessing'!
84
+ li class: cssClass.
212
85
 
213
- label
214
- self subclassResponsibility
86
+ self nodes do: [:each |
87
+ each renderOn: html]
215
88
  ! !
216
89
 
217
- !TabWidget methodsFor: 'actions'!
90
+ !ClassesListNode methodsFor: 'accessing'!
218
91
 
219
- open
220
- TabManager current addTab: self.
221
- TabManager current selectTab: self
92
+ browser
93
+ ^browser
222
94
  !
223
95
 
224
- show
225
- div asJQuery show
96
+ browser: aBrowser
97
+ browser := aBrowser
226
98
  !
227
99
 
228
- hide
229
- div asJQuery hide
100
+ getNodesFrom: aCollection
101
+ | children others |
102
+ children := #().
103
+ others := #().
104
+ aCollection do: [:each |
105
+ (each superclass = self theClass)
106
+ ifTrue: [children add: each]
107
+ ifFalse: [others add: each]].
108
+ nodes:= children collect: [:each |
109
+ ClassesListNode on: each browser: self browser classes: others level: self level + 1]
230
110
  !
231
111
 
232
- remove
233
- div asJQuery remove
112
+ label
113
+ | str |
114
+ str := String new writeStream.
115
+ self level timesRepeat: [
116
+ str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
117
+ str nextPutAll: self theClass name.
118
+ ^str contents
234
119
  !
235
120
 
236
- close
237
- TabManager current closeTab: self
238
- ! !
239
-
240
- !TabWidget methodsFor: 'rendering'!
241
-
242
- renderOn: html
243
- div := html div
244
- class: 'jtalkTool';
245
- yourself.
246
- self renderTab
121
+ level
122
+ ^level
247
123
  !
248
124
 
249
- renderBoxOn: html
125
+ level: anInteger
126
+ level := anInteger
250
127
  !
251
128
 
252
- renderButtonsOn: html
129
+ nodes
130
+ ^nodes
253
131
  !
254
132
 
255
- update
256
- self renderTab
133
+ theClass
134
+ ^theClass
257
135
  !
258
136
 
259
- renderTab
260
- div contents: [:html |
261
- html div
262
- class: 'jt_box';
263
- with: [self renderBoxOn: html].
264
- html div
265
- class: 'jt_buttons';
266
- with: [self renderButtonsOn: html]]
137
+ theClass: aClass
138
+ theClass := aClass
267
139
  ! !
268
140
 
269
- !TabWidget methodsFor: 'testing'!
141
+ !ClassesListNode class methodsFor: 'instance creation'!
270
142
 
271
- canBeClosed
272
- ^false
143
+ on: aClass browser: aBrowser classes: aCollection level: anInteger
144
+ ^self new
145
+ theClass: aClass;
146
+ browser: aBrowser;
147
+ level: anInteger;
148
+ getNodesFrom: aCollection;
149
+ yourself
273
150
  ! !
274
151
 
275
- !TabWidget class methodsFor: 'instance creation'!
152
+ ErrorHandler subclass: #DebugErrorHandler
153
+ instanceVariableNames: ''
154
+ package: 'IDE'!
276
155
 
277
- open
278
- ^self new open
156
+ !DebugErrorHandler methodsFor: 'error handling'!
157
+
158
+ handleError: anError
159
+ [Debugger new
160
+ error: anError;
161
+ open] on: Error do: [:error |
162
+ ErrorHandler new handleError: error]
163
+ ! !
164
+
165
+ !DebugErrorHandler class methodsFor: 'initialization'!
166
+
167
+ initialize
168
+ self register
279
169
  ! !
280
170
 
281
171
  Widget subclass: #SourceArea
282
172
  instanceVariableNames: 'editor div receiver onDoIt'
283
- category: 'IDE'!
173
+ package: 'IDE'!
284
174
 
285
175
  !SourceArea methodsFor: 'accessing'!
286
176
 
287
- val
288
- ^editor getValue
177
+ currentLine
178
+ ^editor getLine: (editor getCursor line)
289
179
  !
290
180
 
291
- val: aString
292
- editor setValue: aString
181
+ currentLineOrSelection
182
+ ^editor somethingSelected
183
+ ifFalse: [self currentLine]
184
+ ifTrue: [self selection]
293
185
  !
294
186
 
295
- currentLine
296
- ^editor getLine: (editor getCursor line)
187
+ editor
188
+ ^editor
189
+ !
190
+
191
+ onDoIt
192
+ ^onDoIt
193
+ !
194
+
195
+ onDoIt: aBlock
196
+ onDoIt := aBlock
197
+ !
198
+
199
+ receiver
200
+ ^receiver ifNil: [DoIt new]
201
+ !
202
+
203
+ receiver: anObject
204
+ receiver := anObject
297
205
  !
298
206
 
299
207
  selection
@@ -304,6 +212,10 @@ selectionEnd
304
212
  ^textarea element selectionEnd
305
213
  !
306
214
 
215
+ selectionEnd: anInteger
216
+ textarea element selectionEnd: anInteger
217
+ !
218
+
307
219
  selectionStart
308
220
  ^textarea element selectionStart
309
221
  !
@@ -312,10 +224,6 @@ selectionStart: anInteger
312
224
  textarea element selectionStart: anInteger
313
225
  !
314
226
 
315
- selectionEnd: anInteger
316
- textarea element selectionEnd: anInteger
317
- !
318
-
319
227
  setEditorOn: aTextarea
320
228
  <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
321
229
  theme: 'jtalk',
@@ -326,30 +234,12 @@ setEditorOn: aTextarea
326
234
  })>
327
235
  !
328
236
 
329
- editor
330
- ^editor
331
- !
332
-
333
- receiver
334
- ^receiver ifNil: [DoIt new]
335
- !
336
-
337
- receiver: anObject
338
- receiver := anObject
339
- !
340
-
341
- onDoIt: aBlock
342
- onDoIt := aBlock
343
- !
344
-
345
- onDoIt
346
- ^onDoIt
237
+ val
238
+ ^editor getValue
347
239
  !
348
240
 
349
- currentLineOrSelection
350
- ^editor somethingSelected
351
- ifFalse: [self currentLine]
352
- ifTrue: [self selection]
241
+ val: aString
242
+ editor setValue: aString
353
243
  ! !
354
244
 
355
245
  !SourceArea methodsFor: 'actions'!
@@ -370,7 +260,11 @@ eval: aString
370
260
  compiler := Compiler new.
371
261
  [compiler parseExpression: aString] on: Error do: [:ex |
372
262
  ^window alert: ex messageText].
373
- ^(compiler load: 'doIt ^[', aString, '] value' forClass: DoIt) fn applyTo: self receiver arguments: #()
263
+ ^(compiler eval: (compiler compile: 'doIt ^[', aString, '] value' forClass: DoIt)) fn applyTo: self receiver arguments: #()
264
+ !
265
+
266
+ fileIn
267
+ Importer new import: self currentLineOrSelection readStream
374
268
  !
375
269
 
376
270
  handleKeyDown: anEvent
@@ -412,20 +306,16 @@ print: aString
412
306
 
413
307
  printIt
414
308
  self print: self doIt printString
415
- !
416
-
417
- fileIn
418
- Importer new import: self currentLineOrSelection readStream
419
309
  ! !
420
310
 
421
311
  !SourceArea methodsFor: 'events'!
422
312
 
423
- onKeyUp: aBlock
424
- div onKeyUp: aBlock
425
- !
426
-
427
313
  onKeyDown: aBlock
428
314
  div onKeyDown: aBlock
315
+ !
316
+
317
+ onKeyUp: aBlock
318
+ div onKeyUp: aBlock
429
319
  ! !
430
320
 
431
321
  !SourceArea methodsFor: 'rendering'!
@@ -438,321 +328,293 @@ renderOn: html
438
328
  div onKeyDown: [:e | self handleKeyDown: e]
439
329
  ! !
440
330
 
441
- Widget subclass: #ClassesList
442
- instanceVariableNames: 'browser ul nodes'
443
- category: 'IDE'!
444
-
445
- !ClassesList methodsFor: 'accessing'!
446
-
447
- category
448
- ^self browser selectedPackage
449
- !
450
-
451
- nodes
452
- nodes ifNil: [nodes := self getNodes].
453
- ^nodes
454
- !
455
-
456
- browser
457
- ^browser
458
- !
459
-
460
- browser: aBrowser
461
- browser := aBrowser
462
- !
463
-
464
- getNodes
465
- | classes children others |
466
- classes := self browser classes.
467
- children := #().
468
- others := #().
469
- classes do: [:each |
470
- (classes includes: each superclass)
471
- ifFalse: [children add: each]
472
- ifTrue: [others add: each]].
473
- ^children collect: [:each |
474
- ClassesListNode on: each browser: self browser classes: others level: 0]
475
- !
476
-
477
- resetNodes
478
- nodes := nil
479
- ! !
331
+ Widget subclass: #TabManager
332
+ instanceVariableNames: 'selectedTab tabs opened ul input'
333
+ package: 'IDE'!
480
334
 
481
- !ClassesList methodsFor: 'rendering'!
335
+ !TabManager methodsFor: 'accessing'!
482
336
 
483
- renderOn: html
484
- ul := html ul
485
- class: 'jt_column browser classes';
486
- yourself.
487
- self updateNodes
337
+ labelFor: aWidget
338
+ | label maxSize |
339
+ maxSize := 15.
340
+ label := aWidget label copyFrom: 0 to: (aWidget label size min: maxSize).
341
+ aWidget label size > maxSize ifTrue: [
342
+ label := label, '...'].
343
+ ^label
488
344
  !
489
345
 
490
- updateNodes
491
- ul contents: [:html |
492
- self nodes do: [:each |
493
- each renderOn: html]]
494
- ! !
495
-
496
- !ClassesList class methodsFor: 'instance creation'!
497
-
498
- on: aBrowser
499
- ^self new
500
- browser: aBrowser;
501
- yourself
346
+ tabs
347
+ ^tabs ifNil: [tabs := Array new]
502
348
  ! !
503
349
 
504
- Widget subclass: #ClassesListNode
505
- instanceVariableNames: 'browser theClass level nodes'
506
- category: 'IDE'!
507
-
508
- !ClassesListNode methodsFor: ''!
509
-
510
- renderOn: html
511
- | li cssClass |
512
- cssClass := ''.
513
- li := html li
514
- onClick: [self browser selectClass: self theClass].
515
- li asJQuery html: self label.
516
-
517
- self browser selectedClass = self theClass ifTrue: [
518
- cssClass := cssClass, ' selected'].
519
-
520
- self theClass comment isEmpty ifFalse: [
521
- cssClass := cssClass, ' commented'].
522
-
523
- li class: cssClass.
524
-
525
- self nodes do: [:each |
526
- each renderOn: html]
527
- ! !
350
+ !TabManager methodsFor: 'actions'!
528
351
 
529
- !ClassesListNode methodsFor: 'accessing'!
352
+ close
353
+ opened ifTrue: [
354
+ '#jtalk' asJQuery hide.
355
+ ul asJQuery hide.
356
+ selectedTab hide.
357
+ self removeBodyMargin.
358
+ 'body' asJQuery removeClass: 'jtalkBody'.
359
+ opened := false]
360
+ !
530
361
 
531
- nodes
532
- ^nodes
362
+ closeTab: aWidget
363
+ self removeTab: aWidget.
364
+ self selectTab: self tabs last.
365
+ aWidget remove.
366
+ self update
533
367
  !
534
368
 
535
- theClass
536
- ^theClass
369
+ newBrowserTab
370
+ Browser open
537
371
  !
538
372
 
539
- theClass: aClass
540
- theClass := aClass
373
+ onResize: aBlock
374
+ <jQuery('#jtalk').resizable({
375
+ handles: 'n',
376
+ resize: aBlock,
377
+ minHeight: 230
378
+ })>
541
379
  !
542
380
 
543
- browser
544
- ^browser
381
+ onWindowResize: aBlock
382
+ <jQuery(window).resize(aBlock)>
545
383
  !
546
384
 
547
- browser: aBrowser
548
- browser := aBrowser
385
+ open
386
+ opened ifFalse: [
387
+ 'body' asJQuery addClass: 'jtalkBody'.
388
+ '#jtalk' asJQuery show.
389
+ ul asJQuery show.
390
+ self updateBodyMargin.
391
+ selectedTab show.
392
+ opened := true]
549
393
  !
550
394
 
551
- level
552
- ^level
395
+ removeBodyMargin
396
+ self setBodyMargin: 0
553
397
  !
554
398
 
555
- level: anInteger
556
- level := anInteger
399
+ search: aString
400
+ | searchedClass |
401
+ searchedClass := Smalltalk current at: aString.
402
+ searchedClass isClass
403
+ ifTrue: [Browser openOn: searchedClass]
404
+ ifFalse: [ReferencesBrowser search: aString]
557
405
  !
558
406
 
559
- label
560
- | str |
561
- str := String new writeStream.
562
- self level timesRepeat: [
563
- str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
564
- str nextPutAll: self theClass name.
565
- ^str contents
407
+ selectTab: aWidget
408
+ self open.
409
+ selectedTab := aWidget.
410
+ self tabs do: [:each |
411
+ each hide].
412
+ aWidget show.
413
+
414
+ self update
566
415
  !
567
416
 
568
- getNodesFrom: aCollection
569
- | children others |
570
- children := #().
571
- others := #().
572
- aCollection do: [:each |
573
- (each superclass = self theClass)
574
- ifTrue: [children add: each]
575
- ifFalse: [others add: each]].
576
- nodes:= children collect: [:each |
577
- ClassesListNode on: each browser: self browser classes: others level: self level + 1]
578
- ! !
417
+ setBodyMargin: anInteger
418
+ '.jtalkBody' asJQuery css: 'margin-bottom' put: anInteger asString, 'px'
419
+ !
579
420
 
580
- !ClassesListNode class methodsFor: 'instance creation'!
421
+ updateBodyMargin
422
+ self setBodyMargin: '#jtalk' asJQuery height
423
+ !
581
424
 
582
- on: aClass browser: aBrowser classes: aCollection level: anInteger
583
- ^self new
584
- theClass: aClass;
585
- browser: aBrowser;
586
- level: anInteger;
587
- getNodesFrom: aCollection;
588
- yourself
425
+ updatePosition
426
+ <jQuery('#jtalk').css('top', '').css('bottom', '0px')>
589
427
  ! !
590
428
 
591
- ErrorHandler subclass: #DebugErrorHandler
592
- instanceVariableNames: ''
593
- category: 'IDE'!
429
+ !TabManager methodsFor: 'adding/Removing'!
594
430
 
595
- !DebugErrorHandler methodsFor: 'error handling'!
431
+ addTab: aWidget
432
+ self tabs add: aWidget.
433
+ aWidget appendToJQuery: '#jtalk' asJQuery.
434
+ aWidget hide
435
+ !
596
436
 
597
- handleError: anError
598
- [Debugger new
599
- error: anError;
600
- open] on: Error do: [:error |
601
- ErrorHandler new handleError: error]
437
+ removeTab: aWidget
438
+ self tabs remove: aWidget.
439
+ self update
602
440
  ! !
603
441
 
604
- !DebugErrorHandler class methodsFor: 'initialization'!
442
+ !TabManager methodsFor: 'initialization'!
605
443
 
606
444
  initialize
607
- self register
608
- ! !
609
-
610
- TabWidget subclass: #Workspace
611
- instanceVariableNames: 'sourceArea'
612
- category: 'IDE'!
613
-
614
- !Workspace methodsFor: 'accessing'!
615
-
616
- label
617
- ^'Workspace'
445
+ super initialize.
446
+ opened := true.
447
+ [:html | html div id: 'jtalk'] appendToJQuery: 'body' asJQuery.
448
+ 'body' asJQuery
449
+ addClass: 'jtalkBody'.
450
+ self appendToJQuery: '#jtalk' asJQuery.
451
+ self
452
+ addTab: IDETranscript current;
453
+ addTab: Workspace new;
454
+ addTab: TestRunner new.
455
+ self selectTab: self tabs last.
456
+ self
457
+ onResize: [self updateBodyMargin; updatePosition];
458
+ onWindowResize: [self updatePosition]
618
459
  ! !
619
460
 
620
- !Workspace methodsFor: 'actions'!
461
+ !TabManager methodsFor: 'rendering'!
621
462
 
622
- clearWorkspace
623
- sourceArea clear
463
+ renderOn: html
464
+ html div id: 'logo'.
465
+ self renderToolbarOn: html.
466
+ ul := html ul
467
+ id: 'jtalkTabs';
468
+ yourself.
469
+ self renderTabs
624
470
  !
625
471
 
626
- doIt
627
- sourceArea doIt
472
+ renderTabFor: aWidget on: html
473
+ | li |
474
+ li := html li.
475
+ selectedTab = aWidget ifTrue: [
476
+ li class: 'selected'].
477
+ li with: [
478
+ html span class: 'ltab'.
479
+ html span
480
+ class: 'mtab';
481
+ with: [
482
+ aWidget canBeClosed ifTrue: [
483
+ html span
484
+ class: 'close';
485
+ with: 'x';
486
+ onClick: [self closeTab: aWidget]].
487
+ html span with: (self labelFor: aWidget)].
488
+ html span class: 'rtab'];
489
+ onClick: [self selectTab: aWidget]
628
490
  !
629
491
 
630
- printIt
631
- sourceArea printIt
492
+ renderTabs
493
+ ul contents: [:html |
494
+ self tabs do: [:each |
495
+ self renderTabFor: each on: html].
496
+ html li
497
+ class: 'newtab';
498
+ with: [
499
+ html span class: 'ltab'.
500
+ html span class: 'mtab'; with: ' + '.
501
+ html span class: 'rtab'];
502
+ onClick: [self newBrowserTab]]
632
503
  !
633
504
 
634
- inspectIt
635
- sourceArea inspectIt
636
- !
505
+ renderToolbarOn: html
506
+ html div
507
+ id: 'jt_toolbar';
508
+ with: [
509
+ input := html input
510
+ class: 'implementors';
511
+ yourself.
512
+ input onKeyPress: [:event |
513
+ event keyCode = 13 ifTrue: [
514
+ self search: input asJQuery val]].
515
+ html div id: 'jt_close'; onClick: [self close]]
516
+ ! !
637
517
 
638
- fileIn
639
- sourceArea fileIn
518
+ !TabManager methodsFor: 'updating'!
519
+
520
+ update
521
+ self renderTabs
640
522
  ! !
641
523
 
642
- !Workspace methodsFor: 'rendering'!
524
+ TabManager class instanceVariableNames: 'current'!
643
525
 
644
- renderBoxOn: html
645
- sourceArea := SourceArea new.
646
- sourceArea renderOn: html
526
+ !TabManager class methodsFor: 'instance creation'!
527
+
528
+ current
529
+ ^current ifNil: [current := super new]
647
530
  !
648
531
 
649
- renderButtonsOn: html
650
- html button
651
- with: 'DoIt';
652
- title: 'ctrl+d';
653
- onClick: [self doIt].
654
- html button
655
- with: 'PrintIt';
656
- title: 'ctrl+p';
657
- onClick: [self printIt].
658
- html button
659
- with: 'InspectIt';
660
- title: 'ctrl+i';
661
- onClick: [self inspectIt].
662
- html button
663
- with: 'FileIn';
664
- title: 'ctrl+f';
665
- onClick: [self fileIn].
666
- html button
667
- with: 'Clear workspace';
668
- onClick: [self clearWorkspace]
532
+ new
533
+ self shouldNotImplement
669
534
  ! !
670
535
 
671
- TabWidget subclass: #Browser
672
- instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges'
673
- category: 'IDE'!
536
+ Widget subclass: #TabWidget
537
+ instanceVariableNames: 'div'
538
+ package: 'IDE'!
674
539
 
675
- !Browser methodsFor: 'accessing'!
540
+ !TabWidget methodsFor: 'accessing'!
676
541
 
677
542
  label
678
- ^selectedClass
679
- ifNil: ['Browser (nil)']
680
- ifNotNil: ['Browser: ', selectedClass name]
543
+ self subclassResponsibility
544
+ ! !
545
+
546
+ !TabWidget methodsFor: 'actions'!
547
+
548
+ close
549
+ TabManager current closeTab: self
681
550
  !
682
551
 
683
- packages
684
- | packages |
685
- packages := Array new.
686
- Smalltalk current classes do: [:each |
687
- (packages includes: each category) ifFalse: [
688
- packages add: each category]].
689
- ^packages sort
552
+ hide
553
+ div asJQuery hide
554
+ !
555
+
556
+ open
557
+ TabManager current addTab: self.
558
+ TabManager current selectTab: self
690
559
  !
691
560
 
692
- classes
693
- ^((Smalltalk current classes
694
- select: [:each | each category = selectedPackage])
695
- sort: [:a :b | a name < b name]) asSet
561
+ remove
562
+ div asJQuery remove
696
563
  !
697
564
 
698
- protocols
699
- | klass |
700
- selectedClass ifNotNil: [
701
- selectedTab = #comment ifTrue: [^#()].
702
- klass := selectedTab = #instance
703
- ifTrue: [selectedClass]
704
- ifFalse: [selectedClass class].
705
- klass methodDictionary isEmpty ifTrue: [
706
- ^Array with: 'not yet classified'].
707
- ^klass protocols].
708
- ^Array new
565
+ show
566
+ div asJQuery show
567
+ ! !
568
+
569
+ !TabWidget methodsFor: 'rendering'!
570
+
571
+ renderBoxOn: html
709
572
  !
710
573
 
711
- methods
712
- | klass |
713
- selectedTab = #comment ifTrue: [^#()].
714
- selectedClass ifNotNil: [
715
- klass := selectedTab = #instance
716
- ifTrue: [selectedClass]
717
- ifFalse: [selectedClass class]].
718
- ^(selectedProtocol
719
- ifNil: [
720
- klass
721
- ifNil: [#()]
722
- ifNotNil: [klass methodDictionary values]]
723
- ifNotNil: [
724
- klass methodDictionary values select: [:each |
725
- each category = selectedProtocol]]) sort: [:a :b | a selector < b selector]
574
+ renderButtonsOn: html
726
575
  !
727
576
 
728
- source
729
- selectedTab = #comment ifFalse: [
730
- ^(selectedProtocol notNil or: [selectedMethod notNil])
731
- ifFalse: [self declarationSource]
732
- ifTrue: [self methodSource]].
733
- ^selectedClass
734
- ifNil: ['']
735
- ifNotNil: [self classCommentSource]
577
+ renderOn: html
578
+ div := html div
579
+ class: 'jtalkTool';
580
+ yourself.
581
+ self renderTab
736
582
  !
737
583
 
738
- methodSource
739
- ^selectedMethod
740
- ifNil: [self dummyMethodSource]
741
- ifNotNil: [selectedMethod source]
584
+ renderTab
585
+ div contents: [:html |
586
+ html div
587
+ class: 'jt_box';
588
+ with: [self renderBoxOn: html].
589
+ html div
590
+ class: 'jt_buttons';
591
+ with: [self renderButtonsOn: html]]
742
592
  !
743
593
 
744
- dummyMethodSource
745
- ^'messageSelectorAndArgumentNames
746
- "comment stating purpose of message"
594
+ update
595
+ self renderTab
596
+ ! !
747
597
 
748
- | temporary variable names |
749
- statements'
750
- !
598
+ !TabWidget methodsFor: 'testing'!
751
599
 
752
- declarationSource
753
- ^selectedTab = #instance
754
- ifTrue: [self classDeclarationSource]
755
- ifFalse: [self metaclassDeclarationSource]
600
+ canBeClosed
601
+ ^false
602
+ ! !
603
+
604
+ !TabWidget class methodsFor: 'instance creation'!
605
+
606
+ open
607
+ ^self new open
608
+ ! !
609
+
610
+ TabWidget subclass: #Browser
611
+ instanceVariableNames: 'selectedPackage selectedClass selectedProtocol selectedMethod packagesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges'
612
+ package: 'IDE'!
613
+
614
+ !Browser methodsFor: 'accessing'!
615
+
616
+ classCommentSource
617
+ ^selectedClass comment
756
618
  !
757
619
 
758
620
  classDeclarationSource
@@ -776,6 +638,38 @@ classDeclarationSource
776
638
  ^stream contents
777
639
  !
778
640
 
641
+ classDeclarationTemplate
642
+ ^'Object subclass: #NameOfSubclass
643
+ instanceVariableNames: ''''
644
+ package: ''', self selectedPackage, ''''
645
+ !
646
+
647
+ classes
648
+ ^((Smalltalk current classes
649
+ select: [:each | each category = selectedPackage])
650
+ sort: [:a :b | a name < b name]) asSet
651
+ !
652
+
653
+ declarationSource
654
+ ^selectedTab = #instance
655
+ ifTrue: [self classDeclarationSource]
656
+ ifFalse: [self metaclassDeclarationSource]
657
+ !
658
+
659
+ dummyMethodSource
660
+ ^'messageSelectorAndArgumentNames
661
+ "comment stating purpose of message"
662
+
663
+ | temporary variable names |
664
+ statements'
665
+ !
666
+
667
+ label
668
+ ^selectedClass
669
+ ifNil: ['Browser (nil)']
670
+ ifNotNil: ['Browser: ', selectedClass name]
671
+ !
672
+
779
673
  metaclassDeclarationSource
780
674
  | stream |
781
675
  stream := '' writeStream.
@@ -791,46 +685,115 @@ metaclassDeclarationSource
791
685
  ^stream contents
792
686
  !
793
687
 
794
- classCommentSource
795
- ^selectedClass comment
688
+ methodSource
689
+ ^selectedMethod
690
+ ifNil: [self dummyMethodSource]
691
+ ifNotNil: [selectedMethod source]
796
692
  !
797
693
 
798
- selectedClass
799
- ^selectedClass
694
+ methods
695
+ | klass |
696
+ selectedTab = #comment ifTrue: [^#()].
697
+ selectedClass ifNotNil: [
698
+ klass := selectedTab = #instance
699
+ ifTrue: [selectedClass]
700
+ ifFalse: [selectedClass class]].
701
+ ^(selectedProtocol
702
+ ifNil: [
703
+ klass
704
+ ifNil: [#()]
705
+ ifNotNil: [klass methodDictionary values]]
706
+ ifNotNil: [
707
+ klass methodDictionary values select: [:each |
708
+ each category = selectedProtocol]]) sort: [:a :b | a selector < b selector]
800
709
  !
801
710
 
802
- classDeclarationTemplate
803
- ^'Object subclass: #NameOfSubclass
804
- instanceVariableNames: ''''
805
- package: ''', self selectedPackage, ''''
711
+ packages
712
+ | packages |
713
+ packages := Array new.
714
+ Smalltalk current classes do: [:each |
715
+ (packages includes: each category) ifFalse: [
716
+ packages add: each category]].
717
+ ^packages sort
718
+ !
719
+
720
+ protocols
721
+ | klass |
722
+ selectedClass ifNotNil: [
723
+ selectedTab = #comment ifTrue: [^#()].
724
+ klass := selectedTab = #instance
725
+ ifTrue: [selectedClass]
726
+ ifFalse: [selectedClass class].
727
+ klass methodDictionary isEmpty ifTrue: [
728
+ ^Array with: 'not yet classified'].
729
+ ^klass protocols].
730
+ ^Array new
731
+ !
732
+
733
+ selectedClass
734
+ ^selectedClass
806
735
  !
807
736
 
808
737
  selectedPackage
809
738
  ^selectedPackage
739
+ !
740
+
741
+ source
742
+ selectedTab = #comment ifFalse: [
743
+ ^(selectedProtocol notNil or: [selectedMethod notNil])
744
+ ifFalse: [self declarationSource]
745
+ ifTrue: [self methodSource]].
746
+ ^selectedClass
747
+ ifNil: ['']
748
+ ifNotNil: [self classCommentSource]
810
749
  ! !
811
750
 
812
751
  !Browser methodsFor: 'actions'!
813
752
 
814
- disableSaveButton
815
- saveButton ifNotNil: [
816
- saveButton at: 'disabled' put: true].
817
- unsavedChanges := false
753
+ addInstanceVariableNamed: aString toClass: aClass
754
+ ClassBuilder new
755
+ addSubclassOf: aClass superclass
756
+ named: aClass name
757
+ instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
758
+ package: aClass package name
818
759
  !
819
760
 
820
- hideClassButtons
821
- classButtons asJQuery hide
761
+ addNewClass
762
+ | className |
763
+ className := window prompt: 'New class'.
764
+ (className notNil and: [className notEmpty]) ifTrue: [
765
+ Object subclass: className instanceVariableNames: '' package: self selectedPackage.
766
+ self
767
+ resetClassesList;
768
+ updateClassesList.
769
+ self selectClass: (Smalltalk current at: className)]
822
770
  !
823
771
 
824
- showClassButtons
825
- classButtons asJQuery show
772
+ addNewProtocol
773
+ | newProtocol |
774
+ newProtocol := window prompt: 'New method protocol'.
775
+ (newProtocol notNil and: [newProtocol notEmpty]) ifTrue: [
776
+ selectedMethod category: newProtocol.
777
+ self setMethodProtocol: newProtocol]
826
778
  !
827
779
 
828
- hideMethodButtons
829
- methodButtons asJQuery hide
780
+ cancelChanges
781
+ ^unsavedChanges
782
+ ifTrue: [window confirm: 'Cancel changes?']
783
+ ifFalse: [true]
830
784
  !
831
785
 
832
- showMethodButtons
833
- methodButtons asJQuery show
786
+ commitPackage
787
+ selectedPackage ifNotNil: [ |package|
788
+ package := Package named: selectedPackage.
789
+ { Exporter -> (package commitPathJs, '/', selectedPackage, '.js').
790
+ StrippedExporter -> (package commitPathJs, '/', selectedPackage, '.deploy.js').
791
+ ChunkExporter -> (package commitPathSt, '/', selectedPackage, '.st') }
792
+
793
+ do: [:commitStrategy| |fileContents|
794
+ fileContents := (commitStrategy key new exportPackage: selectedPackage).
795
+ self ajaxPutAt: commitStrategy value data: fileContents]
796
+ ]
834
797
  !
835
798
 
836
799
  compile
@@ -849,6 +812,16 @@ compileClassComment
849
812
  selectedClass comment: sourceArea val
850
813
  !
851
814
 
815
+ compileDefinition
816
+ | newClass |
817
+ newClass := Compiler new evaluateExpression: sourceArea val.
818
+ self
819
+ resetClassesList;
820
+ updateCategoriesList;
821
+ updateClassesList.
822
+ self selectClass: newClass
823
+ !
824
+
852
825
  compileMethodDefinition
853
826
  selectedTab = #instance
854
827
  ifTrue: [self compileMethodDefinitionFor: selectedClass]
@@ -879,20 +852,40 @@ compileMethodDefinitionFor: aClass
879
852
  self selectMethod: method
880
853
  !
881
854
 
882
- compileDefinition
883
- | newClass |
884
- newClass := Compiler new loadExpression: sourceArea val.
885
- self
886
- resetClassesList;
887
- updateCategoriesList;
888
- updateClassesList.
889
- self selectClass: newClass
855
+ copyClass
856
+ | className |
857
+ className := window prompt: 'Copy class'.
858
+ (className notNil and: [className notEmpty]) ifTrue: [
859
+ ClassBuilder new copyClass: self selectedClass named: className.
860
+ self
861
+ resetClassesList;
862
+ updateClassesList.
863
+ self selectClass: (Smalltalk current at: className)]
864
+ !
865
+
866
+ disableSaveButton
867
+ saveButton ifNotNil: [
868
+ saveButton at: 'disabled' put: true].
869
+ unsavedChanges := false
890
870
  !
891
871
 
892
- cancelChanges
893
- ^unsavedChanges
894
- ifTrue: [window confirm: 'Cancel changes?']
895
- ifFalse: [true]
872
+ handleSourceAreaKeyDown: anEvent
873
+ <if(anEvent.ctrlKey) {
874
+ if(anEvent.keyCode === 83) { //ctrl+s
875
+ self._compile();
876
+ anEvent.preventDefault();
877
+ return false;
878
+ }
879
+ }
880
+ >
881
+ !
882
+
883
+ hideClassButtons
884
+ classButtons asJQuery hide
885
+ !
886
+
887
+ hideMethodButtons
888
+ methodButtons asJQuery hide
896
889
  !
897
890
 
898
891
  removeClass
@@ -913,26 +906,48 @@ removeMethod
913
906
  self selectMethod: nil]]
914
907
  !
915
908
 
916
- setMethodProtocol: aString
917
- self cancelChanges ifTrue: [
918
- (self protocols includes: aString)
919
- ifFalse: [self addNewProtocol]
920
- ifTrue: [
921
- selectedMethod category: aString.
922
- selectedProtocol := aString.
923
- selectedMethod := selectedMethod.
924
- self
925
- updateProtocolsList;
926
- updateMethodsList;
927
- updateSourceAndButtons]]
909
+ removePackage
910
+
911
+ (window confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')
912
+ ifTrue: [
913
+ Smalltalk current removePackage: selectedPackage.
914
+ self updateCategoriesList]
928
915
  !
929
916
 
930
- addNewProtocol
931
- | newProtocol |
932
- newProtocol := window prompt: 'New method protocol'.
933
- (newProtocol notNil and: [newProtocol notEmpty]) ifTrue: [
934
- selectedMethod category: newProtocol.
935
- self setMethodProtocol: newProtocol]
917
+ renameClass
918
+ | newName |
919
+ newName := window prompt: 'Rename class ', selectedClass name.
920
+ (newName notNil and: [newName notEmpty]) ifTrue: [
921
+ selectedClass rename: newName.
922
+ self
923
+ updateClassesList;
924
+ updateSourceAndButtons]
925
+ !
926
+
927
+ renamePackage
928
+
929
+ | newName |
930
+ newName := window prompt: 'Rename package ', selectedPackage.
931
+ newName ifNotNil: [
932
+ newName notEmpty ifTrue: [
933
+ Smalltalk current renamePackage: selectedPackage to: newName.
934
+ self updateCategoriesList]]
935
+ !
936
+
937
+ search: aString
938
+ self cancelChanges ifTrue: [| searchedClass |
939
+ searchedClass := Smalltalk current at: aString.
940
+ searchedClass isClass
941
+ ifTrue: [self class openOn: searchedClass]
942
+ ifFalse: [self searchReferencesOf: aString]]
943
+ !
944
+
945
+ searchClassReferences
946
+ ReferencesBrowser search: selectedClass name
947
+ !
948
+
949
+ searchReferencesOf: aString
950
+ ReferencesBrowser search: aString
936
951
  !
937
952
 
938
953
  selectCategory: aCategory
@@ -959,19 +974,19 @@ selectClass: aClass
959
974
  updateSourceAndButtons]
960
975
  !
961
976
 
962
- selectProtocol: aString
977
+ selectMethod: aMethod
963
978
  self cancelChanges ifTrue: [
964
- selectedProtocol := aString.
965
- selectedMethod := nil.
979
+ selectedMethod := aMethod.
966
980
  self
967
981
  updateProtocolsList;
968
982
  updateMethodsList;
969
983
  updateSourceAndButtons]
970
984
  !
971
985
 
972
- selectMethod: aMethod
986
+ selectProtocol: aString
973
987
  self cancelChanges ifTrue: [
974
- selectedMethod := aMethod.
988
+ selectedProtocol := aString.
989
+ selectedMethod := nil.
975
990
  self
976
991
  updateProtocolsList;
977
992
  updateMethodsList;
@@ -985,102 +1000,26 @@ selectTab: aString
985
1000
  self updateTabsList]
986
1001
  !
987
1002
 
988
- renameClass
989
- | newName |
990
- newName := window prompt: 'Rename class ', selectedClass name.
991
- (newName notNil and: [newName notEmpty]) ifTrue: [
992
- selectedClass rename: newName.
993
- self
994
- updateClassesList;
995
- updateSourceAndButtons]
996
- !
997
-
998
- addInstanceVariableNamed: aString toClass: aClass
999
- ClassBuilder new
1000
- addSubclassOf: aClass superclass
1001
- named: aClass name
1002
- instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
1003
- package: aClass package name
1004
- !
1005
-
1006
- searchReferencesOf: aString
1007
- ReferencesBrowser search: aString
1008
- !
1009
-
1010
- searchClassReferences
1011
- ReferencesBrowser search: selectedClass name
1012
- !
1013
-
1014
- search: aString
1015
- self cancelChanges ifTrue: [| searchedClass |
1016
- searchedClass := Smalltalk current at: aString.
1017
- searchedClass isClass
1018
- ifTrue: [self class openOn: searchedClass]
1019
- ifFalse: [self searchReferencesOf: aString]]
1020
- !
1021
-
1022
- handleSourceAreaKeyDown: anEvent
1023
- <if(anEvent.ctrlKey) {
1024
- if(anEvent.keyCode === 83) { //ctrl+s
1025
- self._compile();
1026
- anEvent.preventDefault();
1027
- return false;
1028
- }
1029
- }
1030
- >
1031
- !
1032
-
1033
- commitPackage
1034
- selectedPackage ifNotNil: [ |package|
1035
- package := Package named: selectedPackage.
1036
- { Exporter -> (package commitPathJs, '/', selectedPackage, '.js').
1037
- StrippedExporter -> (package commitPathJs, '/', selectedPackage, '.deploy.js').
1038
- ChunkExporter -> (package commitPathSt, '/', selectedPackage, '.st') }
1039
-
1040
- do: [:commitStrategy| |fileContents|
1041
- fileContents := (commitStrategy key new exportPackage: selectedPackage).
1042
- self ajaxPutAt: commitStrategy value data: fileContents]
1043
- ]
1044
- !
1045
-
1046
- renamePackage
1047
-
1048
- | newName |
1049
- newName := window prompt: 'Rename package ', selectedPackage.
1050
- newName ifNotNil: [
1051
- newName notEmpty ifTrue: [
1052
- Smalltalk current renamePackage: selectedPackage to: newName.
1053
- self updateCategoriesList]]
1054
- !
1055
-
1056
- removePackage
1057
-
1058
- (window confirm: 'Do you really want to remove the whole package ', selectedPackage, ' with all its classes?')
1059
- ifTrue: [
1060
- Smalltalk current removePackage: selectedPackage.
1061
- self updateCategoriesList]
1003
+ setMethodProtocol: aString
1004
+ self cancelChanges ifTrue: [
1005
+ (self protocols includes: aString)
1006
+ ifFalse: [self addNewProtocol]
1007
+ ifTrue: [
1008
+ selectedMethod category: aString.
1009
+ selectedProtocol := aString.
1010
+ selectedMethod := selectedMethod.
1011
+ self
1012
+ updateProtocolsList;
1013
+ updateMethodsList;
1014
+ updateSourceAndButtons]]
1062
1015
  !
1063
1016
 
1064
- addNewClass
1065
- | className |
1066
- className := window prompt: 'New class'.
1067
- (className notNil and: [className notEmpty]) ifTrue: [
1068
- Object subclass: className instanceVariableNames: '' package: self selectedPackage.
1069
- self
1070
- resetClassesList;
1071
- updateClassesList.
1072
- self selectClass: (Smalltalk current at: className)]
1017
+ showClassButtons
1018
+ classButtons asJQuery show
1073
1019
  !
1074
1020
 
1075
- copyClass
1076
- | className |
1077
- className := window prompt: 'Copy class'.
1078
- (className notNil and: [className notEmpty]) ifTrue: [
1079
- ClassBuilder new copyClass: self selectedClass named: className.
1080
- self
1081
- resetClassesList;
1082
- updateClassesList.
1083
- self selectClass: (Smalltalk current at: className)]
1021
+ showMethodButtons
1022
+ methodButtons asJQuery show
1084
1023
  ! !
1085
1024
 
1086
1025
  !Browser methodsFor: 'initialization'!
@@ -1096,55 +1035,13 @@ initialize
1096
1035
 
1097
1036
  ajaxPutAt: anURL data: aString
1098
1037
  jQuery
1099
- ajax: anURL options: #{ 'type' -> 'PUT'.
1100
- 'data' -> aString.
1101
- 'contentType' -> 'text/plain;charset=UTF-8'.
1102
- 'error' -> [window alert: 'PUT request failed at: ', anURL] }
1103
- ! !
1104
-
1105
- !Browser methodsFor: 'rendering'!
1106
-
1107
- renderBoxOn: html
1108
- self
1109
- renderTopPanelOn: html;
1110
- renderTabsOn: html;
1111
- renderBottomPanelOn: html
1112
- !
1113
-
1114
- renderTopPanelOn: html
1115
- html div
1116
- class: 'top';
1117
- with: [
1118
- packagesList := html ul class: 'jt_column browser packages'.
1119
- html div class: 'jt_packagesButtons'; with: [
1120
- html button
1121
- title: 'Commit classes in this package to disk';
1122
- onClick: [self commitPackage];
1123
- with: 'Commit'.
1124
- html button
1125
- title: 'Rename package';
1126
- onClick: [self renamePackage];
1127
- with: 'Rename'.
1128
- html button
1129
- title: 'Remove this package from the system';
1130
- onClick: [self removePackage];
1131
- with: 'Remove'].
1132
- classesList := ClassesList on: self.
1133
- classesList renderOn: html.
1134
- protocolsList := html ul class: 'jt_column browser protocols'.
1135
- methodsList := html ul class: 'jt_column browser methods'.
1136
- self
1137
- updateCategoriesList;
1138
- updateClassesList;
1139
- updateProtocolsList;
1140
- updateMethodsList.
1141
- html div class: 'jt_clear']
1142
- !
1038
+ ajax: anURL options: #{ 'type' -> 'PUT'.
1039
+ 'data' -> aString.
1040
+ 'contentType' -> 'text/plain;charset=UTF-8'.
1041
+ 'error' -> [window alert: 'PUT request failed at: ', anURL] }
1042
+ ! !
1143
1043
 
1144
- renderTabsOn: html
1145
- tabsList := html ul class: 'jt_tabs jt_browser'.
1146
- self updateTabsList.
1147
- !
1044
+ !Browser methodsFor: 'rendering'!
1148
1045
 
1149
1046
  renderBottomPanelOn: html
1150
1047
  html div
@@ -1157,6 +1054,13 @@ renderBottomPanelOn: html
1157
1054
  sourceArea onKeyUp: [self updateStatus]]
1158
1055
  !
1159
1056
 
1057
+ renderBoxOn: html
1058
+ self
1059
+ renderTopPanelOn: html;
1060
+ renderTabsOn: html;
1061
+ renderBottomPanelOn: html
1062
+ !
1063
+
1160
1064
  renderButtonsOn: html
1161
1065
  saveButton := html button.
1162
1066
  saveButton
@@ -1176,6 +1080,41 @@ renderButtonsOn: html
1176
1080
  html button with: 'InspectIt';
1177
1081
  onClick: [sourceArea inspectIt]].
1178
1082
  self updateSourceAndButtons
1083
+ !
1084
+
1085
+ renderTabsOn: html
1086
+ tabsList := html ul class: 'jt_tabs jt_browser'.
1087
+ self updateTabsList.
1088
+ !
1089
+
1090
+ renderTopPanelOn: html
1091
+ html div
1092
+ class: 'top';
1093
+ with: [
1094
+ packagesList := html ul class: 'jt_column browser packages'.
1095
+ html div class: 'jt_packagesButtons'; with: [
1096
+ html button
1097
+ title: 'Commit classes in this package to disk';
1098
+ onClick: [self commitPackage];
1099
+ with: 'Commit'.
1100
+ html button
1101
+ title: 'Rename package';
1102
+ onClick: [self renamePackage];
1103
+ with: 'Rename'.
1104
+ html button
1105
+ title: 'Remove this package from the system';
1106
+ onClick: [self removePackage];
1107
+ with: 'Remove'].
1108
+ classesList := ClassesList on: self.
1109
+ classesList renderOn: html.
1110
+ protocolsList := html ul class: 'jt_column browser protocols'.
1111
+ methodsList := html ul class: 'jt_column browser methods'.
1112
+ self
1113
+ updateCategoriesList;
1114
+ updateClassesList;
1115
+ updateProtocolsList;
1116
+ updateMethodsList.
1117
+ html div class: 'jt_clear']
1179
1118
  ! !
1180
1119
 
1181
1120
  !Browser methodsFor: 'testing'!
@@ -1186,6 +1125,10 @@ canBeClosed
1186
1125
 
1187
1126
  !Browser methodsFor: 'updating'!
1188
1127
 
1128
+ resetClassesList
1129
+ classesList resetNodes
1130
+ !
1131
+
1189
1132
  updateCategoriesList
1190
1133
  packagesList contents: [:html |
1191
1134
  self packages do: [:each || li label |
@@ -1205,17 +1148,6 @@ updateClassesList
1205
1148
  classesList updateNodes
1206
1149
  !
1207
1150
 
1208
- updateProtocolsList
1209
- protocolsList contents: [:html |
1210
- self protocols do: [:each || li |
1211
- li := html li.
1212
- selectedProtocol = each ifTrue: [
1213
- li class: 'selected'].
1214
- li
1215
- with: each;
1216
- onClick: [self selectProtocol: each]]]
1217
- !
1218
-
1219
1151
  updateMethodsList
1220
1152
  methodsList contents: [:html |
1221
1153
  self methods do: [:each || li |
@@ -1227,32 +1159,15 @@ updateMethodsList
1227
1159
  onClick: [self selectMethod: each]]]
1228
1160
  !
1229
1161
 
1230
- updateTabsList
1231
- tabsList contents: [:html || li |
1232
- li := html li.
1233
- selectedTab = #instance ifTrue: [li class: 'selected'].
1234
- li
1235
- with: [
1236
- html span class: 'ltab'.
1237
- html span class: 'mtab'; with: 'Instance'.
1238
- html span class: 'rtab'];
1239
- onClick: [self selectTab: #instance].
1240
- li := html li.
1241
- selectedTab = #class ifTrue: [li class: 'selected'].
1242
- li
1243
- with: [
1244
- html span class: 'ltab'.
1245
- html span class: 'mtab'; with: 'Class'.
1246
- html span class: 'rtab'];
1247
- onClick: [self selectTab: #class].
1248
- li := html li.
1249
- selectedTab = #comment ifTrue: [li class: 'selected'].
1250
- li
1251
- with: [
1252
- html span class: 'ltab'.
1253
- html span class: 'mtab'; with: 'Comment'.
1254
- html span class: 'rtab'];
1255
- onClick: [self selectTab: #comment]]
1162
+ updateProtocolsList
1163
+ protocolsList contents: [:html |
1164
+ self protocols do: [:each || li |
1165
+ li := html li.
1166
+ selectedProtocol = each ifTrue: [
1167
+ li class: 'selected'].
1168
+ li
1169
+ with: each;
1170
+ onClick: [self selectProtocol: each]]]
1256
1171
  !
1257
1172
 
1258
1173
  updateSourceAndButtons
@@ -1328,8 +1243,32 @@ updateStatus
1328
1243
  unsavedChanges := true]
1329
1244
  !
1330
1245
 
1331
- resetClassesList
1332
- classesList resetNodes
1246
+ updateTabsList
1247
+ tabsList contents: [:html || li |
1248
+ li := html li.
1249
+ selectedTab = #instance ifTrue: [li class: 'selected'].
1250
+ li
1251
+ with: [
1252
+ html span class: 'ltab'.
1253
+ html span class: 'mtab'; with: 'Instance'.
1254
+ html span class: 'rtab'];
1255
+ onClick: [self selectTab: #instance].
1256
+ li := html li.
1257
+ selectedTab = #class ifTrue: [li class: 'selected'].
1258
+ li
1259
+ with: [
1260
+ html span class: 'ltab'.
1261
+ html span class: 'mtab'; with: 'Class'.
1262
+ html span class: 'rtab'];
1263
+ onClick: [self selectTab: #class].
1264
+ li := html li.
1265
+ selectedTab = #comment ifTrue: [li class: 'selected'].
1266
+ li
1267
+ with: [
1268
+ html span class: 'ltab'.
1269
+ html span class: 'mtab'; with: 'Comment'.
1270
+ html span class: 'rtab'];
1271
+ onClick: [self selectTab: #comment]]
1333
1272
  ! !
1334
1273
 
1335
1274
  !Browser class methodsFor: 'accessing'!
@@ -1344,562 +1283,456 @@ commitPathSt
1344
1283
 
1345
1284
  !Browser class methodsFor: 'convenience'!
1346
1285
 
1286
+ open
1287
+ self new open
1288
+ !
1289
+
1347
1290
  openOn: aClass
1348
1291
  ^self new
1349
1292
  open;
1350
1293
  selectCategory: aClass category;
1351
1294
  selectClass: aClass
1352
- !
1353
-
1354
- open
1355
- self new open
1356
1295
  ! !
1357
1296
 
1358
- TabWidget subclass: #Inspector
1359
- instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
1360
- category: 'IDE'!
1361
-
1362
- !Inspector methodsFor: 'accessing'!
1363
-
1364
- label
1365
- ^label ifNil: ['Inspector (nil)']
1366
- !
1297
+ TabWidget subclass: #Debugger
1298
+ instanceVariableNames: 'error selectedContext sourceArea ul ul2 inspector saveButton unsavedChanges selectedVariable selectedVariableName inspectButton'
1299
+ package: 'IDE'!
1367
1300
 
1368
- variables
1369
- ^variables
1370
- !
1301
+ !Debugger methodsFor: 'accessing'!
1371
1302
 
1372
- setVariables: aCollection
1373
- variables := aCollection
1303
+ arguments
1304
+ ^self method
1305
+ ifNil: [selectedContext temps collect: [:each | nil]]
1306
+ ifNotNil: [self method arguments]
1374
1307
  !
1375
1308
 
1376
- setLabel: aString
1377
- label := aString
1309
+ error
1310
+ ^error
1378
1311
  !
1379
1312
 
1380
- selectedVariable
1381
- ^selectedVariable
1313
+ error: anError
1314
+ error := anError
1382
1315
  !
1383
1316
 
1384
- selectedVariable: aString
1385
- selectedVariable := aString
1317
+ label
1318
+ ^'[Debugger]'
1386
1319
  !
1387
1320
 
1388
- sourceArea
1389
- ^sourceArea
1390
- ! !
1391
-
1392
- !Inspector methodsFor: 'actions'!
1393
-
1394
- inspect: anObject
1395
- object := anObject.
1396
- variables := #().
1397
- object inspectOn: self
1321
+ method
1322
+ ^selectedContext receiver class methodAt: selectedContext selector
1398
1323
  !
1399
1324
 
1400
- dive
1401
- (self variables at: self selectedVariable) inspect
1325
+ receiver
1326
+ ^selectedContext receiver
1402
1327
  !
1403
1328
 
1404
- refresh
1405
- self
1406
- inspect: object;
1407
- updateVariablesList;
1408
- updateValueTextarea
1329
+ source
1330
+ ^self method
1331
+ ifNil: ['Method doesn''t exist!!']
1332
+ ifNotNil: [self method source]
1409
1333
  ! !
1410
1334
 
1411
- !Inspector methodsFor: 'rendering'!
1412
-
1413
- renderBoxOn: html
1414
- self
1415
- renderTopPanelOn: html;
1416
- renderBottomPanelOn: html
1417
- !
1418
-
1419
- renderTopPanelOn: html
1420
- html div
1421
- class: 'top';
1422
- with: [
1423
- variablesList := html ul class: 'jt_column variables'.
1424
- valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
1425
- html div class: 'jt_tabs inspector'; with: [
1426
- html button
1427
- class: 'jt_button inspector refresh';
1428
- with: 'Refresh';
1429
- onClick: [self refresh].
1430
- diveButton := html button
1431
- class: 'jt_button inspector dive';
1432
- with: 'Dive';
1433
- onClick: [self dive]].
1434
- html div class: 'jt_clear'].
1435
- self
1436
- updateVariablesList;
1437
- updateValueTextarea.
1438
- !
1335
+ !Debugger methodsFor: 'actions'!
1439
1336
 
1440
- renderBottomPanelOn: html
1441
- html div
1442
- class: 'jt_sourceCode';
1443
- with: [
1444
- sourceArea := SourceArea new
1445
- receiver: object;
1446
- onDoIt: [self refresh];
1447
- yourself.
1448
- sourceArea renderOn: html]
1337
+ inspectSelectedVariable
1338
+ selectedVariable inspect
1449
1339
  !
1450
1340
 
1451
- renderButtonsOn: html
1452
- html button
1453
- with: 'DoIt';
1454
- onClick: [self sourceArea doIt].
1455
- html button
1456
- with: 'PrintIt';
1457
- onClick: [self sourceArea printIt].
1458
- html button
1459
- with: 'InspectIt';
1460
- onClick: [self sourceArea inspectIt].
1461
- self updateButtons
1462
- ! !
1463
-
1464
- !Inspector methodsFor: 'testing'!
1465
-
1466
- canBeClosed
1467
- ^true
1468
- ! !
1469
-
1470
- !Inspector methodsFor: 'updating'!
1341
+ proceed
1342
+ self close.
1343
+ selectedContext receiver perform: selectedContext selector withArguments: selectedContext temps
1344
+ !
1471
1345
 
1472
- updateVariablesList
1473
- variablesList contents: [:html |
1474
- self variables keys do: [:each || li |
1475
- li := html li.
1476
- li
1477
- with: each;
1478
- onClick: [self selectVariable: each].
1479
- self selectedVariable = each ifTrue: [
1480
- li class: 'selected']]]
1346
+ save
1347
+ | protocol |
1348
+ protocol := (selectedContext receiver class methodDictionary at: selectedContext selector) category.
1349
+ selectedContext receiver class compile: sourceArea val category: protocol.
1350
+ self updateStatus
1481
1351
  !
1482
1352
 
1483
- selectVariable: aString
1484
- self selectedVariable: aString.
1353
+ selectContext: aContext
1354
+ selectedContext := aContext.
1355
+ selectedVariable := nil.
1356
+ selectedVariableName := nil.
1485
1357
  self
1358
+ updateContextsList;
1359
+ updateSourceArea;
1360
+ updateInspector;
1486
1361
  updateVariablesList;
1487
- updateValueTextarea;
1488
- updateButtons
1489
- !
1490
-
1491
- updateValueTextarea
1492
- valueTextarea asJQuery val: (self selectedVariable isNil
1493
- ifTrue: ['']
1494
- ifFalse: [(self variables at: self selectedVariable) printString])
1362
+ updateStatus
1495
1363
  !
1496
1364
 
1497
- updateButtons
1498
- (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
1499
- ifFalse: [diveButton at: 'disabled' put: true]
1500
- ifTrue: [diveButton removeAt: 'disabled']
1365
+ selectVariable: anObject named: aString
1366
+ selectedVariable := anObject.
1367
+ selectedVariableName := aString.
1368
+ inspector contents: [:html | html with: anObject printString].
1369
+ self updateVariablesList
1501
1370
  ! !
1502
1371
 
1503
- !Inspector class methodsFor: 'instance creation'!
1372
+ !Debugger methodsFor: 'initialization'!
1504
1373
 
1505
- on: anObject
1506
- ^self new
1507
- inspect: anObject;
1508
- yourself
1374
+ initialize
1375
+ super initialize.
1376
+ unsavedChanges = false
1509
1377
  ! !
1510
1378
 
1511
- TabWidget subclass: #ReferencesBrowser
1512
- instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
1513
- category: 'IDE'!
1514
-
1515
- !ReferencesBrowser methodsFor: 'accessing'!
1379
+ !Debugger methodsFor: 'rendering'!
1516
1380
 
1517
- implementors
1518
- ^implementors ifNil: [implementors := Array new]
1381
+ renderBottomPanelOn: html
1382
+ html div
1383
+ class: 'jt_sourceCode debugger';
1384
+ with: [
1385
+ sourceArea := SourceArea new.
1386
+ sourceArea renderOn: html].
1387
+ ul2 := html ul class: 'jt_column debugger variables'.
1388
+ inspector := html div class: 'jt_column debugger inspector'.
1389
+ sourceArea
1390
+ onKeyUp: [self updateStatus]
1519
1391
  !
1520
1392
 
1521
- label
1522
- ^'[References]'
1393
+ renderBoxOn: html
1394
+ self
1395
+ renderTopPanelOn: html;
1396
+ renderBottomPanelOn: html
1523
1397
  !
1524
1398
 
1525
- selector
1526
- ^selector
1399
+ renderButtonsOn: html
1400
+ saveButton := html button
1401
+ with: 'Save';
1402
+ onClick: [self save].
1403
+ html button
1404
+ with: 'DoIt';
1405
+ onClick: [sourceArea doIt].
1406
+ html button
1407
+ with: 'PrintIt';
1408
+ onClick: [sourceArea printIt].
1409
+ html button
1410
+ with: 'InspectIt';
1411
+ onClick: [sourceArea inspectIt].
1412
+ html button
1413
+ with: 'Proceed';
1414
+ onClick: [self proceed].
1415
+ html button
1416
+ with: 'Abandon';
1417
+ onClick: [self close].
1418
+ inspectButton := html button
1419
+ class: 'jt_button debugger inspect';
1420
+ with: 'Inspect';
1421
+ onClick: [self inspectSelectedVariable].
1422
+ self
1423
+ updateSourceArea;
1424
+ updateStatus;
1425
+ updateVariablesList;
1426
+ updateInspector
1527
1427
  !
1528
1428
 
1529
- senders
1530
- ^senders ifNil: [senders := Array new]
1429
+ renderContext: aContext on: html
1430
+ | li |
1431
+ li := html li.
1432
+ selectedContext = aContext ifTrue: [
1433
+ li class: 'selected'].
1434
+ li
1435
+ with: aContext asString;
1436
+ onClick: [self selectContext: aContext].
1437
+ aContext home ifNotNil: [self renderContext: aContext home on: html]
1531
1438
  !
1532
1439
 
1533
- classesAndMetaclasses
1534
- ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
1535
- !
1440
+ renderTopPanelOn: html
1441
+ selectedContext := self error context.
1442
+ html div
1443
+ class: 'top';
1444
+ with: [
1445
+ html div
1446
+ class: 'label';
1447
+ with: self error messageText.
1448
+ ul := html ul
1449
+ class: 'jt_column debugger contexts';
1450
+ with: [self renderContext: self error context on: html]]
1451
+ ! !
1536
1452
 
1537
- referencedClasses
1538
- ^referencedClasses ifNil: [referencedClasses := Array new]
1453
+ !Debugger methodsFor: 'testing'!
1454
+
1455
+ canBeClosed
1456
+ ^true
1539
1457
  ! !
1540
1458
 
1541
- !ReferencesBrowser methodsFor: 'actions'!
1459
+ !Debugger methodsFor: 'updating'!
1542
1460
 
1543
- openBrowserOn: aMethod
1544
- | browser |
1545
- browser := Browser openOn: (aMethod methodClass isMetaclass
1546
- ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
1547
- aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
1548
- browser
1549
- selectProtocol: aMethod category;
1550
- selectMethod: aMethod
1461
+ updateContextsList
1462
+ ul contents: [:html |
1463
+ self renderContext: self error context on: html]
1551
1464
  !
1552
1465
 
1553
- searchReferencesFor: aString
1554
- selector := aString.
1555
- implementors := Array new.
1556
- senders := Array new.
1557
- referencedClasses := Array new.
1558
- (selector match: '^[A-Z]')
1559
- ifFalse: [self searchSelectorReferencesFor: selector]
1560
- ifTrue: [self searchReferencedClassesFor: selector]
1466
+ updateInspector
1467
+ inspector contents: [:html |]
1561
1468
  !
1562
1469
 
1563
- search: aString
1564
- self
1565
- searchReferencesFor: aString;
1566
- updateImplementorsList;
1567
- updateSendersList;
1568
- updateReferencedClassesList
1470
+ updateSourceArea
1471
+ sourceArea val: self source
1569
1472
  !
1570
1473
 
1571
- searchReferencedClassesFor: aString
1572
- self classesAndMetaclasses do: [:each |
1573
- each methodDictionary values do: [:value |
1574
- (value referencedClasses includes: selector) ifTrue: [
1575
- self referencedClasses add: value]]]
1474
+ updateStatus
1475
+ sourceArea val = self source
1476
+ ifTrue: [
1477
+ saveButton ifNotNil: [
1478
+ saveButton at: 'disabled' put: true].
1479
+ unsavedChanges := false]
1480
+ ifFalse: [
1481
+ saveButton ifNotNil: [
1482
+ saveButton removeAt: 'disabled'].
1483
+ unsavedChanges := true]
1576
1484
  !
1577
1485
 
1578
- searchSelectorReferencesFor: aString
1579
- self classesAndMetaclasses do: [:each |
1580
- each methodDictionary keysAndValuesDo: [:key :value |
1581
- key = selector ifTrue: [self implementors add: value].
1582
- (value messageSends includes: selector) ifTrue: [
1583
- self senders add: value]]]
1486
+ updateVariablesList
1487
+ ul2 contents: [:html | | li |
1488
+ li := html li
1489
+ with: 'self';
1490
+ onClick: [self selectVariable: self receiver named: 'self'].
1491
+ selectedVariableName = 'self' ifTrue: [
1492
+ li class: 'selected'].
1493
+ self arguments withIndexDo: [:each :index | | param |
1494
+ param := selectedContext temps at: index.
1495
+ li := html li
1496
+ with: each;
1497
+ onClick: [self selectVariable: param named: each].
1498
+ selectedVariableName = each ifTrue: [
1499
+ li class: 'selected']].
1500
+ self receiver class allInstanceVariableNames do: [:each | | ivar |
1501
+ ivar := self receiver instVarAt: each.
1502
+ li := html li
1503
+ with: each;
1504
+ onClick: [self selectVariable: ivar named: each].
1505
+ selectedVariableName = each ifTrue: [
1506
+ li class: 'selected']]].
1507
+ selectedVariable ifNil: [inspectButton at: 'disabled' put: true] ifNotNil: [inspectButton removeAt: 'disabled']
1584
1508
  ! !
1585
1509
 
1586
- !ReferencesBrowser methodsFor: 'initialization'!
1587
-
1588
- initialize
1589
- super initialize.
1590
- selector := ''
1591
- ! !
1510
+ TabWidget subclass: #IDETranscript
1511
+ instanceVariableNames: 'textarea'
1512
+ package: 'IDE'!
1592
1513
 
1593
- !ReferencesBrowser methodsFor: 'private'!
1514
+ !IDETranscript methodsFor: 'accessing'!
1594
1515
 
1595
- setInputEvents
1596
- input
1597
- onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
1598
- onKeyDown: [timer ifNotNil: [timer clearTimeout]]
1516
+ label
1517
+ ^'Transcript'
1599
1518
  ! !
1600
1519
 
1601
- !ReferencesBrowser methodsFor: 'rendering'!
1520
+ !IDETranscript methodsFor: 'actions'!
1602
1521
 
1603
- renderBoxOn: html
1604
- self
1605
- renderInputOn: html;
1606
- renderImplementorsOn: html;
1607
- renderSendersOn: html;
1608
- renderReferencedClassesOn: html
1522
+ clear
1523
+ textarea asJQuery val: ''
1609
1524
  !
1610
1525
 
1611
- renderInputOn: html
1612
- input := html input
1613
- class: 'implementors';
1614
- yourself.
1615
- input asJQuery val: selector.
1616
- self setInputEvents
1526
+ cr
1527
+ textarea asJQuery val: textarea asJQuery val, String cr.
1617
1528
  !
1618
1529
 
1619
- renderImplementorsOn: html
1620
- implementorsList := html ul class: 'jt_column implementors'.
1621
- self updateImplementorsList
1530
+ open
1531
+ TabManager current
1532
+ open;
1533
+ selectTab: self
1622
1534
  !
1623
1535
 
1624
- renderSendersOn: html
1625
- sendersList := html ul class: 'jt_column senders'.
1626
- self updateSendersList
1536
+ show: anObject
1537
+ textarea ifNil: [self open].
1538
+ textarea asJQuery val: textarea asJQuery val, anObject asString.
1539
+ ! !
1540
+
1541
+ !IDETranscript methodsFor: 'rendering'!
1542
+
1543
+ renderBoxOn: html
1544
+ textarea := html textarea.
1545
+ textarea
1546
+ class: 'jt_transcript';
1547
+ at: 'spellcheck' put: 'false'
1627
1548
  !
1628
1549
 
1629
- renderReferencedClassesOn: html
1630
- referencedClassesList := html ul class: 'jt_column referenced_classes'.
1631
- self updateReferencedClassesList
1550
+ renderButtonsOn: html
1551
+ html button
1552
+ with: 'Clear transcript';
1553
+ onClick: [self clear]
1632
1554
  ! !
1633
1555
 
1634
- !ReferencesBrowser methodsFor: 'testing'!
1556
+ IDETranscript class instanceVariableNames: 'current'!
1635
1557
 
1636
- canBeClosed
1637
- ^true
1558
+ !IDETranscript class methodsFor: 'initialization'!
1559
+
1560
+ initialize
1561
+ Transcript register: self current
1638
1562
  ! !
1639
1563
 
1640
- !ReferencesBrowser methodsFor: 'updating'!
1564
+ !IDETranscript class methodsFor: 'instance creation'!
1641
1565
 
1642
- updateImplementorsList
1643
- implementorsList contents: [:html |
1644
- html li
1645
- class: 'column_label';
1646
- with: 'Implementors (', self implementors size asString, ')';
1647
- style: 'font-weight: bold'.
1648
- self implementors do: [:each || li |
1649
- li := html li.
1650
- li
1651
- with: (each methodClass asString, ' >> ', self selector);
1652
- onClick: [self openBrowserOn: each]]]
1566
+ current
1567
+ ^current ifNil: [current := super new]
1653
1568
  !
1654
1569
 
1655
- updateSendersList
1656
- sendersList contents: [:html |
1657
- html li
1658
- class: 'column_label';
1659
- with: 'Senders (', self senders size asString, ')';
1660
- style: 'font-weight: bold'.
1661
- self senders do: [:each |
1662
- html li
1663
- with: (each methodClass asString, ' >> ', each selector);
1664
- onClick: [self openBrowserOn: each]]]
1570
+ new
1571
+ self shouldNotImplement
1665
1572
  !
1666
1573
 
1667
- updateReferencedClassesList
1668
- referencedClassesList contents: [:html |
1669
- html li
1670
- class: 'column_label';
1671
- with: 'Class references (', self referencedClasses size asString, ')';
1672
- style: 'font-weight: bold'.
1673
- self referencedClasses do: [:each |
1674
- html li
1675
- with: (each methodClass asString, ' >> ', each selector);
1676
- onClick: [self openBrowserOn: each]]]
1677
- ! !
1678
-
1679
- !ReferencesBrowser class methodsFor: 'instance creation'!
1680
-
1681
- search: aString
1682
- ^self new
1683
- searchReferencesFor: aString;
1684
- open
1574
+ open
1575
+ TabManager current
1576
+ open;
1577
+ selectTab: self current
1685
1578
  ! !
1686
1579
 
1687
- TabWidget subclass: #Debugger
1688
- instanceVariableNames: 'error selectedContext sourceArea ul ul2 inspector saveButton unsavedChanges selectedVariable selectedVariableName inspectButton'
1689
- category: 'IDE'!
1580
+ TabWidget subclass: #Inspector
1581
+ instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
1582
+ package: 'IDE'!
1690
1583
 
1691
- !Debugger methodsFor: 'accessing'!
1584
+ !Inspector methodsFor: 'accessing'!
1692
1585
 
1693
- error
1694
- ^error
1586
+ label
1587
+ ^label ifNil: ['Inspector (nil)']
1695
1588
  !
1696
1589
 
1697
- error: anError
1698
- error := anError
1590
+ selectedVariable
1591
+ ^selectedVariable
1699
1592
  !
1700
1593
 
1701
- label
1702
- ^'[Debugger]'
1594
+ selectedVariable: aString
1595
+ selectedVariable := aString
1703
1596
  !
1704
1597
 
1705
- source
1706
- ^self method
1707
- ifNil: ['Method doesn''t exist!!']
1708
- ifNotNil: [self method source]
1598
+ setLabel: aString
1599
+ label := aString
1709
1600
  !
1710
1601
 
1711
- method
1712
- ^selectedContext receiver class methodAt: selectedContext selector
1602
+ setVariables: aCollection
1603
+ variables := aCollection
1713
1604
  !
1714
1605
 
1715
- arguments
1716
- ^self method
1717
- ifNil: [selectedContext temps collect: [:each | nil]]
1718
- ifNotNil: [self method arguments]
1606
+ sourceArea
1607
+ ^sourceArea
1719
1608
  !
1720
1609
 
1721
- receiver
1722
- ^selectedContext receiver
1610
+ variables
1611
+ ^variables
1723
1612
  ! !
1724
1613
 
1725
- !Debugger methodsFor: 'actions'!
1726
-
1727
- selectContext: aContext
1728
- selectedContext := aContext.
1729
- selectedVariable := nil.
1730
- selectedVariableName := nil.
1731
- self
1732
- updateContextsList;
1733
- updateSourceArea;
1734
- updateInspector;
1735
- updateVariablesList;
1736
- updateStatus
1737
- !
1738
-
1739
- proceed
1740
- self close.
1741
- selectedContext receiver perform: selectedContext selector withArguments: selectedContext temps
1742
- !
1614
+ !Inspector methodsFor: 'actions'!
1743
1615
 
1744
- save
1745
- | protocol |
1746
- protocol := (selectedContext receiver class methodDictionary at: selectedContext selector) category.
1747
- selectedContext receiver class compile: sourceArea val category: protocol.
1748
- self updateStatus
1616
+ dive
1617
+ (self variables at: self selectedVariable) inspect
1749
1618
  !
1750
1619
 
1751
- selectVariable: anObject named: aString
1752
- selectedVariable := anObject.
1753
- selectedVariableName := aString.
1754
- inspector contents: [:html | html with: anObject printString].
1755
- self updateVariablesList
1620
+ inspect: anObject
1621
+ object := anObject.
1622
+ variables := #().
1623
+ object inspectOn: self
1756
1624
  !
1757
1625
 
1758
- inspectSelectedVariable
1759
- selectedVariable inspect
1760
- ! !
1761
-
1762
- !Debugger methodsFor: 'initialization'!
1763
-
1764
- initialize
1765
- super initialize.
1766
- unsavedChanges = false
1626
+ refresh
1627
+ self
1628
+ inspect: object;
1629
+ updateVariablesList;
1630
+ updateValueTextarea
1767
1631
  ! !
1768
1632
 
1769
- !Debugger methodsFor: 'rendering'!
1770
-
1771
- renderTopPanelOn: html
1772
- selectedContext := self error context.
1773
- html div
1774
- class: 'top';
1775
- with: [
1776
- html div
1777
- class: 'label';
1778
- with: self error messageText.
1779
- ul := html ul
1780
- class: 'jt_column debugger contexts';
1781
- with: [self renderContext: self error context on: html]]
1782
- !
1633
+ !Inspector methodsFor: 'rendering'!
1783
1634
 
1784
- renderContext: aContext on: html
1785
- | li |
1786
- li := html li.
1787
- selectedContext = aContext ifTrue: [
1788
- li class: 'selected'].
1789
- li
1790
- with: aContext asString;
1791
- onClick: [self selectContext: aContext].
1792
- aContext home ifNotNil: [self renderContext: aContext home on: html]
1635
+ renderBottomPanelOn: html
1636
+ html div
1637
+ class: 'jt_sourceCode';
1638
+ with: [
1639
+ sourceArea := SourceArea new
1640
+ receiver: object;
1641
+ onDoIt: [self refresh];
1642
+ yourself.
1643
+ sourceArea renderOn: html]
1793
1644
  !
1794
1645
 
1795
- renderBottomPanelOn: html
1796
- html div
1797
- class: 'jt_sourceCode debugger';
1798
- with: [
1799
- sourceArea := SourceArea new.
1800
- sourceArea renderOn: html].
1801
- ul2 := html ul class: 'jt_column debugger variables'.
1802
- inspector := html div class: 'jt_column debugger inspector'.
1803
- sourceArea
1804
- onKeyUp: [self updateStatus]
1646
+ renderBoxOn: html
1647
+ self
1648
+ renderTopPanelOn: html;
1649
+ renderBottomPanelOn: html
1805
1650
  !
1806
1651
 
1807
1652
  renderButtonsOn: html
1808
- saveButton := html button
1809
- with: 'Save';
1810
- onClick: [self save].
1811
- html button
1653
+ html button
1812
1654
  with: 'DoIt';
1813
- onClick: [sourceArea doIt].
1814
- html button
1655
+ onClick: [self sourceArea doIt].
1656
+ html button
1815
1657
  with: 'PrintIt';
1816
- onClick: [sourceArea printIt].
1817
- html button
1818
- with: 'InspectIt';
1819
- onClick: [sourceArea inspectIt].
1658
+ onClick: [self sourceArea printIt].
1820
1659
  html button
1821
- with: 'Proceed';
1822
- onClick: [self proceed].
1823
- html button
1824
- with: 'Abandon';
1825
- onClick: [self close].
1826
- inspectButton := html button
1827
- class: 'jt_button debugger inspect';
1828
- with: 'Inspect';
1829
- onClick: [self inspectSelectedVariable].
1830
- self
1831
- updateSourceArea;
1832
- updateStatus;
1833
- updateVariablesList;
1834
- updateInspector
1660
+ with: 'InspectIt';
1661
+ onClick: [self sourceArea inspectIt].
1662
+ self updateButtons
1835
1663
  !
1836
1664
 
1837
- renderBoxOn: html
1838
- self
1839
- renderTopPanelOn: html;
1840
- renderBottomPanelOn: html
1665
+ renderTopPanelOn: html
1666
+ html div
1667
+ class: 'top';
1668
+ with: [
1669
+ variablesList := html ul class: 'jt_column variables'.
1670
+ valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
1671
+ html div class: 'jt_tabs inspector'; with: [
1672
+ html button
1673
+ class: 'jt_button inspector refresh';
1674
+ with: 'Refresh';
1675
+ onClick: [self refresh].
1676
+ diveButton := html button
1677
+ class: 'jt_button inspector dive';
1678
+ with: 'Dive';
1679
+ onClick: [self dive]].
1680
+ html div class: 'jt_clear'].
1681
+ self
1682
+ updateVariablesList;
1683
+ updateValueTextarea.
1841
1684
  ! !
1842
1685
 
1843
- !Debugger methodsFor: 'testing'!
1686
+ !Inspector methodsFor: 'testing'!
1844
1687
 
1845
1688
  canBeClosed
1846
- ^true
1689
+ ^true
1847
1690
  ! !
1848
1691
 
1849
- !Debugger methodsFor: 'updating'!
1850
-
1851
- updateContextsList
1852
- ul contents: [:html |
1853
- self renderContext: self error context on: html]
1854
- !
1692
+ !Inspector methodsFor: 'updating'!
1855
1693
 
1856
- updateSourceArea
1857
- sourceArea val: self source
1694
+ selectVariable: aString
1695
+ self selectedVariable: aString.
1696
+ self
1697
+ updateVariablesList;
1698
+ updateValueTextarea;
1699
+ updateButtons
1858
1700
  !
1859
1701
 
1860
- updateStatus
1861
- sourceArea val = self source
1862
- ifTrue: [
1863
- saveButton ifNotNil: [
1864
- saveButton at: 'disabled' put: true].
1865
- unsavedChanges := false]
1866
- ifFalse: [
1867
- saveButton ifNotNil: [
1868
- saveButton removeAt: 'disabled'].
1869
- unsavedChanges := true]
1702
+ updateButtons
1703
+ (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
1704
+ ifFalse: [diveButton at: 'disabled' put: true]
1705
+ ifTrue: [diveButton removeAt: 'disabled']
1870
1706
  !
1871
1707
 
1872
- updateInspector
1873
- inspector contents: [:html |]
1708
+ updateValueTextarea
1709
+ valueTextarea asJQuery val: (self selectedVariable isNil
1710
+ ifTrue: ['']
1711
+ ifFalse: [(self variables at: self selectedVariable) printString])
1874
1712
  !
1875
1713
 
1876
1714
  updateVariablesList
1877
- ul2 contents: [:html | | li |
1878
- li := html li
1879
- with: 'self';
1880
- onClick: [self selectVariable: self receiver named: 'self'].
1881
- selectedVariableName = 'self' ifTrue: [
1882
- li class: 'selected'].
1883
- self arguments withIndexDo: [:each :index | | param |
1884
- param := selectedContext temps at: index.
1885
- li := html li
1886
- with: each;
1887
- onClick: [self selectVariable: param named: each].
1888
- selectedVariableName = each ifTrue: [
1889
- li class: 'selected']].
1890
- self receiver class allInstanceVariableNames do: [:each | | ivar |
1891
- ivar := self receiver instVarAt: each.
1892
- li := html li
1715
+ variablesList contents: [:html |
1716
+ self variables keys do: [:each || li |
1717
+ li := html li.
1718
+ li
1893
1719
  with: each;
1894
- onClick: [self selectVariable: ivar named: each].
1895
- selectedVariableName = each ifTrue: [
1896
- li class: 'selected']]].
1897
- selectedVariable ifNil: [inspectButton at: 'disabled' put: true] ifNotNil: [inspectButton removeAt: 'disabled']
1720
+ onClick: [self selectVariable: each].
1721
+ self selectedVariable = each ifTrue: [
1722
+ li class: 'selected']]]
1723
+ ! !
1724
+
1725
+ !Inspector class methodsFor: 'instance creation'!
1726
+
1727
+ on: anObject
1728
+ ^self new
1729
+ inspect: anObject;
1730
+ yourself
1898
1731
  ! !
1899
1732
 
1900
1733
  TabWidget subclass: #ProgressBar
1901
1734
  instanceVariableNames: 'percent progressDiv div'
1902
- category: 'IDE'!
1735
+ package: 'IDE'!
1903
1736
 
1904
1737
  !ProgressBar methodsFor: 'accessing'!
1905
1738
 
@@ -1934,12 +1767,233 @@ updatePercent: aNumber
1934
1767
  self renderProgressBar
1935
1768
  ! !
1936
1769
 
1770
+ TabWidget subclass: #ReferencesBrowser
1771
+ instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList matches matchesList'
1772
+ package: 'IDE'!
1773
+
1774
+ !ReferencesBrowser methodsFor: 'accessing'!
1775
+
1776
+ classesAndMetaclasses
1777
+ ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
1778
+ !
1779
+
1780
+ implementors
1781
+ ^implementors ifNil: [implementors := Array new]
1782
+ !
1783
+
1784
+ label
1785
+ ^'[References]'
1786
+ !
1787
+
1788
+ matches
1789
+ ^matches ifNil: [matches := Array new]
1790
+ !
1791
+
1792
+ referencedClasses
1793
+ ^referencedClasses ifNil: [referencedClasses := Array new]
1794
+ !
1795
+
1796
+ selector
1797
+ ^selector
1798
+ !
1799
+
1800
+ senders
1801
+ ^senders ifNil: [senders := Array new]
1802
+ ! !
1803
+
1804
+ !ReferencesBrowser methodsFor: 'actions'!
1805
+
1806
+ openBrowserOn: aMethod
1807
+ | browser |
1808
+ browser := Browser openOn: (aMethod methodClass isMetaclass
1809
+ ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
1810
+ aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
1811
+ browser
1812
+ selectProtocol: aMethod category;
1813
+ selectMethod: aMethod
1814
+ !
1815
+
1816
+ search: aString
1817
+ self
1818
+ searchReferencesFor: aString;
1819
+ updateImplementorsList;
1820
+ updateSendersList;
1821
+ updateReferencedClassesList;
1822
+ updateMatchesList
1823
+ !
1824
+
1825
+ searchMethodSource
1826
+ | regex |
1827
+ regex := selector allButFirst.
1828
+ self classesAndMetaclasses do: [:each |
1829
+ each methodDictionary values do: [:value |
1830
+ (value source match: regex) ifTrue: [
1831
+ self matches add: value]]]
1832
+ !
1833
+
1834
+ searchReferencedClasses
1835
+ self classesAndMetaclasses do: [:each |
1836
+ each methodDictionary values do: [:value |
1837
+ (value referencedClasses includes: selector) ifTrue: [
1838
+ self referencedClasses add: value]]]
1839
+ !
1840
+
1841
+ searchReferencesFor: aString
1842
+ selector := aString.
1843
+ implementors := Array new.
1844
+ senders := Array new.
1845
+ referencedClasses := Array new.
1846
+ matches := Array new.
1847
+ self searchMethodSource.
1848
+ (selector match: '^[A-Z]')
1849
+ ifFalse: [self searchSelectorReferences]
1850
+ ifTrue: [self searchReferencedClasses]
1851
+ !
1852
+
1853
+ searchSelectorReferences
1854
+ self classesAndMetaclasses do: [:each |
1855
+ each methodDictionary keysAndValuesDo: [:key :value |
1856
+ key = selector ifTrue: [self implementors add: value].
1857
+ (value messageSends includes: selector) ifTrue: [
1858
+ self senders add: value]]]
1859
+ ! !
1860
+
1861
+ !ReferencesBrowser methodsFor: 'initialization'!
1862
+
1863
+ initialize
1864
+ super initialize.
1865
+ selector := ''
1866
+ ! !
1867
+
1868
+ !ReferencesBrowser methodsFor: 'private'!
1869
+
1870
+ setInputEvents
1871
+ input
1872
+ onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
1873
+ onKeyDown: [timer ifNotNil: [timer clearTimeout]]
1874
+ ! !
1875
+
1876
+ !ReferencesBrowser methodsFor: 'rendering'!
1877
+
1878
+ renderBoxOn: html
1879
+ self
1880
+ renderInputOn: html;
1881
+ renderImplementorsOn: html;
1882
+ renderSendersOn: html;
1883
+ renderReferencedClassesOn: html;
1884
+ renderMatchesOn: html
1885
+ !
1886
+
1887
+ renderImplementorsOn: html
1888
+ implementorsList := html ul class: 'jt_column implementors'.
1889
+ self updateImplementorsList
1890
+ !
1891
+
1892
+ renderInputOn: html
1893
+ input := html input
1894
+ class: 'implementors';
1895
+ yourself.
1896
+ input asJQuery val: selector.
1897
+ self setInputEvents
1898
+ !
1899
+
1900
+ renderMatchesOn: html
1901
+ matchesList := html ul class: 'jt_column matches'.
1902
+ self updateMatchesList
1903
+ !
1904
+
1905
+ renderReferencedClassesOn: html
1906
+ referencedClassesList := html ul class: 'jt_column referenced_classes'.
1907
+ self updateReferencedClassesList
1908
+ !
1909
+
1910
+ renderSendersOn: html
1911
+ sendersList := html ul class: 'jt_column senders'.
1912
+ self updateSendersList
1913
+ ! !
1914
+
1915
+ !ReferencesBrowser methodsFor: 'testing'!
1916
+
1917
+ canBeClosed
1918
+ ^true
1919
+ ! !
1920
+
1921
+ !ReferencesBrowser methodsFor: 'updating'!
1922
+
1923
+ updateImplementorsList
1924
+ implementorsList contents: [:html |
1925
+ html li
1926
+ class: 'column_label';
1927
+ with: 'Implementors (', self implementors size asString, ')';
1928
+ style: 'font-weight: bold'.
1929
+ self implementors do: [:each || li |
1930
+ li := html li.
1931
+ li
1932
+ with: (each methodClass asString, ' >> ', self selector);
1933
+ onClick: [self openBrowserOn: each]]]
1934
+ !
1935
+
1936
+ updateMatchesList
1937
+ matchesList contents: [:html |
1938
+ html li
1939
+ class: 'column_label';
1940
+ with: 'Regex matches (', self matches size asString, ')';
1941
+ style: 'font-weight: bold'.
1942
+ self matches do: [:each || li |
1943
+ li := html li.
1944
+ li
1945
+ with: (each methodClass asString, ' >> ', each selector);
1946
+ onClick: [self openBrowserOn: each]]]
1947
+ !
1948
+
1949
+ updateReferencedClassesList
1950
+ referencedClassesList contents: [:html |
1951
+ html li
1952
+ class: 'column_label';
1953
+ with: 'Class references (', self referencedClasses size asString, ')';
1954
+ style: 'font-weight: bold'.
1955
+ self referencedClasses do: [:each |
1956
+ html li
1957
+ with: (each methodClass asString, ' >> ', each selector);
1958
+ onClick: [self openBrowserOn: each]]]
1959
+ !
1960
+
1961
+ updateSendersList
1962
+ sendersList contents: [:html |
1963
+ html li
1964
+ class: 'column_label';
1965
+ with: 'Senders (', self senders size asString, ')';
1966
+ style: 'font-weight: bold'.
1967
+ self senders do: [:each |
1968
+ html li
1969
+ with: (each methodClass asString, ' >> ', each selector);
1970
+ onClick: [self openBrowserOn: each]]]
1971
+ ! !
1972
+
1973
+ !ReferencesBrowser class methodsFor: 'instance creation'!
1974
+
1975
+ search: aString
1976
+ ^self new
1977
+ searchReferencesFor: aString;
1978
+ open
1979
+ ! !
1980
+
1937
1981
  TabWidget subclass: #TestRunner
1938
1982
  instanceVariableNames: 'selectedCategories packagesList selectedClasses classesList selectedMethods progressBar methodsList result statusDiv'
1939
- category: 'IDE'!
1983
+ package: 'IDE'!
1940
1984
 
1941
1985
  !TestRunner methodsFor: 'accessing'!
1942
1986
 
1987
+ allClasses
1988
+ ^TestCase allSubclasses
1989
+ !
1990
+
1991
+ classes
1992
+ ^(self allClasses
1993
+ select: [:each | self selectedCategories includes: each category])
1994
+ sort: [:a :b | a name > b name]
1995
+ !
1996
+
1943
1997
  label
1944
1998
  ^'SUnit'
1945
1999
  !
@@ -1953,36 +2007,26 @@ packages
1953
2007
  ^packages sort
1954
2008
  !
1955
2009
 
1956
- classes
1957
- ^(self allClasses
1958
- select: [:each | self selectedCategories includes: each category])
1959
- sort: [:a :b | a name > b name]
2010
+ progressBar
2011
+ ^progressBar ifNil: [progressBar := ProgressBar new]
1960
2012
  !
1961
2013
 
1962
- selectedCategories
1963
- ^selectedCategories ifNil: [selectedCategories := Array new]
2014
+ result
2015
+ ^result
1964
2016
  !
1965
2017
 
1966
- allClasses
1967
- ^TestCase allSubclasses
2018
+ selectedCategories
2019
+ ^selectedCategories ifNil: [selectedCategories := Array new]
1968
2020
  !
1969
2021
 
1970
2022
  selectedClasses
1971
2023
  ^selectedClasses ifNil: [selectedClasses := Array new]
1972
2024
  !
1973
2025
 
1974
- progressBar
1975
- ^progressBar ifNil: [progressBar := ProgressBar new]
1976
- !
1977
-
1978
2026
  statusInfo
1979
2027
  ^self printTotal, self printPasses, self printErrors, self printFailures
1980
2028
  !
1981
2029
 
1982
- result
1983
- ^result
1984
- !
1985
-
1986
2030
  testCases
1987
2031
  | testCases |
1988
2032
  testCases := #().
@@ -1992,6 +2036,24 @@ testCases
1992
2036
 
1993
2037
  !TestRunner methodsFor: 'actions'!
1994
2038
 
2039
+ performFailure: aTestCase
2040
+ aTestCase perform: aTestCase selector
2041
+ !
2042
+
2043
+ run: aCollection
2044
+ result := TestResult new.
2045
+ self
2046
+ updateStatusDiv;
2047
+ updateMethodsList.
2048
+ self progressBar updatePercent: 0.
2049
+ result total: aCollection size.
2050
+ aCollection do: [:each |
2051
+ [each runCaseFor: result.
2052
+ self progressBar updatePercent: result runs / result total * 100.
2053
+ self updateStatusDiv.
2054
+ self updateMethodsList] valueWithTimeout: 100].
2055
+ !
2056
+
1995
2057
  selectAllCategories
1996
2058
  self packages do: [:each |
1997
2059
  (selectedCategories includes: each) ifFalse: [
@@ -2001,6 +2063,15 @@ selectAllCategories
2001
2063
  updateClassesList
2002
2064
  !
2003
2065
 
2066
+ selectAllClasses
2067
+ self classes do: [:each |
2068
+ (selectedClasses includes: each) ifFalse: [
2069
+ self selectedClasses add: each]].
2070
+ self
2071
+ updateCategoriesList;
2072
+ updateClassesList
2073
+ !
2074
+
2004
2075
  toggleCategory: aCategory
2005
2076
  (self isSelectedCategory: aCategory)
2006
2077
  ifFalse: [selectedCategories add: aCategory]
@@ -2016,33 +2087,6 @@ toggleClass: aClass
2016
2087
  ifTrue: [selectedClasses remove: aClass].
2017
2088
  self
2018
2089
  updateClassesList
2019
- !
2020
-
2021
- selectAllClasses
2022
- self classes do: [:each |
2023
- (selectedClasses includes: each) ifFalse: [
2024
- self selectedClasses add: each]].
2025
- self
2026
- updateCategoriesList;
2027
- updateClassesList
2028
- !
2029
-
2030
- run: aCollection
2031
- result := TestResult new.
2032
- self
2033
- updateStatusDiv;
2034
- updateMethodsList.
2035
- self progressBar updatePercent: 0.
2036
- result total: aCollection size.
2037
- aCollection do: [:each |
2038
- [each runCaseFor: result.
2039
- self progressBar updatePercent: result runs / result total * 100.
2040
- self updateStatusDiv.
2041
- self updateMethodsList] valueWithTimeout: 100].
2042
- !
2043
-
2044
- performFailure: aTestCase
2045
- aTestCase perform: aTestCase selector
2046
2090
  ! !
2047
2091
 
2048
2092
  !TestRunner methodsFor: 'initialization'!
@@ -2095,12 +2139,12 @@ renderClassesOn: html
2095
2139
  self updateClassesList
2096
2140
  !
2097
2141
 
2098
- renderResultsOn: html
2099
- statusDiv := html div.
2100
- html with: self progressBar.
2101
- methodsList := html ul class: 'jt_column sunit results'.
2102
- self updateMethodsList.
2103
- self updateStatusDiv
2142
+ renderErrorsOn: html
2143
+ self result errors do: [:each |
2144
+ html li
2145
+ class: 'errors';
2146
+ with: each class name, ' >> ', each selector;
2147
+ onClick: [self performFailure: each]]
2104
2148
  !
2105
2149
 
2106
2150
  renderFailuresOn: html
@@ -2111,22 +2155,22 @@ renderFailuresOn: html
2111
2155
  onClick: [self performFailure: each]]
2112
2156
  !
2113
2157
 
2114
- renderErrorsOn: html
2115
- self result errors do: [:each |
2116
- html li
2117
- class: 'errors';
2118
- with: each class name, ' >> ', each selector;
2119
- onClick: [self performFailure: each]]
2158
+ renderResultsOn: html
2159
+ statusDiv := html div.
2160
+ html with: self progressBar.
2161
+ methodsList := html ul class: 'jt_column sunit results'.
2162
+ self updateMethodsList.
2163
+ self updateStatusDiv
2120
2164
  ! !
2121
2165
 
2122
2166
  !TestRunner methodsFor: 'testing'!
2123
2167
 
2124
- isSelectedClass: aClass
2125
- ^(self selectedClasses includes: aClass)
2126
- !
2127
-
2128
2168
  isSelectedCategory: aCategory
2129
2169
  ^(self selectedCategories includes: aCategory)
2170
+ !
2171
+
2172
+ isSelectedClass: aClass
2173
+ ^(self selectedClasses includes: aClass)
2130
2174
  ! !
2131
2175
 
2132
2176
  !TestRunner methodsFor: 'updating'!
@@ -2174,74 +2218,65 @@ updateStatusDiv
2174
2218
  html span with: self statusInfo]
2175
2219
  ! !
2176
2220
 
2177
- TabWidget subclass: #IDETranscript
2178
- instanceVariableNames: 'textarea'
2179
- category: 'IDE'!
2221
+ TabWidget subclass: #Workspace
2222
+ instanceVariableNames: 'sourceArea'
2223
+ package: 'IDE'!
2180
2224
 
2181
- !IDETranscript methodsFor: 'accessing'!
2225
+ !Workspace methodsFor: 'accessing'!
2182
2226
 
2183
2227
  label
2184
- ^'Transcript'
2228
+ ^'Workspace'
2185
2229
  ! !
2186
2230
 
2187
- !IDETranscript methodsFor: 'actions'!
2231
+ !Workspace methodsFor: 'actions'!
2188
2232
 
2189
- clear
2190
- textarea asJQuery val: ''
2233
+ clearWorkspace
2234
+ sourceArea clear
2191
2235
  !
2192
2236
 
2193
- cr
2194
- textarea asJQuery val: textarea asJQuery val, String cr.
2237
+ doIt
2238
+ sourceArea doIt
2195
2239
  !
2196
2240
 
2197
- show: anObject
2198
- textarea ifNil: [self open].
2199
- textarea asJQuery val: textarea asJQuery val, anObject asString.
2241
+ fileIn
2242
+ sourceArea fileIn
2200
2243
  !
2201
2244
 
2202
- open
2203
- TabManager current
2204
- open;
2205
- selectTab: self
2245
+ inspectIt
2246
+ sourceArea inspectIt
2247
+ !
2248
+
2249
+ printIt
2250
+ sourceArea printIt
2206
2251
  ! !
2207
2252
 
2208
- !IDETranscript methodsFor: 'rendering'!
2253
+ !Workspace methodsFor: 'rendering'!
2209
2254
 
2210
2255
  renderBoxOn: html
2211
- textarea := html textarea.
2212
- textarea
2213
- class: 'jt_transcript';
2214
- at: 'spellcheck' put: 'false'
2256
+ sourceArea := SourceArea new.
2257
+ sourceArea renderOn: html
2215
2258
  !
2216
2259
 
2217
2260
  renderButtonsOn: html
2218
2261
  html button
2219
- with: 'Clear transcript';
2220
- onClick: [self clear]
2221
- ! !
2222
-
2223
- IDETranscript class instanceVariableNames: 'current'!
2224
-
2225
- !IDETranscript class methodsFor: 'initialization'!
2226
-
2227
- initialize
2228
- Transcript register: self current
2229
- ! !
2230
-
2231
- !IDETranscript class methodsFor: 'instance creation'!
2232
-
2233
- new
2234
- self shouldNotImplement
2235
- !
2236
-
2237
- open
2238
- TabManager current
2239
- open;
2240
- selectTab: self current
2241
- !
2242
-
2243
- current
2244
- ^current ifNil: [current := super new]
2262
+ with: 'DoIt';
2263
+ title: 'ctrl+d';
2264
+ onClick: [self doIt].
2265
+ html button
2266
+ with: 'PrintIt';
2267
+ title: 'ctrl+p';
2268
+ onClick: [self printIt].
2269
+ html button
2270
+ with: 'InspectIt';
2271
+ title: 'ctrl+i';
2272
+ onClick: [self inspectIt].
2273
+ html button
2274
+ with: 'FileIn';
2275
+ title: 'ctrl+f';
2276
+ onClick: [self fileIn].
2277
+ html button
2278
+ with: 'Clear workspace';
2279
+ onClick: [self clearWorkspace]
2245
2280
  ! !
2246
2281
 
2247
2282
  !Object methodsFor: '*IDE'!
@@ -2263,32 +2298,28 @@ inspectOn: anInspector
2263
2298
  setVariables: variables
2264
2299
  ! !
2265
2300
 
2266
- !Date methodsFor: '*IDE'!
2301
+ !Collection methodsFor: '*IDE'!
2267
2302
 
2268
2303
  inspectOn: anInspector
2269
2304
  | variables |
2270
2305
  variables := Dictionary new.
2271
2306
  variables at: '#self' put: self.
2272
- variables at: '#year' put: self year.
2273
- variables at: '#month' put: self month.
2274
- variables at: '#day' put: self day.
2275
- variables at: '#hours' put: self hours.
2276
- variables at: '#minutes' put: self minutes.
2277
- variables at: '#seconds' put: self seconds.
2278
- variables at: '#milliseconds' put: self milliseconds.
2307
+ self withIndexDo: [:each :i |
2308
+ variables at: i put: each].
2279
2309
  anInspector
2280
2310
  setLabel: self printString;
2281
2311
  setVariables: variables
2282
2312
  ! !
2283
2313
 
2284
- !Collection methodsFor: '*IDE'!
2314
+ !HashedCollection methodsFor: '*IDE'!
2285
2315
 
2286
2316
  inspectOn: anInspector
2287
2317
  | variables |
2288
2318
  variables := Dictionary new.
2289
2319
  variables at: '#self' put: self.
2290
- self withIndexDo: [:each :i |
2291
- variables at: i put: each].
2320
+ variables at: '#keys' put: self keys.
2321
+ self keysAndValuesDo: [:key :value |
2322
+ variables at: key put: value].
2292
2323
  anInspector
2293
2324
  setLabel: self printString;
2294
2325
  setVariables: variables
@@ -2305,18 +2336,14 @@ inspectOn: anInspector
2305
2336
  anInspector setLabel: label
2306
2337
  ! !
2307
2338
 
2308
- !MethodContext methodsFor: '*IDE'!
2339
+ !Set methodsFor: '*IDE'!
2309
2340
 
2310
2341
  inspectOn: anInspector
2311
2342
  | variables |
2312
2343
  variables := Dictionary new.
2313
2344
  variables at: '#self' put: self.
2314
- variables at: '#home' put: self home.
2315
- variables at: '#receiver' put: self receiver.
2316
- variables at: '#selector' put: self selector.
2317
- variables at: '#temps' put: self temps.
2318
- self class instanceVariableNames do: [:each |
2319
- variables at: each put: (self instVarAt: each)].
2345
+ elements withIndexDo: [:each :i |
2346
+ variables at: i put: each].
2320
2347
  anInspector
2321
2348
  setLabel: self printString;
2322
2349
  setVariables: variables
@@ -2340,28 +2367,36 @@ inspectOn: anInspector
2340
2367
  setVariables: variables
2341
2368
  ! !
2342
2369
 
2343
- !Set methodsFor: '*IDE'!
2370
+ !Date methodsFor: '*IDE'!
2344
2371
 
2345
2372
  inspectOn: anInspector
2346
2373
  | variables |
2347
2374
  variables := Dictionary new.
2348
2375
  variables at: '#self' put: self.
2349
- elements withIndexDo: [:each :i |
2350
- variables at: i put: each].
2376
+ variables at: '#year' put: self year.
2377
+ variables at: '#month' put: self month.
2378
+ variables at: '#day' put: self day.
2379
+ variables at: '#hours' put: self hours.
2380
+ variables at: '#minutes' put: self minutes.
2381
+ variables at: '#seconds' put: self seconds.
2382
+ variables at: '#milliseconds' put: self milliseconds.
2351
2383
  anInspector
2352
2384
  setLabel: self printString;
2353
2385
  setVariables: variables
2354
2386
  ! !
2355
2387
 
2356
- !HashedCollection methodsFor: '*IDE'!
2388
+ !MethodContext methodsFor: '*IDE'!
2357
2389
 
2358
2390
  inspectOn: anInspector
2359
2391
  | variables |
2360
2392
  variables := Dictionary new.
2361
2393
  variables at: '#self' put: self.
2362
- variables at: '#keys' put: self keys.
2363
- self keysAndValuesDo: [:key :value |
2364
- variables at: key put: value].
2394
+ variables at: '#home' put: self home.
2395
+ variables at: '#receiver' put: self receiver.
2396
+ variables at: '#selector' put: self selector.
2397
+ variables at: '#temps' put: self temps.
2398
+ self class instanceVariableNames do: [:each |
2399
+ variables at: each put: (self instVarAt: each)].
2365
2400
  anInspector
2366
2401
  setLabel: self printString;
2367
2402
  setVariables: variables