resin 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,207 +1,331 @@
1
1
  Smalltalk current createPackage: 'IDE' properties: #{}!
2
- Widget subclass: #TabManager
3
- instanceVariableNames: 'selectedTab tabs opened ul input'
2
+ ErrorHandler subclass: #DebugErrorHandler
3
+ instanceVariableNames: ''
4
4
  category: 'IDE'!
5
5
 
6
- !TabManager methodsFor: 'accessing'!
6
+ !DebugErrorHandler methodsFor: 'error handling'!
7
7
 
8
- tabs
9
- ^tabs ifNil: [tabs := Array new]
10
- !
8
+ handleError: anError
9
+ [Debugger new
10
+ error: anError;
11
+ open] on: Error do: [:error |
12
+ ErrorHandler new handleError: error]
13
+ ! !
11
14
 
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
15
+ !DebugErrorHandler class methodsFor: 'initialization'!
16
+
17
+ initialize
18
+ self register
19
19
  ! !
20
20
 
21
- !TabManager methodsFor: 'actions'!
21
+ Widget subclass: #ClassesListNode
22
+ instanceVariableNames: 'browser theClass level nodes'
23
+ category: 'IDE'!
22
24
 
23
- updateBodyMargin
24
- self setBodyMargin: '#jtalk' asJQuery height
25
- !
25
+ !ClassesListNode methodsFor: ''!
26
26
 
27
- updatePosition
28
- <jQuery('#jtalk').css('top', '').css('bottom', '0px')>
29
- !
27
+ renderOn: html
28
+ | li cssClass |
29
+ cssClass := ''.
30
+ li := html li
31
+ onClick: [self browser selectClass: self theClass].
32
+ li asJQuery html: self label.
30
33
 
31
- removeBodyMargin
32
- self setBodyMargin: 0
33
- !
34
+ self browser selectedClass = self theClass ifTrue: [
35
+ cssClass := cssClass, ' selected'].
34
36
 
35
- setBodyMargin: anInteger
36
- '.jtalkBody' asJQuery css: 'margin-bottom' put: anInteger asString, 'px'
37
- !
37
+ self theClass comment isEmpty ifFalse: [
38
+ cssClass := cssClass, ' commented'].
38
39
 
39
- onResize: aBlock
40
- <jQuery('#jtalk').resizable({
41
- handles: 'n',
42
- resize: aBlock,
43
- minHeight: 230
44
- })>
45
- !
40
+ li class: cssClass.
46
41
 
47
- onWindowResize: aBlock
48
- <jQuery(window).resize(aBlock)>
49
- !
42
+ self nodes do: [:each |
43
+ each renderOn: html]
44
+ ! !
50
45
 
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]
46
+ !ClassesListNode methodsFor: 'accessing'!
47
+
48
+ nodes
49
+ ^nodes
59
50
  !
60
51
 
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]
52
+ theClass
53
+ ^theClass
69
54
  !
70
55
 
71
- newBrowserTab
72
- Browser open
56
+ theClass: aClass
57
+ theClass := aClass
73
58
  !
74
59
 
75
- selectTab: aWidget
76
- self open.
77
- selectedTab := aWidget.
78
- self tabs do: [:each |
79
- each hide].
80
- aWidget show.
81
-
82
- self update
60
+ browser
61
+ ^browser
83
62
  !
84
63
 
85
- closeTab: aWidget
86
- self removeTab: aWidget.
87
- self selectTab: self tabs last.
88
- aWidget remove.
89
- self update
64
+ browser: aBrowser
65
+ browser := aBrowser
90
66
  !
91
67
 
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
- ! !
68
+ level
69
+ ^level
70
+ !
99
71
 
100
- !TabManager methodsFor: 'adding/Removing'!
72
+ level: anInteger
73
+ level := anInteger
74
+ !
101
75
 
102
- addTab: aWidget
103
- self tabs add: aWidget.
104
- aWidget appendToJQuery: '#jtalk' asJQuery.
105
- aWidget hide
76
+ label
77
+ | str |
78
+ str := String new writeStream.
79
+ self level timesRepeat: [
80
+ str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
81
+ str nextPutAll: self theClass name.
82
+ ^str contents
106
83
  !
107
84
 
108
- removeTab: aWidget
109
- self tabs remove: aWidget.
110
- self update
85
+ getNodesFrom: aCollection
86
+ | children others |
87
+ children := #().
88
+ others := #().
89
+ aCollection do: [:each |
90
+ (each superclass = self theClass)
91
+ ifTrue: [children add: each]
92
+ ifFalse: [others add: each]].
93
+ nodes:= children collect: [:each |
94
+ ClassesListNode on: each browser: self browser classes: others level: self level + 1]
111
95
  ! !
112
96
 
113
- !TabManager methodsFor: 'initialization'!
97
+ !ClassesListNode class methodsFor: 'instance creation'!
114
98
 
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]
99
+ on: aClass browser: aBrowser classes: aCollection level: anInteger
100
+ ^self new
101
+ theClass: aClass;
102
+ browser: aBrowser;
103
+ level: anInteger;
104
+ getNodesFrom: aCollection;
105
+ yourself
130
106
  ! !
131
107
 
132
- !TabManager methodsFor: 'rendering'!
108
+ Widget subclass: #ClassesList
109
+ instanceVariableNames: 'browser ul nodes'
110
+ category: 'IDE'!
133
111
 
134
- renderOn: html
135
- html div id: 'logo'.
136
- self renderToolbarOn: html.
137
- ul := html ul
138
- id: 'jtalkTabs';
139
- yourself.
140
- self renderTabs
112
+ !ClassesList methodsFor: 'accessing'!
113
+
114
+ category
115
+ ^self browser selectedPackage
141
116
  !
142
117
 
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]
118
+ nodes
119
+ nodes ifNil: [nodes := self getNodes].
120
+ ^nodes
161
121
  !
162
122
 
163
- renderTabs
164
- 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]]
123
+ browser
124
+ ^browser
174
125
  !
175
126
 
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]]
187
- ! !
127
+ browser: aBrowser
128
+ browser := aBrowser
129
+ !
188
130
 
189
- !TabManager methodsFor: 'updating'!
131
+ getNodes
132
+ | classes children others |
133
+ classes := self browser classes.
134
+ children := #().
135
+ others := #().
136
+ classes do: [:each |
137
+ (classes includes: each superclass)
138
+ ifFalse: [children add: each]
139
+ ifTrue: [others add: each]].
140
+ ^children collect: [:each |
141
+ ClassesListNode on: each browser: self browser classes: others level: 0]
142
+ !
190
143
 
191
- update
192
- self renderTabs
144
+ resetNodes
145
+ nodes := nil
193
146
  ! !
194
147
 
