resin 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. data/amber/css/amber-normalize.css +73 -73
  2. data/amber/css/amber-normalize.less +1 -1
  3. data/amber/css/amber.css +106 -106
  4. data/amber/css/helios.css +242 -0
  5. data/amber/images/hsplitter.png +0 -0
  6. data/amber/images/vsplitter.png +0 -0
  7. data/amber/js/Benchfib.deploy.js +116 -38
  8. data/amber/js/Benchfib.js +120 -42
  9. data/amber/js/Canvas.deploy.js +674 -403
  10. data/amber/js/Canvas.js +682 -411
  11. data/amber/js/Compiler-AST.deploy.js +1150 -0
  12. data/amber/js/Compiler-AST.js +1591 -0
  13. data/amber/js/Compiler-Core.deploy.js +1562 -0
  14. data/amber/js/Compiler-Core.js +1972 -0
  15. data/amber/js/Compiler-Exceptions.deploy.js +114 -0
  16. data/amber/js/Compiler-Exceptions.js +161 -0
  17. data/amber/js/Compiler-IR.deploy.js +2326 -0
  18. data/amber/js/Compiler-IR.js +3146 -0
  19. data/amber/js/Compiler-Inlining.deploy.js +1147 -0
  20. data/amber/js/Compiler-Inlining.js +1514 -0
  21. data/amber/js/Compiler-Semantic.deploy.js +1207 -0
  22. data/amber/js/Compiler-Semantic.js +1628 -0
  23. data/amber/js/Compiler-Tests.deploy.js +646 -60
  24. data/amber/js/Compiler-Tests.js +843 -82
  25. data/amber/js/Compiler.deploy.js +1097 -159
  26. data/amber/js/Compiler.js +1414 -161
  27. data/amber/js/Examples.deploy.js +31 -15
  28. data/amber/js/Examples.js +33 -17
  29. data/amber/js/Helios-Announcements.deploy.js +127 -0
  30. data/amber/js/Helios-Announcements.js +157 -0
  31. data/amber/js/Helios-Browser.deploy.js +1473 -0
  32. data/amber/js/Helios-Browser.js +1953 -0
  33. data/amber/js/Helios-Commands.deploy.js +403 -0
  34. data/amber/js/Helios-Commands.js +563 -0
  35. data/amber/js/Helios-Core.deploy.js +1070 -0
  36. data/amber/js/Helios-Core.js +1445 -0
  37. data/amber/js/Helios-Environments.deploy.js +132 -0
  38. data/amber/js/Helios-Environments.js +179 -0
  39. data/amber/js/Helios-Inspector.deploy.js +855 -0
  40. data/amber/js/Helios-Inspector.js +1155 -0
  41. data/amber/js/Helios-KeyBindings.deploy.js +753 -0
  42. data/amber/js/Helios-KeyBindings.js +1023 -0
  43. data/amber/js/Helios-Layout.deploy.js +383 -0
  44. data/amber/js/Helios-Layout.js +523 -0
  45. data/amber/js/Helios-Workspace.deploy.js +799 -0
  46. data/amber/js/Helios-Workspace.js +1074 -0
  47. data/amber/js/IDE.deploy.js +2541 -1490
  48. data/amber/js/IDE.js +2721 -1660
  49. data/amber/js/Importer-Exporter.deploy.js +671 -0
  50. data/amber/js/Importer-Exporter.js +816 -0
  51. data/amber/js/Kernel-Announcements.deploy.js +137 -20
  52. data/amber/js/Kernel-Announcements.js +176 -22
  53. data/amber/js/Kernel-Classes.deploy.js +555 -168
  54. data/amber/js/Kernel-Classes.js +662 -205
  55. data/amber/js/Kernel-Collections.deploy.js +1403 -618
  56. data/amber/js/Kernel-Collections.js +1545 -690
  57. data/amber/js/Kernel-Exceptions.deploy.js +109 -45
  58. data/amber/js/Kernel-Exceptions.js +123 -49
  59. data/amber/js/Kernel-Methods.deploy.js +196 -81
  60. data/amber/js/Kernel-Methods.js +214 -89
  61. data/amber/js/Kernel-Objects.deploy.js +1542 -1117
  62. data/amber/js/Kernel-Objects.js +1593 -1148
  63. data/amber/js/Kernel-Tests.deploy.js +1725 -772
  64. data/amber/js/Kernel-Tests.js +2301 -1123
  65. data/amber/js/Kernel-Transcript.deploy.js +23 -25
  66. data/amber/js/Kernel-Transcript.js +24 -26
  67. data/amber/js/SUnit.deploy.js +204 -131
  68. data/amber/js/SUnit.js +222 -139
  69. data/amber/js/Spaces.deploy.js +240 -0
  70. data/amber/js/Spaces.js +326 -0
  71. data/amber/js/amber.js +26 -7
  72. data/amber/js/boot.js +65 -47
  73. data/amber/js/init.js +1 -1
  74. data/amber/js/lib/CodeMirror/amber.css +21 -21
  75. data/amber/js/lib/CodeMirror/codemirror.css +119 -13
  76. data/amber/js/lib/CodeMirror/codemirror.js +2219 -1220
  77. data/amber/js/lib/CodeMirror/smalltalk.js +134 -129
  78. data/amber/js/lib/bootstrap/css/bootstrap.css +5837 -0
  79. data/amber/js/lib/bootstrap/css/bootstrap.min.css +841 -0
  80. data/amber/js/lib/bootstrap/img/glyphicons-halflings-white.png +0 -0
  81. data/amber/js/lib/bootstrap/img/glyphicons-halflings.png +0 -0
  82. data/amber/js/lib/bootstrap/js/bootstrap.js +2038 -0
  83. data/amber/js/lib/bootstrap/js/bootstrap.min.js +7 -0
  84. data/amber/js/lib/jQuery/jquery-1.8.2.min.js +2 -0
  85. data/amber/js/lib/jQuery/jquery-ui-1.8.24.custom.min.js +125 -0
  86. data/amber/st/Compiler-AST.st +505 -0
  87. data/amber/st/Compiler-Core.st +835 -0
  88. data/amber/st/Compiler-Exceptions.st +87 -0
  89. data/amber/st/Compiler-IR.st +1097 -0
  90. data/amber/st/Compiler-Inlining.st +650 -0
  91. data/amber/st/Compiler-Semantic.st +558 -0
  92. data/amber/st/Compiler-Tests.st +285 -381
  93. data/amber/st/Compiler.st +725 -2
  94. data/amber/st/Helios-Announcements.st +104 -0
  95. data/amber/st/Helios-Browser.st +708 -0
  96. data/amber/st/Helios-Commands.st +223 -0
  97. data/amber/st/Helios-Core.st +532 -0
  98. data/amber/st/Helios-Environments.st +98 -0
  99. data/amber/st/Helios-Inspector.st +367 -0
  100. data/amber/st/Helios-KeyBindings.st +337 -0
  101. data/amber/st/Helios-Layout.st +199 -0
  102. data/amber/st/Helios-Workspace.st +367 -0
  103. data/amber/st/IDE.st +75 -53
  104. data/amber/st/Importer-Exporter.st +386 -0
  105. data/amber/st/Kernel-Announcements.st +92 -0
  106. data/amber/st/Kernel-Classes.st +137 -15
  107. data/amber/st/Kernel-Collections.st +137 -47
  108. data/amber/st/Kernel-Exceptions.st +14 -0
  109. data/amber/st/Kernel-Methods.st +9 -1
  110. data/amber/st/Kernel-Objects.st +29 -5
  111. data/amber/st/Kernel-Tests.st +545 -199
  112. data/amber/st/SUnit.st +10 -0
  113. data/amber/st/Spaces.st +142 -0
  114. data/lib/resin/app.rb +1 -1
  115. metadata +86 -31
  116. data/amber/js/lib/jQuery/jquery-1.4.4.min.js +0 -167
  117. data/amber/js/lib/jQuery/jquery-1.6.4.min.js +0 -4