195
- TabManager class instanceVariableNames: 'current'!
148
+ !ClassesList methodsFor: 'rendering'!
196
149
 
197
- !TabManager class methodsFor: 'instance creation'!
150
+ renderOn: html
151
+ ul := html ul
152
+ class: 'jt_column browser classes';
153
+ yourself.
154
+ self updateNodes
155
+ !
198
156
 
199
- current
200
- ^current ifNil: [current := super new]
157
+ updateNodes
158
+ ul contents: [:html |
159
+ self nodes do: [:each |
160
+ each renderOn: html]]
161
+ ! !
162
+
163
+ !ClassesList class methodsFor: 'instance creation'!
164
+
165
+ on: aBrowser
166
+ ^self new
167
+ browser: aBrowser;
168
+ yourself
169
+ ! !
170
+
171
+ Widget subclass: #SourceArea
172
+ instanceVariableNames: 'editor div receiver onDoIt'
173
+ category: 'IDE'!
174
+
175
+ !SourceArea methodsFor: 'accessing'!
176
+
177
+ val
178
+ ^editor getValue
201
179
  !
202
180
 
203
- new
204
- self shouldNotImplement
181
+ val: aString
182
+ editor setValue: aString
183
+ !
184
+
185
+ currentLine
186
+ ^editor getLine: (editor getCursor line)
187
+ !
188
+
189
+ selection
190
+ ^editor getSelection
191
+ !
192
+
193
+ selectionEnd
194
+ ^textarea element selectionEnd
195
+ !
196
+
197
+ selectionStart
198
+ ^textarea element selectionStart
199
+ !
200
+
201
+ selectionStart: anInteger
202
+ textarea element selectionStart: anInteger
203
+ !
204
+
205
+ selectionEnd: anInteger
206
+ textarea element selectionEnd: anInteger
207
+ !
208
+
209
+ setEditorOn: aTextarea
210
+ <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
211
+ theme: 'jtalk',
212
+ lineNumbers: true,
213
+ enterMode: 'flat',
214
+ matchBrackets: true,
215
+ electricChars: false
216
+ })>
217
+ !
218
+
219
+ editor
220
+ ^editor
221
+ !
222
+
223
+ receiver
224
+ ^receiver ifNil: [DoIt new]
225
+ !
226
+
227
+ receiver: anObject
228
+ receiver := anObject
229
+ !
230
+
231
+ onDoIt: aBlock
232
+ onDoIt := aBlock
233
+ !
234
+
235
+ onDoIt
236
+ ^onDoIt
237
+ !
238
+
239
+ currentLineOrSelection
240
+ ^editor somethingSelected
241
+ ifFalse: [self currentLine]
242
+ ifTrue: [self selection]
243
+ ! !
244
+
245
+ !SourceArea methodsFor: 'actions'!
246
+
247
+ clear
248
+ self val: ''
249
+ !
250
+
251
+ doIt
252
+ | result |
253
+ result := self eval: self currentLineOrSelection.
254
+ self onDoIt ifNotNil: [self onDoIt value].
255
+ ^result
256
+ !
257
+
258
+ eval: aString
259
+ | compiler |
260
+ compiler := Compiler new.
261
+ [compiler parseExpression: aString] on: Error do: [:ex |
262
+ ^window alert: ex messageText].
263
+ ^(compiler load: 'doIt ^[', aString, '] value' forClass: DoIt) fn applyTo: self receiver arguments: #()
264
+ !
265
+
266
+ handleKeyDown: anEvent
267
+ <if(anEvent.ctrlKey) {
268
+ if(anEvent.keyCode === 80) { //ctrl+p
269
+ self._printIt();
270
+ anEvent.preventDefault();
271
+ return false;
272
+ }
273
+ if(anEvent.keyCode === 68) { //ctrl+d
274
+ self._doIt();
275
+ anEvent.preventDefault();
276
+ return false;
277
+ }
278
+ if(anEvent.keyCode === 73) { //ctrl+i
279
+ self._inspectIt();
280
+ anEvent.preventDefault();
281
+ return false;
282
+ }
283
+ }>
284
+ !
285
+
286
+ inspectIt
287
+ self doIt inspect
288
+ !
289
+
290
+ print: aString
291
+ | start stop |
292
+ start := HashedCollection new.
293
+ stop := HashedCollection new.
294
+ start at: 'line' put: (editor getCursor: false) line.
295
+ start at: 'ch' put: (editor getCursor: false) ch.
296
+ stop at: 'line' put: (start at: 'line').
297
+ stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
298
+ editor replaceSelection: (editor getSelection, ' ', aString, ' ').
299
+ editor setCursor: (editor getCursor: true).
300
+ editor setSelection: stop end: start
301
+ !
302
+
303
+ printIt
304
+ self print: self doIt printString
305
+ !
306
+
307
+ fileIn
308
+ Importer new import: self currentLineOrSelection readStream
309
+ ! !
310
+
311
+ !SourceArea methodsFor: 'events'!
312
+
313
+ onKeyUp: aBlock
314
+ div onKeyUp: aBlock
315
+ !
316
+
317
+ onKeyDown: aBlock
318
+ div onKeyDown: aBlock
319
+ ! !
320
+
321
+ !SourceArea methodsFor: 'rendering'!
322
+
323
+ renderOn: html
324
+ | textarea |
325
+ div := html div class: 'source'.
326
+ div with: [textarea := html textarea].
327
+ self setEditorOn: textarea element.
328
+ div onKeyDown: [:e | self handleKeyDown: e]
205
329
  ! !
206
330
 
207
331
  Widget subclass: #TabWidget
@@ -278,59 +402,264 @@ open
278
402
  ^self new open
279
403
  ! !
280
404
 
281
- TabWidget subclass: #Workspace
282
- instanceVariableNames: 'sourceArea'
405
+ Widget subclass: #TabManager
406
+ instanceVariableNames: 'selectedTab tabs opened ul input'
283
407
  category: 'IDE'!
284
408
 
285
- !Workspace methodsFor: 'accessing'!
409
+ !TabManager methodsFor: 'accessing'!
286
410
 
287
- label
288
- ^'Workspace'
411
+ tabs
412
+ ^tabs ifNil: [tabs := Array new]
413
+ !
414
+
415
+ labelFor: aWidget
416
+ | label maxSize |
417
+ maxSize := 15.
418
+ label := aWidget label copyFrom: 0 to: (aWidget label size min: maxSize).
419
+ aWidget label size > maxSize ifTrue: [
420
+ label := label, '...'].
421
+ ^label
289
422
  ! !
290
423
 
291
- !Workspace methodsFor: 'actions'!
424
+ !TabManager methodsFor: 'actions'!
292
425
 
293
- clearWorkspace
294
- sourceArea clear
426
+ updateBodyMargin
427
+ self setBodyMargin: '#jtalk' asJQuery height
295
428
  !
296
429
 
297
- doIt
298
- sourceArea doIt
430
+ updatePosition
431
+ <jQuery('#jtalk').css('top', '').css('bottom', '0px')>
299
432
  !
300
433
 
301
- printIt
302
- sourceArea printIt
434
+ removeBodyMargin
435
+ self setBodyMargin: 0
303
436
  !
304
437
 
305
- inspectIt
306
- sourceArea inspectIt
438
+ setBodyMargin: anInteger
439
+ '.jtalkBody' asJQuery css: 'margin-bottom' put: anInteger asString, 'px'
307
440
  !
308
441
 
309
- fileIn
310
- sourceArea fileIn
311
- ! !
442
+ onResize: aBlock
443
+ <jQuery('#jtalk').resizable({
444
+ handles: 'n',
445
+ resize: aBlock,
446
+ minHeight: 230
447
+ })>
448
+ !
312
449
 
313
- !Workspace methodsFor: 'rendering'!
450
+ onWindowResize: aBlock
451
+ <jQuery(window).resize(aBlock)>
452
+ !
314
453
 
315
- renderBoxOn: html
316
- sourceArea := SourceArea new.
317
- sourceArea renderOn: html
454
+ open
455
+ opened ifFalse: [
456
+ 'body' asJQuery addClass: 'jtalkBody'.
457
+ '#jtalk' asJQuery show.
458
+ ul asJQuery show.
459
+ self updateBodyMargin.
460
+ selectedTab show.
461
+ opened := true]
318
462
  !
319
463
 
320
- renderButtonsOn: html
321
- html button
322
- with: 'DoIt';
323
- title: 'ctrl+d';
324
- onClick: [self doIt].
325
- html button
326
- with: 'PrintIt';
327
- title: 'ctrl+p';
328
- onClick: [self printIt].
329
- html button
330
- with: 'InspectIt';
331
- title: 'ctrl+i';
332
- onClick: [self inspectIt].
333
- html button
464
+ close
465
+ opened ifTrue: [
466
+ '#jtalk' asJQuery hide.
467
+ ul asJQuery hide.
468
+ selectedTab hide.
469
+ self removeBodyMargin.
470
+ 'body' asJQuery removeClass: 'jtalkBody'.
471
+ opened := false]
472
+ !
473
+
474
+ newBrowserTab
475
+ Browser open
476
+ !
477
+
478
+ selectTab: aWidget
479
+ self open.
480
+ selectedTab := aWidget.
481
+ self tabs do: [:each |
482
+ each hide].
483
+ aWidget show.
484
+
485
+ self update
486
+ !
487
+
488
+ closeTab: aWidget
489
+ self removeTab: aWidget.
490
+ self selectTab: self tabs last.
491
+ aWidget remove.
492
+ self update
493
+ !
494
+
495
+ search: aString
496
+ | searchedClass |
497
+ searchedClass := Smalltalk current at: aString.
498
+ searchedClass isClass
499
+ ifTrue: [Browser openOn: searchedClass]
500
+ ifFalse: [ReferencesBrowser search: aString]
501
+ ! !
502
+
503
+ !TabManager methodsFor: 'adding/Removing'!
504
+
505
+ addTab: aWidget
506
+ self tabs add: aWidget.
507
+ aWidget appendToJQuery: '#jtalk' asJQuery.
508
+ aWidget hide
509
+ !
510
+
511
+ removeTab: aWidget
512
+ self tabs remove: aWidget.
513
+ self update
514
+ ! !
515
+
516
+ !TabManager methodsFor: 'initialization'!
517
+
518
+ initialize
519
+ super initialize.
520
+ opened := true.
521
+ [:html | html div id: 'jtalk'] appendToJQuery: 'body' asJQuery.
522
+ 'body' asJQuery
523
+ addClass: 'jtalkBody'.
524
+ self appendToJQuery: '#jtalk' asJQuery.
525
+ self
526
+ addTab: IDETranscript current;
527
+ addTab: Workspace new;
528
+ addTab: TestRunner new.
529
+ self selectTab: self tabs last.
530
+ self
531
+ onResize: [self updateBodyMargin; updatePosition];
532
+ onWindowResize: [self updatePosition]
533
+ ! !
534
+
535
+ !TabManager methodsFor: 'rendering'!
536
+
537
+ renderOn: html
538
+ html div id: 'logo'.
539
+ self renderToolbarOn: html.
540
+ ul := html ul
541
+ id: 'jtalkTabs';
542
+ yourself.
543
+ self renderTabs
544
+ !
545
+
546
+ renderTabFor: aWidget on: html
547
+ | li |
548
+ li := html li.
549
+ selectedTab = aWidget ifTrue: [
550
+ li class: 'selected'].
551
+ li with: [
552
+ html span class: 'ltab'.
553
+ html span
554
+ class: 'mtab';
555
+ with: [
556
+ aWidget canBeClosed ifTrue: [
557
+ html span
558
+ class: 'close';
559
+ with: 'x';
560
+ onClick: [self closeTab: aWidget]].
561
+ html span with: (self labelFor: aWidget)].
562
+ html span class: 'rtab'];
563
+ onClick: [self selectTab: aWidget]
564
+ !
565
+
566
+ renderTabs
567
+ ul contents: [:html |
568
+ self tabs do: [:each |
569
+ self renderTabFor: each on: html].
570
+ html li
571
+ class: 'newtab';
572
+ with: [
573
+ html span class: 'ltab'.
574
+ html span class: 'mtab'; with: ' + '.
575
+ html span class: 'rtab'];
576
+ onClick: [self newBrowserTab]]
577
+ !
578
+
579
+ renderToolbarOn: html
580
+ html div
581
+ id: 'jt_toolbar';
582
+ with: [
583
+ input := html input
584
+ class: 'implementors';
585
+ yourself.
586
+ input onKeyPress: [:event |
587
+ event keyCode = 13 ifTrue: [
588
+ self search: input asJQuery val]].
589
+ html div id: 'jt_close'; onClick: [self close]]
590
+ ! !
591
+
592
+ !TabManager methodsFor: 'updating'!
593
+
594
+ update
595
+ self renderTabs
596
+ ! !
597
+
598
+ TabManager class instanceVariableNames: 'current'!
599
+
600
+ !TabManager class methodsFor: 'instance creation'!
601
+
602
+ current
603
+ ^current ifNil: [current := super new]
604
+ !
605
+
606
+ new
607
+ self shouldNotImplement
608
+ ! !
609
+
610
+ TabWidget subclass: #Workspace
611
+ instanceVariableNames: 'sourceArea'
612
+ category: 'IDE'!
613
+
614
+ !Workspace methodsFor: 'accessing'!
615
+
616
+ label
617
+ ^'Workspace'
618
+ ! !
619
+
620
+ !Workspace methodsFor: 'actions'!
621
+
622
+ clearWorkspace
623
+ sourceArea clear
624
+ !
625
+
626
+ doIt
627
+ sourceArea doIt
628
+ !
629
+
630
+ printIt
631
+ sourceArea printIt
632
+ !
633
+
634
+ inspectIt
635
+ sourceArea inspectIt
636
+ !
637
+
638
+ fileIn
639
+ sourceArea fileIn
640
+ ! !
641
+
642
+ !Workspace methodsFor: 'rendering'!
643
+
644
+ renderBoxOn: html
645
+ sourceArea := SourceArea new.
646
+ sourceArea renderOn: html
647
+ !
648
+
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
334
663
  with: 'FileIn';