@@ -0,0 +1,223 @@
1
+ Smalltalk current createPackage: 'Helios-Commands' properties: #{}!
2
+ Object subclass: #HLCommand
3
+ instanceVariableNames: ''
4
+ package: 'Helios-Commands'!
5
+
6
+ !HLCommand methodsFor: 'accessing'!
7
+
8
+ documentation
9
+ ^ self class documentation
10
+ !
11
+
12
+ key
13
+ ^ self class key
14
+ !
15
+
16
+ label
17
+ ^ self class label
18
+ ! !
19
+
20
+ !HLCommand methodsFor: 'converting'!
21
+
22
+ asBinding
23
+ ^ (HLBindingAction on: self key labelled: self label)
24
+ callback: [ self execute ]
25
+ ! !
26
+
27
+ !HLCommand methodsFor: 'executing'!
28
+
29
+ execute
30
+ ! !
31
+
32
+ !HLCommand class methodsFor: 'accessing'!
33
+
34
+ bindingGroup
35
+ ^ nil
36
+ !
37
+
38
+ documentation
39
+ ^ ''
40
+ !
41
+
42
+ key
43
+ ^ nil
44
+ !
45
+
46
+ label
47
+ ^ ''
48
+ ! !
49
+
50
+ HLCommand subclass: #HLBrowserCommand
51
+ instanceVariableNames: 'model'
52
+ package: 'Helios-Commands'!
53
+
54
+ !HLBrowserCommand methodsFor: 'accessing'!
55
+
56
+ model
57
+ ^ model
58
+ !
59
+
60
+ model: aBrowserModel
61
+ model := aBrowserModel
62
+ ! !
63
+
64
+ !HLBrowserCommand class methodsFor: 'instance creation'!
65
+
66
+ on: aBrowserModel
67
+ ^ self new
68
+ model: aBrowserModel;
69
+ yourself
70
+ ! !
71
+
72
+ HLBrowserCommand subclass: #HLGoToCommand
73
+ instanceVariableNames: ''
74
+ package: 'Helios-Commands'!
75
+
76
+ !HLGoToCommand class methodsFor: 'accessing'!
77
+
78
+ bindingGroup
79
+ ^ 'Go to'
80
+ ! !
81
+
82
+ HLGoToCommand subclass: #HLGoToClassesCommand
83
+ instanceVariableNames: ''
84
+ package: 'Helios-Commands'!
85
+
86
+ !HLGoToClassesCommand methodsFor: 'executing'!
87
+
88
+ execute
89
+ self model selectedClass: self model selectedClass
90
+ ! !
91
+
92
+ !HLGoToClassesCommand class methodsFor: 'accessing'!
93
+
94
+ key
95
+ "c"
96
+
97
+ ^ 67
98
+ !
99
+
100
+ label
101
+ ^ 'Classes'
102
+ ! !
103
+
104
+ HLGoToCommand subclass: #HLGoToMethodsCommand
105
+ instanceVariableNames: ''
106
+ package: 'Helios-Commands'!
107
+
108
+ !HLGoToMethodsCommand methodsFor: 'executing'!
109
+
110
+ execute
111
+ self model selectedMethod: self model selectedMethod
112
+ ! !
113
+
114
+ !HLGoToMethodsCommand class methodsFor: 'accessing'!
115
+
116
+ key
117
+ "m"
118
+
119
+ ^ 77
120
+ !
121
+
122
+ label
123
+ ^ 'Methods'
124
+ ! !
125
+
126
+ HLGoToCommand subclass: #HLGoToPackagesCommand
127
+ instanceVariableNames: ''
128
+ package: 'Helios-Commands'!
129
+
130
+ !HLGoToPackagesCommand methodsFor: 'executing'!
131
+
132
+ execute
133
+ self model selectedPackage: self model selectedPackage
134
+ ! !
135
+
136
+ !HLGoToPackagesCommand class methodsFor: 'accessing'!
137
+
138
+ key
139
+ "p"
140
+
141
+ ^ 80
142
+ !
143
+
144
+ label
145
+ ^ 'Packages'
146
+ ! !
147
+
148
+ HLGoToCommand subclass: #HLGoToProtocolsCommand
149
+ instanceVariableNames: ''
150
+ package: 'Helios-Commands'!
151
+
152
+ !HLGoToProtocolsCommand methodsFor: 'executing'!
153
+
154
+ execute
155
+ self model selectedProtocol: self model selectedProtocol
156
+ ! !
157
+
158
+ !HLGoToProtocolsCommand class methodsFor: 'accessing'!
159
+
160
+ key
161
+ "p"
162
+
163
+ ^ 84
164
+ !
165
+
166
+ label
167
+ ^ 'Protocols'
168
+ ! !
169
+
170
+ HLBrowserCommand subclass: #HLToggleCommand
171
+ instanceVariableNames: ''
172
+ package: 'Helios-Commands'!
173
+
174
+ !HLToggleCommand class methodsFor: 'accessing'!
175
+
176
+ bindingGroup
177
+ ^ 'Toggle'
178
+ ! !
179
+
180
+ HLToggleCommand subclass: #HLToggleClassSideCommand
181
+ instanceVariableNames: ''
182
+ package: 'Helios-Commands'!
183
+
184
+ !HLToggleClassSideCommand methodsFor: 'executing'!
185
+
186
+ execute
187
+ self model showInstance: false
188
+ ! !
189
+
190
+ !HLToggleClassSideCommand class methodsFor: 'accessing'!
191
+
192
+ key
193
+ "c"
194
+
195
+ ^ 67
196
+ !
197
+
198
+ label
199
+ ^ 'Class side'
200
+ ! !
201
+
202
+ HLToggleCommand subclass: #HLToggleInstanceSideCommand
203
+ instanceVariableNames: ''
204
+ package: 'Helios-Commands'!
205
+
206
+ !HLToggleInstanceSideCommand methodsFor: 'executing'!
207
+
208
+ execute
209
+ self model showInstance: true
210
+ ! !
211
+
212
+ !HLToggleInstanceSideCommand class methodsFor: 'accessing'!
213
+
214
+ key
215
+ "i"
216
+
217
+ ^ 73
218
+ !
219
+
220
+ label
221
+ ^ 'Instance side'
222
+ ! !
223
+
@@ -0,0 +1,532 @@
1
+ Smalltalk current createPackage: 'Helios-Core' properties: #{}!
2
+ Object subclass: #HLTab
3
+ instanceVariableNames: 'widget label'
4
+ package: 'Helios-Core'!
5
+
6
+ !HLTab methodsFor: 'accessing'!
7
+
8
+ activate
9
+ self manager activate: self
10
+ !
11
+
12
+ add
13
+ self manager addTab: self
14
+ !
15
+
16
+ label
17
+ ^ label ifNil: [ '' ]
18
+ !
19
+
20
+ label: aString
21
+ label := aString
22
+ !
23
+
24
+ manager
25
+ ^ HLManager current
26
+ !
27
+
28
+ widget
29
+ ^ widget
30
+ !
31
+
32
+ widget: aWidget
33
+ widget := aWidget
34
+ ! !
35
+
36
+ !HLTab methodsFor: 'testing'!
37
+
38
+ isActive
39
+ ^ self manager activeTab = self
40
+ ! !
41
+
42
+ !HLTab class methodsFor: 'instance creation'!
43
+
44
+ on: aWidget labelled: aString
45
+ ^ self new
46
+ widget: aWidget;
47
+ label: aString;
48
+ yourself
49
+ ! !
50
+
51
+ Widget subclass: #HLWidget
52
+ instanceVariableNames: 'wrapper'
53
+ package: 'Helios-Core'!
54
+
55
+ !HLWidget methodsFor: 'accessing'!
56
+
57
+ manager
58
+ ^ HLManager current
59
+ !
60
+
61
+ wrapper
62
+ ^ wrapper
63
+ ! !
64
+
65
+ !HLWidget methodsFor: 'keybindings'!
66
+
67
+ registerBindings
68
+ self registerBindingsOn: self manager keyBinder bindings
69
+ !
70
+
71
+ registerBindingsOn: aBindingGroup
72
+ ! !
73
+
74
+ !HLWidget methodsFor: 'rendering'!
75
+
76
+ renderContentOn: html
77
+ !
78
+
79
+ renderOn: html
80
+ self registerBindings.
81
+
82
+ wrapper := html div.
83
+ [ :renderer | self renderContentOn: renderer ] appendToJQuery: wrapper asJQuery
84
+ ! !
85
+
86
+ !HLWidget methodsFor: 'updating'!
87
+
88
+ refresh
89
+ self wrapper ifNil: [ ^ self ].
90
+
91
+ self wrapper asJQuery empty.
92
+ [ :html | self renderContentOn: html ] appendToJQuery: self wrapper asJQuery
93
+ ! !
94
+
95
+ !HLWidget class methodsFor: 'accessing'!
96
+
97
+ openAsTab
98
+ HLManager current addTab: (HLTab on: self new labelled: self tabLabel)
99
+ !
100
+
101
+ tabLabel
102
+ ^ 'Tab'
103
+ !
104
+
105
+ tabPriority
106
+ ^ 500
107
+ ! !
108
+
109
+ !HLWidget class methodsFor: 'testing'!
110
+
111
+ canBeOpenAsTab
112
+ ^ false
113
+ ! !
114
+
115
+ HLWidget subclass: #HLDebugger
116
+ instanceVariableNames: ''
117
+ package: 'Helios-Core'!
118
+
119
+ HLWidget subclass: #HLFocusableWidget
120
+ instanceVariableNames: 'hiddenInput'
121
+ package: 'Helios-Core'!
122
+
123
+ !HLFocusableWidget methodsFor: 'accessing'!
124
+
125
+ focusClass
126
+ ^ 'focused'
127
+ ! !
128
+
129
+ !HLFocusableWidget methodsFor: 'events'!
130
+
131
+ blur
132
+ hiddenInput asJQuery blur
133
+ !
134
+
135
+ focus
136
+ hiddenInput asJQuery focus
137
+ !
138
+
139
+ hasFocus
140
+ ^ self wrapper notNil and: [ self wrapper asJQuery hasClass: self focusClass ]
141
+ ! !
142
+
143
+ !HLFocusableWidget methodsFor: 'rendering'!
144
+
145
+ renderContentOn: html
146
+ !
147
+
148
+ renderHiddenInputOn: html
149
+ hiddenInput := html input
150
+ style: 'position: absolute; left: -100000px;';
151
+ onBlur: [ self wrapper asJQuery removeClass: self focusClass ];
152
+ onFocus: [ self wrapper asJQuery addClass: self focusClass ]
153
+ !
154
+
155
+ renderOn: html
156
+ self registerBindings.
157
+ self renderHiddenInputOn: html.
158
+
159
+ wrapper := html div
160
+ class: 'hl_widget';
161
+ onClick: [ hiddenInput asJQuery focus ];
162
+ with: [
163
+ self renderContentOn: html ]
164
+ ! !
165
+
166
+ HLFocusableWidget subclass: #HLListWidget
167
+ instanceVariableNames: 'items selectedItem'
168
+ package: 'Helios-Core'!
169
+
170
+ !HLListWidget methodsFor: 'accessing'!
171
+
172
+ cssClassForItem: anObject
173
+ ^ self selectedItem = anObject
174
+ ifTrue: [ 'active' ]
175
+ ifFalse: [ 'inactive' ]
176
+ !
177
+
178
+ iconForItem: anObject
179
+ ^ ''
180
+ !
181
+
182
+ items
183
+ ^ items ifNil: [ items := self defaultItems ]
184
+ !
185
+
186
+ items: aCollection
187
+ items := aCollection
188
+ !
189
+
190
+ selectedItem
191
+ ^ selectedItem
192
+ !
193
+
194
+ selectedItem: anObject
195
+ selectedItem := anObject
196
+ ! !
197
+
198
+ !HLListWidget methodsFor: 'actions'!
199
+
200
+ activateFirstListItem
201
+ self activateListItem: (window jQuery: ((wrapper asJQuery find: 'li') get: 0))
202
+ !
203
+
204
+ activateListItem: aListItem
205
+ | parent position |
206
+
207
+ (aListItem get: 0) ifNil: [ ^self ].
208
+
209
+ <position = aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1>.
210
+
211
+ parent := aListItem parent.
212
+ parent children removeClass: 'active'.
213
+ aListItem addClass: 'active'.
214
+
215
+ "Move the scrollbar to show the active element"
216
+ aListItem position top < 0 ifTrue: [
217
+ (parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem position top - 10) ].
218
+ aListItem position top + aListItem height > parent height ifTrue: [
219
+ (parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem height - (parent height - aListItem position top)) +10 ].
220
+
221
+ "Activate the corresponding item"
222
+ self selectItem: (self items at: (aListItem attr: 'list-data') asNumber)
223
+ !
224
+
225
+ focus
226
+ super focus.
227
+ self items isEmpty ifFalse: [
228
+ self selectedItem ifNil: [ self activateFirstListItem ] ]
229
+ !
230
+
231
+ selectItem: anObject
232
+ self selectedItem: anObject
233
+ ! !
234
+
235
+ !HLListWidget methodsFor: 'defaults'!
236
+
237
+ defaultItems
238
+ ^ #()
239
+ ! !
240
+
241
+ !HLListWidget methodsFor: 'events'!
242
+
243
+ setupKeyBindings
244
+ | next |
245
+ hiddenInput asJQuery unbind: 'keydown'.
246
+
247
+ hiddenInput asJQuery keydown: [ :e | | selected |
248
+ selected := window jQuery: '.focused .nav-pills .active'.
249
+ e which = 38 ifTrue: [
250
+ self activateListItem: selected prev ].
251
+ e which = 40 ifTrue: [
252
+ next := selected next.
253
+ (next get: 0) ifNil: [ next := window jQuery: '.focused .nav-pills li:first-child' ].
254
+ self activateListItem: next ] ]
255
+ ! !
256
+
257
+ !HLListWidget methodsFor: 'rendering'!
258
+
259
+ renderButtonsOn: html
260
+ !
261
+
262
+ renderContentOn: html
263
+ html ul
264
+ class: 'nav nav-pills nav-stacked';
265
+ with: [ self renderListOn: html ].
266
+ html div class: 'pane_actions form-actions'; with: [
267
+ self renderButtonsOn: html ].
268
+
269
+ self setupKeyBindings
270
+ !
271
+
272
+ renderItem: anObject on: html
273
+ | li |
274
+
275
+ li := html li.
276
+ li
277
+ class: (self cssClassForItem: anObject);
278
+ at: 'list-data' put: (self items indexOf: anObject) asString;
279
+ with: [
280
+ html a
281
+ with: [
282
+ (html tag: 'i') class: (self iconForItem: anObject).
283
+ self renderItemLabel: anObject on: html ];
284
+ onClick: [
285
+ self activateListItem: li asJQuery ] ]
286
+ !
287
+
288
+ renderItemLabel: anObject on: html
289
+ html with: anObject asString
290
+ !
291
+
292
+ renderListOn: html
293
+ self items do: [ :each |
294
+ self renderItem: each on: html ]
295
+ ! !
296
+
297
+ HLListWidget subclass: #HLNavigationListWidget
298
+ instanceVariableNames: 'previous next'
299
+ package: 'Helios-Core'!
300
+
301
+ !HLNavigationListWidget methodsFor: 'accessing'!
302
+
303
+ next
304
+ ^ next
305
+ !
306
+
307
+ next: aWidget
308
+ next := aWidget.
309
+ aWidget previous = self ifFalse: [ aWidget previous: self ]
310
+ !
311
+
312
+ previous
313
+ ^ previous
314
+ !
315
+
316
+ previous: aWidget
317
+ previous := aWidget.
318
+ aWidget next = self ifFalse: [ aWidget next: self ]
319
+ ! !
320
+
321
+ !HLNavigationListWidget methodsFor: 'actions'!
322
+
323
+ nextFocus
324
+ self next ifNotNil: [ self next focus ]
325
+ !
326
+
327
+ previousFocus
328
+ self previous ifNotNil: [ self previous focus ]
329
+ ! !
330
+
331
+ !HLNavigationListWidget methodsFor: 'events'!
332
+
333
+ setupKeyBindings
334
+ super setupKeyBindings.
335
+
336
+ hiddenInput asJQuery keydown: [ :e |
337
+ e which = 39 ifTrue: [
338
+ self nextFocus ].
339
+ e which = 37 ifTrue: [
340
+ self previousFocus ] ]
341
+ ! !
342
+
343
+ HLWidget subclass: #HLManager
344
+ instanceVariableNames: 'tabs activeTab keyBinder environment'
345
+ package: 'Helios-Core'!
346
+
347
+ !HLManager methodsFor: 'accessing'!
348
+
349
+ activeTab
350
+ ^ activeTab
351
+ !
352
+
353
+ environment
354
+ "The default environment used by all Helios objects"
355
+
356
+ ^ environment ifNil: [ environment := self defaultEnvironment ]
357
+ !
358
+
359
+ environment: anEnvironment
360
+ environment := anEnvironment
361
+ !
362
+
363
+ keyBinder
364
+ ^ keyBinder ifNil: [ keyBinder := HLKeyBinder new ]
365
+ !
366
+
367
+ tabs
368
+ ^ tabs ifNil: [ tabs := OrderedCollection new ]
369
+ ! !
370
+
371
+ !HLManager methodsFor: 'actions'!
372
+
373
+ activate: aTab
374
+ self keyBinder flushBindings.
375
+ activeTab := aTab.
376
+
377
+ self
378
+ refresh;
379
+ show: aTab
380
+ !
381
+
382
+ addTab: aTab
383
+ self tabs add: aTab.
384
+ self activate: aTab
385
+ !
386
+
387
+ removeTab: aTab
388
+ "Todo: activate the previously activated tab. Keep a history of tabs selection"
389
+
390
+ (self tabs includes: aTab) ifFalse: [ ^ self ].
391
+
392
+ self tabs remove: aTab.
393
+ self refresh
394
+ ! !
395
+
396
+ !HLManager methodsFor: 'defaults'!
397
+
398
+ defaultEnvironment
399
+ ^ HLLocalEnvironment new
400
+ ! !
401
+
402
+ !HLManager methodsFor: 'initialization'!
403
+
404
+ initialize
405
+ super initialize.
406
+ self keyBinder setupEvents
407
+ ! !
408
+
409
+ !HLManager methodsFor: 'rendering'!
410
+
411
+ refresh
412
+ (window jQuery: '.navbar') remove.
413
+ (window jQuery: '#container') remove.
414
+ self appendToJQuery: 'body' asJQuery
415
+ !
416
+
417
+ renderAddOn: html
418
+ html li
419
+ class: 'dropdown';
420
+ with: [
421
+ html a
422
+ class: 'dropdown-toggle';
423
+ at: 'data-toggle' put: 'dropdown';
424
+ with: [
425
+ html with: 'Open...'.
426
+ (html tag: 'b') class: 'caret' ].
427
+ html ul
428
+ class: 'dropdown-menu';
429
+ with: [
430
+ ((HLWidget withAllSubclasses
431
+ select: [ :each | each canBeOpenAsTab ])
432
+ sorted: [ :a :b | a tabPriority < b tabPriority ])
433
+ do: [ :each |
434
+ html li with: [
435
+ html a
436
+ with: each tabLabel;
437
+ onClick: [ each openAsTab ] ] ] ] ]
438
+ !
439
+
440
+ renderContentOn: html
441
+ html div
442
+ class: 'navbar navbar-fixed-top';
443
+ with: [ html div
444
+ class: 'navbar-inner';
445
+ with: [ self renderTabsOn: html ] ].
446
+ html div id: 'container'
447
+ !
448
+
449
+ renderTabsOn: html
450
+ html ul
451
+ class: 'nav';
452
+ with: [
453
+ self tabs do: [ :each |
454
+ html li
455
+ class: (each isActive ifTrue: [ 'active' ] ifFalse: [ 'inactive' ]);
456
+ with: [
457
+ html a
458
+ with: [
459
+ ((html tag: 'i') class: 'icon-remove-circle')
460
+ onClick: [ self removeTab: each ].
461
+ html with: each label ];
462
+ onClick: [ each activate ] ] ].
463
+ self renderAddOn: html ]
464
+ !
465
+
466
+ show: aTab
467
+ (window jQuery: '#container') empty.
468
+ aTab widget appendToJQuery: '#container' asJQuery
469
+ ! !
470
+
471
+ HLManager class instanceVariableNames: 'current'!
472
+
473
+ !HLManager class methodsFor: 'accessing'!
474
+
475
+ current
476
+ ^ current ifNil: [ current := self basicNew initialize ]
477
+ ! !
478
+
479
+ !HLManager class methodsFor: 'initialization'!
480
+
481
+ initialize
482
+ self current appendToJQuery: 'body' asJQuery
483
+ ! !
484
+
485
+ !HLManager class methodsFor: 'instance creation'!
486
+
487
+ new
488
+ "Use current instead"
489
+
490
+ self shouldNotImplement
491
+ ! !
492
+
493
+ HLWidget subclass: #HLSUnit
494
+ instanceVariableNames: ''
495
+ package: 'Helios-Core'!
496
+
497
+ !HLSUnit class methodsFor: 'accessing'!
498
+
499
+ tabLabel
500
+ ^ 'SUnit'
501
+ !
502
+
503
+ tabPriority
504
+ ^ 1000
505
+ ! !
506
+
507
+ !HLSUnit class methodsFor: 'testing'!
508
+
509
+ canBeOpenAsTab
510
+ ^ true
511
+ ! !
512
+
513
+ HLWidget subclass: #HLTranscript
514
+ instanceVariableNames: ''
515
+ package: 'Helios-Core'!
516
+
517
+ !HLTranscript class methodsFor: 'accessing'!
518
+
519
+ tabLabel
520
+ ^ 'Transcript'
521
+ !
522
+
523
+ tabPriority
524
+ ^ 600
525
+ ! !
526
+
527
+ !HLTranscript class methodsFor: 'testing'!
528
+
529
+ canBeOpenAsTab
530
+ ^ true
531
+ ! !
532
+