335
664
  title: 'ctrl+f';
336
665
  onClick: [self fileIn].
@@ -361,9 +690,9 @@ packages
361
690
  !
362
691
 
363
692
  classes
364
- ^(Smalltalk current classes
693
+ ^((Smalltalk current classes
365
694
  select: [:each | each category = selectedPackage])
366
- sort: [:a :b | a name < b name]
695
+ sort: [:a :b | a name < b name]) asSet
367
696
  !
368
697
 
369
698
  protocols
@@ -768,8 +1097,8 @@ initialize
768
1097
  ajaxPutAt: anURL data: aString
769
1098
  jQuery
770
1099
  ajax: anURL options: #{ 'type' -> 'PUT'.
771
- 'contentType' -> 'application/json'.
772
1100
  'data' -> aString.
1101
+ 'contentType' -> 'text/plain'.
773
1102
  'error' -> [window alert: 'PUT request failed at: ', anURL] }
774
1103
  ! !
775
1104
 
@@ -1018,650 +1347,340 @@ openOn: aClass
1018
1347
  ^self new
1019
1348
  open;
1020
1349
  selectCategory: aClass category;
1021
- selectClass: aClass
1022
- !
1023
-
1024
- open
1025
- self new open
1026
- ! !
1027
-
1028
- TabWidget subclass: #Inspector
1029
- instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
1030
- category: 'IDE'!
1031
-
1032
- !Inspector methodsFor: 'accessing'!
1033
-
1034
- label
1035
- ^label ifNil: ['Inspector (nil)']
1036
- !
1037
-
1038
- variables
1039
- ^variables
1040
- !
1041
-
1042
- setVariables: aCollection
1043
- variables := aCollection
1044
- !
1045
-
1046
- setLabel: aString
1047
- label := aString
1048
- !
1049
-
1050
- selectedVariable
1051
- ^selectedVariable
1052
- !
1053
-
1054
- selectedVariable: aString
1055
- selectedVariable := aString
1056
- !
1057
-
1058
- sourceArea
1059
- ^sourceArea
1060
- ! !
1061
-
1062
- !Inspector methodsFor: 'actions'!
1063
-
1064
- inspect: anObject
1065
- object := anObject.
1066
- variables := #().
1067
- object inspectOn: self
1068
- !
1069
-
1070
- dive
1071
- (self variables at: self selectedVariable) inspect
1072
- !
1073
-
1074
- refresh
1075
- self
1076
- inspect: object;
1077
- updateVariablesList;
1078
- updateValueTextarea
1079
- ! !
1080
-
1081
- !Inspector methodsFor: 'rendering'!
1082
-
1083
- renderBoxOn: html
1084
- self
1085
- renderTopPanelOn: html;
1086
- renderBottomPanelOn: html
1087
- !
1088
-
1089
- renderTopPanelOn: html
1090
- html div
1091
- class: 'top';
1092
- with: [
1093
- variablesList := html ul class: 'jt_column variables'.
1094
- valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
1095
- html div class: 'jt_tabs inspector'; with: [
1096
- html button
1097
- class: 'jt_button inspector refresh';
1098
- with: 'Refresh';
1099
- onClick: [self refresh].
1100
- diveButton := html button
1101
- class: 'jt_button inspector dive';
1102
- with: 'Dive';
1103
- onClick: [self dive]].
1104
- html div class: 'jt_clear'].
1105
- self
1106
- updateVariablesList;
1107
- updateValueTextarea.
1108
- !
1109
-
1110
- renderBottomPanelOn: html
1111
- html div
1112
- class: 'jt_sourceCode';
1113
- with: [
1114
- sourceArea := SourceArea new
1115
- receiver: object;
1116
- onDoIt: [self refresh];
1117
- yourself.
1118
- sourceArea renderOn: html]
1119
- !
1120
-
1121
- renderButtonsOn: html
1122
- html button
1123
- with: 'DoIt';
1124
- onClick: [self sourceArea doIt].
1125
- html button
1126
- with: 'PrintIt';
1127
- onClick: [self sourceArea printIt].
1128
- html button
1129
- with: 'InspectIt';
1130
- onClick: [self sourceArea inspectIt].
1131
- self updateButtons
1132
- ! !
1133
-
1134
- !Inspector methodsFor: 'testing'!
1135
-
1136
- canBeClosed
1137
- ^true
1138
- ! !
1139
-
1140
- !Inspector methodsFor: 'updating'!
1141
-
1142
- updateVariablesList
1143
- variablesList contents: [:html |
1144
- self variables keys do: [:each || li |
1145
- li := html li.
1146
- li
1147
- with: each;
1148
- onClick: [self selectVariable: each].
1149
- self selectedVariable = each ifTrue: [
1150
- li class: 'selected']]]
1151
- !
1152
-
1153
- selectVariable: aString
1154
- self selectedVariable: aString.
1155
- self
1156
- updateVariablesList;
1157
- updateValueTextarea;
1158
- updateButtons
1159
- !
1160
-
1161
- updateValueTextarea
1162
- valueTextarea asJQuery val: (self selectedVariable isNil
1163
- ifTrue: ['']
1164
- ifFalse: [(self variables at: self selectedVariable) printString])
1165
- !
1166
-
1167
- updateButtons
1168
- (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
1169
- ifFalse: [diveButton at: 'disabled' put: true]
1170
- ifTrue: [diveButton removeAt: 'disabled']
1171
- ! !
1172
-
1173
- !Inspector class methodsFor: 'instance creation'!
1174
-
1175
- on: anObject
1176
- ^self new
1177
- inspect: anObject;
1178
- yourself
1179
- ! !
1180
-
1181
- TabWidget subclass: #ReferencesBrowser
1182
- instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
1183
- category: 'IDE'!
1184
-
1185
- !ReferencesBrowser methodsFor: 'accessing'!
1186
-
1187
- implementors
1188
- ^implementors ifNil: [implementors := Array new]
1189
- !
1190
-
1191
- label
1192
- ^'[References]'
1193
- !
1194
-
1195
- selector
1196
- ^selector
1197
- !
1198
-
1199
- senders
1200
- ^senders ifNil: [senders := Array new]
1201
- !
1202
-
1203
- classesAndMetaclasses
1204
- ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
1205
- !
1206
-
1207
- referencedClasses
1208
- ^referencedClasses ifNil: [referencedClasses := Array new]
1209
- ! !
1210
-
1211
- !ReferencesBrowser methodsFor: 'actions'!
1212
-
1213
- openBrowserOn: aMethod
1214
- | browser |
1215
- browser := Browser openOn: (aMethod methodClass isMetaclass
1216
- ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
1217
- aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
1218
- browser
1219
- selectProtocol: aMethod category;
1220
- selectMethod: aMethod
1221
- !
1222
-
1223
- searchReferencesFor: aString
1224
- selector := aString.
1225
- implementors := Array new.
1226
- senders := Array new.
1227
- referencedClasses := Array new.
1228
- (selector match: '^[A-Z]')
1229
- ifFalse: [self searchSelectorReferencesFor: selector]
1230
- ifTrue: [self searchReferencedClassesFor: selector]
1231
- !
1232
-
1233
- search: aString
1234
- self
1235
- searchReferencesFor: aString;
1236
- updateImplementorsList;
1237
- updateSendersList;
1238
- updateReferencedClassesList
1239
- !
1240
-
1241
- searchReferencedClassesFor: aString
1242
- self classesAndMetaclasses do: [:each |
1243
- each methodDictionary values do: [:value |
1244
- (value referencedClasses includes: selector) ifTrue: [
1245
- self referencedClasses add: value]]]
1246
- !
1247
-
1248
- searchSelectorReferencesFor: aString
1249
- self classesAndMetaclasses do: [:each |
1250
- each methodDictionary keysAndValuesDo: [:key :value |
1251
- key = selector ifTrue: [self implementors add: value].
1252
- (value messageSends includes: selector) ifTrue: [
1253
- self senders add: value]]]
1254
- ! !
1255
-
1256
- !ReferencesBrowser methodsFor: 'initialization'!
1257
-
1258
- initialize
1259
- super initialize.
1260
- selector := ''
1261
- ! !
1262
-
1263
- !ReferencesBrowser methodsFor: 'private'!
1264
-
1265
- setInputEvents
1266
- input
1267
- onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
1268
- onKeyDown: [timer ifNotNil: [timer clearTimeout]]
1269
- ! !
1270
-
1271
- !ReferencesBrowser methodsFor: 'rendering'!
1272
-
1273
- renderBoxOn: html
1274
- self
1275
- renderInputOn: html;
1276
- renderImplementorsOn: html;
1277
- renderSendersOn: html;
1278
- renderReferencedClassesOn: html
1279
- !
1280
-
1281
- renderInputOn: html
1282
- input := html input
1283
- class: 'implementors';
1284
- yourself.
1285
- input asJQuery val: selector.
1286
- self setInputEvents
1287
- !
1288
-
1289
- renderImplementorsOn: html
1290
- implementorsList := html ul class: 'jt_column implementors'.
1291
- self updateImplementorsList
1292
- !
1293
-
1294
- renderSendersOn: html
1295
- sendersList := html ul class: 'jt_column senders'.
1296
- self updateSendersList
1297
- !
1298
-
1299
- renderReferencedClassesOn: html
1300
- referencedClassesList := html ul class: 'jt_column referenced_classes'.
1301
- self updateReferencedClassesList
1302
- ! !
1303
-
1304
- !ReferencesBrowser methodsFor: 'testing'!
1305
-
1306
- canBeClosed
1307
- ^true
1308
- ! !
1309
-
1310
- !ReferencesBrowser methodsFor: 'updating'!
1311
-
1312
- updateImplementorsList
1313
- implementorsList contents: [:html |
1314
- html li
1315
- class: 'column_label';
1316
- with: 'Implementors (', self implementors size asString, ')';
1317
- style: 'font-weight: bold'.
1318
- self implementors do: [:each || li |
1319
- li := html li.
1320
- li
1321
- with: (each methodClass asString, ' >> ', self selector);
1322
- onClick: [self openBrowserOn: each]]]
1323
- !
1324
-
1325
- updateSendersList
1326
- sendersList contents: [:html |
1327
- html li
1328
- class: 'column_label';
1329
- with: 'Senders (', self senders size asString, ')';
1330
- style: 'font-weight: bold'.
1331
- self senders do: [:each |
1332
- html li
1333
- with: (each methodClass asString, ' >> ', each selector);
1334
- onClick: [self openBrowserOn: each]]]
1335
- !
1336
-
1337
- updateReferencedClassesList
1338
- referencedClassesList contents: [:html |
1339
- html li
1340
- class: 'column_label';
1341
- with: 'Class references (', self referencedClasses size asString, ')';
1342
- style: 'font-weight: bold'.
1343
- self referencedClasses do: [:each |
1344
- html li
1345
- with: (each methodClass asString, ' >> ', each selector);
1346
- onClick: [self openBrowserOn: each]]]
1347
- ! !
1348
-
1349
- !ReferencesBrowser class methodsFor: 'instance creation'!
1350
-
1351
- search: aString
1352
- ^self new
1353
- searchReferencesFor: aString;
1354
- open
1355
- ! !
1356
-
1357
- Widget subclass: #SourceArea
1358
- instanceVariableNames: 'editor div receiver onDoIt'
1359
- category: 'IDE'!
1360
-
1361
- !SourceArea methodsFor: 'accessing'!
1362
-
1363
- val
1364
- ^editor getValue
1350
+ selectClass: aClass
1365
1351
  !
1366
1352
 
1367
- val: aString
1368
- editor setValue: aString
1369
- !
1353
+ open
1354
+ self new open
1355
+ ! !
1370
1356
 
1371
- currentLine
1372
- ^editor getLine: (editor getCursor line)
1373
- !
1357
+ TabWidget subclass: #Inspector
1358
+ instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea diveButton sourceArea'
1359
+ category: 'IDE'!
1374
1360
 
1375
- selection
1376
- ^editor getSelection
1377
- !
1361
+ !Inspector methodsFor: 'accessing'!
1378
1362
 
1379
- selectionEnd
1380
- ^textarea element selectionEnd
1363
+ label
1364
+ ^label ifNil: ['Inspector (nil)']
1381
1365
  !
1382
1366
 
1383
- selectionStart
1384
- ^textarea element selectionStart
1367
+ variables
1368
+ ^variables
1385
1369
  !
1386
1370
 
1387
- selectionStart: anInteger
1388
- textarea element selectionStart: anInteger
1371
+ setVariables: aCollection
1372
+ variables := aCollection
1389
1373
  !
1390
1374
 
1391
- selectionEnd: anInteger
1392
- textarea element selectionEnd: anInteger
1375
+ setLabel: aString
1376
+ label := aString
1393
1377
  !
1394
1378
 
1395
- setEditorOn: aTextarea
1396
- <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
1397
- theme: 'jtalk',
1398
- lineNumbers: true,
1399
- enterMode: 'flat',
1400
- matchBrackets: true,
1401
- electricChars: false
1402
- })>
1379
+ selectedVariable
1380
+ ^selectedVariable
1403
1381
  !
1404
1382
 
1405
- editor
1406
- ^editor
1383
+ selectedVariable: aString
1384
+ selectedVariable := aString
1407
1385
  !
1408
1386
 
1409
- receiver
1410
- ^receiver ifNil: [DoIt new]
1411
- !
1387
+ sourceArea
1388
+ ^sourceArea
1389
+ ! !
1412
1390
 
1413
- receiver: anObject
1414
- receiver := anObject
1415
- !
1391
+ !Inspector methodsFor: 'actions'!
1416
1392
 
1417
- onDoIt: aBlock
1418
- onDoIt := aBlock
1393
+ inspect: anObject
1394
+ object := anObject.
1395
+ variables := #().
1396
+ object inspectOn: self
1419
1397
  !
1420
1398
 
1421
- onDoIt
1422
- ^onDoIt
1399
+ dive
1400
+ (self variables at: self selectedVariable) inspect
1423
1401
  !
1424
1402
 
1425
- currentLineOrSelection
1426
- ^editor somethingSelected
1427
- ifFalse: [self currentLine]
1428
- ifTrue: [self selection]
1403
+ refresh
1404
+ self
1405
+ inspect: object;
1406
+ updateVariablesList;
1407
+ updateValueTextarea
1429
1408
  ! !
1430
1409
 
1431
- !SourceArea methodsFor: 'actions'!
1410
+ !Inspector methodsFor: 'rendering'!
1432
1411
 
1433
- clear
1434
- self val: ''
1412
+ renderBoxOn: html
1413
+ self
1414
+ renderTopPanelOn: html;
1415
+ renderBottomPanelOn: html
1435
1416
  !
1436
1417
 
1437
- doIt
1438
- | result |
1439
- result := self eval: self currentLineOrSelection.
1440
- self onDoIt ifNotNil: [self onDoIt value].
1441
- ^result
1418
+ renderTopPanelOn: html
1419
+ html div
1420
+ class: 'top';
1421
+ with: [
1422
+ variablesList := html ul class: 'jt_column variables'.
1423
+ valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
1424
+ html div class: 'jt_tabs inspector'; with: [
1425
+ html button
1426
+ class: 'jt_button inspector refresh';
1427
+ with: 'Refresh';
1428
+ onClick: [self refresh].
1429
+ diveButton := html button
1430
+ class: 'jt_button inspector dive';
1431
+ with: 'Dive';
1432
+ onClick: [self dive]].
1433
+ html div class: 'jt_clear'].
1434
+ self
1435
+ updateVariablesList;
1436
+ updateValueTextarea.
1442
1437
  !
1443
1438
 
1444
- eval: aString
1445
- | compiler |
1446
- compiler := Compiler new.
1447
- [compiler parseExpression: aString] on: Error do: [:ex |
1448
- ^window alert: ex messageText].
1449
- ^(compiler load: 'doIt ^[', aString, '] value' forClass: DoIt) fn applyTo: self receiver arguments: #()
1439
+ renderBottomPanelOn: html
1440
+ html div
1441
+ class: 'jt_sourceCode';
1442
+ with: [
1443
+ sourceArea := SourceArea new
1444
+ receiver: object;
1445
+ onDoIt: [self refresh];
1446
+ yourself.
1447
+ sourceArea renderOn: html]
1450
1448
  !
1451
1449
 
1452
- handleKeyDown: anEvent
1453
- <if(anEvent.ctrlKey) {
1454
- if(anEvent.keyCode === 80) { //ctrl+p
1455
- self._printIt();
1456
- anEvent.preventDefault();
1457
- return false;
1458
- }
1459
- if(anEvent.keyCode === 68) { //ctrl+d
1460
- self._doIt();
1461
- anEvent.preventDefault();
1462
- return false;
1463
- }
1464
- if(anEvent.keyCode === 73) { //ctrl+i
1465
- self._inspectIt();
1466
- anEvent.preventDefault();
1467
- return false;
1468
- }
1469
- }>
1470
- !
1450
+ renderButtonsOn: html
1451
+ html button
1452
+ with: 'DoIt';
1453
+ onClick: [self sourceArea doIt].
1454
+ html button
1455
+ with: 'PrintIt';
1456
+ onClick: [self sourceArea printIt].
1457
+ html button
1458
+ with: 'InspectIt';
1459
+ onClick: [self sourceArea inspectIt].
1460
+ self updateButtons
1461
+ ! !
1471
1462
 
1472
- inspectIt
1473
- self doIt inspect
1474
- !
1463
+ !Inspector methodsFor: 'testing'!
1475
1464
 
1476
- print: aString
1477
- | start stop |
1478
- start := HashedCollection new.
1479
- stop := HashedCollection new.
1480
- start at: 'line' put: (editor getCursor: false) line.
1481
- start at: 'ch' put: (editor getCursor: false) ch.
1482
- stop at: 'line' put: (start at: 'line').
1483
- stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
1484
- editor replaceSelection: (editor getSelection, ' ', aString, ' ').
1485
- editor setCursor: (editor getCursor: true).
1486
- editor setSelection: stop end: start
1487
- !
1465
+ canBeClosed
1466
+ ^true
1467
+ ! !
1488
1468
 
1489
- printIt
1490
- self print: self doIt printString
1491
- !
1469
+ !Inspector methodsFor: 'updating'!
1492
1470
 
1493
- fileIn
1494
- Importer new import: self currentLineOrSelection readStream
1495
- ! !
1471
+ updateVariablesList
1472
+ variablesList contents: [:html |
1473
+ self variables keys do: [:each || li |
1474
+ li := html li.
1475
+ li
1476
+ with: each;
1477
+ onClick: [self selectVariable: each].
1478
+ self selectedVariable = each ifTrue: [
1479
+ li class: 'selected']]]
1480
+ !
1496
1481
 
1497
- !SourceArea methodsFor: 'events'!
1482
+ selectVariable: aString
1483
+ self selectedVariable: aString.
1484
+ self
1485
+ updateVariablesList;
1486
+ updateValueTextarea;
1487
+ updateButtons
1488
+ !
1498
1489
 
1499
- onKeyUp: aBlock
1500
- div onKeyUp: aBlock
1490
+ updateValueTextarea
1491
+ valueTextarea asJQuery val: (self selectedVariable isNil
1492
+ ifTrue: ['']
1493
+ ifFalse: [(self variables at: self selectedVariable) printString])
1501
1494
  !
1502
1495
 
1503
- onKeyDown: aBlock
1504
- div onKeyDown: aBlock
1496
+ updateButtons
1497
+ (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
1498
+ ifFalse: [diveButton at: 'disabled' put: true]
1499
+ ifTrue: [diveButton removeAt: 'disabled']
1505
1500
  ! !
1506
1501
 
1507
- !SourceArea methodsFor: 'rendering'!
1502
+ !Inspector class methodsFor: 'instance creation'!
1508
1503
 
1509
- renderOn: html
1510
- | textarea |
1511
- div := html div class: 'source'.
1512
- div with: [textarea := html textarea].
1513
- self setEditorOn: textarea element.
1514
- div onKeyDown: [:e | self handleKeyDown: e]
1504
+ on: anObject
1505
+ ^self new
1506
+ inspect: anObject;
1507
+ yourself
1515
1508
  ! !
1516
1509
 
1517
- Widget subclass: #ClassesList
1518
- instanceVariableNames: 'browser ul nodes'
1510
+ TabWidget subclass: #ReferencesBrowser
1511
+ instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
1519
1512
  category: 'IDE'!
1520
1513
 
1521
- !ClassesList methodsFor: 'accessing'!
1522
-
1523
- category
1524
- ^self browser selectedPackage
1525
- !
1526
-
1527
- nodes
1528
- nodes ifNil: [nodes := self getNodes].
1529
- ^nodes
1530
- !
1531
-
1532
- browser
1533
- ^browser
1534
- !
1535
-
1536
- browser: aBrowser
1537
- browser := aBrowser
1538
- !
1514
+ !ReferencesBrowser methodsFor: 'accessing'!
1539
1515
 
1540
- getNodes
1541
- | classes children others |
1542
- classes := self browser classes.
1543
- children := #().
1544
- others := #().
1545
- classes do: [:each |
1546
- (classes includes: each superclass)
1547
- ifFalse: [children add: each]
1548
- ifTrue: [others add: each]].
1549
- ^children collect: [:each |
1550
- ClassesListNode on: each browser: self browser classes: others level: 0]
1516
+ implementors
1517
+ ^implementors ifNil: [implementors := Array new]
1551
1518
  !
1552
1519
 
1553
- resetNodes
1554
- nodes := nil
1555
- ! !
1520
+ label
1521
+ ^'[References]'
1522
+ !
1556
1523
 
1557
- !ClassesList methodsFor: 'rendering'!
1524
+ selector
1525
+ ^selector
1526
+ !
1558
1527
 
1559
- renderOn: html
1560
- ul := html ul
1561
- class: 'jt_column browser classes';
1562
- yourself.
1563
- self updateNodes
1528
+ senders
1529
+ ^senders ifNil: [senders := Array new]
1564
1530
  !
1565
1531
 
1566
- updateNodes
1567
- ul contents: [:html |
1568
- self nodes do: [:each |
1569
- each renderOn: html]]
1532
+ classesAndMetaclasses
1533
+ ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
1534
+ !
1535
+
1536
+ referencedClasses
1537
+ ^referencedClasses ifNil: [referencedClasses := Array new]
1570
1538
  ! !
1571
1539
 
1572
- !ClassesList class methodsFor: 'instance creation'!
1540
+ !ReferencesBrowser methodsFor: 'actions'!
1573
1541
 
1574
- on: aBrowser
1575
- ^self new
1576
- browser: aBrowser;
1577
- yourself
1578
- ! !
1542
+ openBrowserOn: aMethod
1543
+ | browser |
1544
+ browser := Browser openOn: (aMethod methodClass isMetaclass
1545
+ ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
1546
+ aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
1547
+ browser
1548
+ selectProtocol: aMethod category;
1549
+ selectMethod: aMethod
1550
+ !
1579
1551
 
1580
- Widget subclass: #ClassesListNode
1581
- instanceVariableNames: 'browser theClass level nodes'
1582
- category: 'IDE'!
1552
+ searchReferencesFor: aString
1553
+ selector := aString.
1554
+ implementors := Array new.
1555
+ senders := Array new.
1556
+ referencedClasses := Array new.
1557
+ (selector match: '^[A-Z]')
1558
+ ifFalse: [self searchSelectorReferencesFor: selector]
1559
+ ifTrue: [self searchReferencedClassesFor: selector]
1560
+ !
1583
1561
 
1584
- !ClassesListNode methodsFor: ''!
1562
+ search: aString
1563
+ self
1564
+ searchReferencesFor: aString;
1565
+ updateImplementorsList;
1566
+ updateSendersList;
1567
+ updateReferencedClassesList
1568
+ !
1585
1569
 
1586
- renderOn: html
1587
- | li cssClass |
1588
- cssClass := ''.
1589
- li := html li
1590
- onClick: [self browser selectClass: self theClass].
1591
- li asJQuery html: self label.
1570
+ searchReferencedClassesFor: aString
1571
+ self classesAndMetaclasses do: [:each |
1572
+ each methodDictionary values do: [:value |
1573
+ (value referencedClasses includes: selector) ifTrue: [
1574
+ self referencedClasses add: value]]]
1575
+ !
1592
1576
 
1593
- self browser selectedClass = self theClass ifTrue: [
1594
- cssClass := cssClass, ' selected'].
1577
+ searchSelectorReferencesFor: aString
1578
+ self classesAndMetaclasses do: [:each |
1579
+ each methodDictionary keysAndValuesDo: [:key :value |
1580
+ key = selector ifTrue: [self implementors add: value].
1581
+ (value messageSends includes: selector) ifTrue: [
1582
+ self senders add: value]]]
1583
+ ! !
1595
1584
 
1596
- self theClass comment isEmpty ifFalse: [
1597
- cssClass := cssClass, ' commented'].
1585
+ !ReferencesBrowser methodsFor: 'initialization'!
1598
1586
 
1599
- li class: cssClass.
1587
+ initialize
1588
+ super initialize.
1589
+ selector := ''
1590
+ ! !
1600
1591
 
1601
- self nodes do: [:each |
1602
- each renderOn: html]
1592
+ !ReferencesBrowser methodsFor: 'private'!
1593
+
1594
+ setInputEvents
1595
+ input
1596
+ onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
1597
+ onKeyDown: [timer ifNotNil: [timer clearTimeout]]
1603
1598
  ! !
1604
1599
 
1605
- !ClassesListNode methodsFor: 'accessing'!
1600
+ !ReferencesBrowser methodsFor: 'rendering'!
1606
1601
 
1607
- nodes
1608
- ^nodes
1602
+ renderBoxOn: html
1603
+ self
1604
+ renderInputOn: html;
1605
+ renderImplementorsOn: html;
1606
+ renderSendersOn: html;
1607
+ renderReferencedClassesOn: html
1609
1608
  !
1610
1609
 
1611
- theClass
1612
- ^theClass
1610
+ renderInputOn: html
1611
+ input := html input
1612
+ class: 'implementors';
1613
+ yourself.
1614
+ input asJQuery val: selector.
1615
+ self setInputEvents
1613
1616
  !
1614
1617
 
1615
- theClass: aClass
1616
- theClass := aClass
1618
+ renderImplementorsOn: html
1619
+ implementorsList := html ul class: 'jt_column implementors'.
1620
+ self updateImplementorsList
1617
1621
  !
1618
1622
 
1619
- browser
1620
- ^browser
1623
+ renderSendersOn: html
1624
+ sendersList := html ul class: 'jt_column senders'.
1625
+ self updateSendersList
1621
1626
  !
1622
1627
 
1623
- browser: aBrowser
1624
- browser := aBrowser
1625
- !
1628
+ renderReferencedClassesOn: html
1629
+ referencedClassesList := html ul class: 'jt_column referenced_classes'.
1630
+ self updateReferencedClassesList
1631
+ ! !
1626
1632
 
1627
- level
1628
- ^level
1629
- !
1633
+ !ReferencesBrowser methodsFor: 'testing'!
1630
1634
 
1631
- level: anInteger
1632
- level := anInteger
1635
+ canBeClosed
1636
+ ^true
1637
+ ! !
1638
+
1639
+ !ReferencesBrowser methodsFor: 'updating'!
1640
+
1641
+ updateImplementorsList
1642
+ implementorsList contents: [:html |
1643
+ html li
1644
+ class: 'column_label';
1645
+ with: 'Implementors (', self implementors size asString, ')';
1646
+ style: 'font-weight: bold'.
1647
+ self implementors do: [:each || li |
1648
+ li := html li.
1649
+ li
1650
+ with: (each methodClass asString, ' >> ', self selector);
1651
+ onClick: [self openBrowserOn: each]]]
1633
1652
  !
1634
1653
 
1635
- label
1636
- | str |
1637
- str := String new writeStream.
1638
- self level timesRepeat: [
1639
- str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
1640
- str nextPutAll: self theClass name.
1641
- ^str contents
1654
+ updateSendersList
1655
+ sendersList contents: [:html |
1656
+ html li
1657
+ class: 'column_label';
1658
+ with: 'Senders (', self senders size asString, ')';
1659
+ style: 'font-weight: bold'.
1660
+ self senders do: [:each |
1661
+ html li
1662
+ with: (each methodClass asString, ' >> ', each selector);
1663
+ onClick: [self openBrowserOn: each]]]
1642
1664
  !
1643
1665
 
1644
- getNodesFrom: aCollection
1645
- | children others |
1646
- children := #().
1647
- others := #().
1648
- aCollection do: [:each |
1649
- (each superclass = self theClass)
1650
- ifTrue: [children add: each]
1651
- ifFalse: [others add: each]].
1652
- nodes:= children collect: [:each |
1653
- ClassesListNode on: each browser: self browser classes: others level: self level + 1]
1666
+ updateReferencedClassesList
1667
+ referencedClassesList contents: [:html |
1668
+ html li
1669
+ class: 'column_label';
1670
+ with: 'Class references (', self referencedClasses size asString, ')';
1671
+ style: 'font-weight: bold'.
1672
+ self referencedClasses do: [:each |
1673
+ html li
1674
+ with: (each methodClass asString, ' >> ', each selector);
1675
+ onClick: [self openBrowserOn: each]]]
1654
1676
  ! !
1655
1677
 
1656
- !ClassesListNode class methodsFor: 'instance creation'!
1678
+ !ReferencesBrowser class methodsFor: 'instance creation'!
1657
1679
 
1658
- on: aClass browser: aBrowser classes: aCollection level: anInteger
1680
+ search: aString
1659
1681
  ^self new
1660
- theClass: aClass;
1661
- browser: aBrowser;
1662
- level: anInteger;
1663
- getNodesFrom: aCollection;
1664
- yourself
1682
+ searchReferencesFor: aString;
1683
+ open
1665
1684
  ! !
1666
1685
 
1667
1686
  TabWidget subclass: #Debugger
@@ -1877,25 +1896,6 @@ updateVariablesList
1877
1896
  selectedVariable ifNil: [inspectButton at: 'disabled' put: true] ifNotNil: [inspectButton removeAt: 'disabled']
1878
1897
  ! !
1879
1898
 
1880
- ErrorHandler subclass: #DebugErrorHandler
1881
- instanceVariableNames: ''
1882
- category: 'IDE'!
1883
-
1884
- !DebugErrorHandler methodsFor: 'error handling'!
1885
-
1886
- handleError: anError
1887
- [Debugger new
1888
- error: anError;
1889
- open] on: Error do: [:error |
1890
- ErrorHandler new handleError: error]
1891
- ! !
1892
-
1893
- !DebugErrorHandler class methodsFor: 'initialization'!
1894
-
1895
- initialize
1896
- self register
1897
- ! !
1898
-
1899
1899
  TabWidget subclass: #ProgressBar
1900
1900
  instanceVariableNames: 'percent progressDiv div'
1901
1901
  category: 'IDE'!
@@ -2320,6 +2320,37 @@ inspectOn: anInspector
2320
2320
  setVariables: variables
2321
2321
  ! !
2322
2322
 
2323
+ !Date methodsFor: '*IDE'!
2324
+
2325
+ inspectOn: anInspector
2326
+ | variables |
2327
+ variables := Dictionary new.
2328
+ variables at: '#self' put: self.
2329
+ variables at: '#year' put: self year.
2330
+ variables at: '#month' put: self month.
2331
+ variables at: '#day' put: self day.
2332
+ variables at: '#hours' put: self hours.
2333
+ variables at: '#minutes' put: self minutes.
2334
+ variables at: '#seconds' put: self seconds.
2335
+ variables at: '#milliseconds' put: self milliseconds.
2336
+ anInspector
2337
+ setLabel: self printString;
2338
+ setVariables: variables
2339
+ ! !
2340
+
2341
+ !Set methodsFor: '*IDE'!
2342
+
2343
+ inspectOn: anInspector
2344
+ | variables |
2345
+ variables := Dictionary new.
2346
+ variables at: '#self' put: self.
2347
+ elements withIndexDo: [:each :i |
2348
+ variables at: i put: each].
2349
+ anInspector
2350
+ setLabel: self printString;
2351
+ setVariables: variables
2352
+ ! !
2353
+
2323
2354
  !HashedCollection methodsFor: '*IDE'!
2324
2355
 
2325
2356
  inspectOn: anInspector