Helios-Core.st 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707
  1. Smalltalk current createPackage: 'Helios-Core'!
  2. Object subclass: #HLModel
  3. instanceVariableNames: 'announcer environment'
  4. package: 'Helios-Core'!
  5. !HLModel commentStamp!
  6. I am the abstract superclass of all models of Helios.
  7. I am the "Model" part of the MVC pattern implementation in Helios.
  8. I provide access to an `Environment` object and both a local (model-specific) and global (system-specific) announcer.
  9. The `#withChangesDo:` method is handy for performing model changes ensuring that all widgets are aware of the change and can prevent it from happening.
  10. Modifications of the system should be done via commands (see `HLCommand` and subclasses).!
  11. !HLModel methodsFor: 'accessing'!
  12. announcer
  13. ^ announcer ifNil: [ announcer := Announcer new ]
  14. !
  15. environment
  16. ^ environment ifNil: [ self manager environment ]
  17. !
  18. environment: anEnvironment
  19. environment := anEnvironment
  20. !
  21. manager
  22. ^ HLManager current
  23. !
  24. systemAnnouncer
  25. ^ self environment systemAnnouncer
  26. ! !
  27. !HLModel methodsFor: 'error handling'!
  28. withChangesDo: aBlock
  29. [
  30. self announcer announce: (HLAboutToChange new
  31. actionBlock: aBlock).
  32. aBlock value.
  33. ]
  34. on: HLChangeForbidden
  35. do: [ :ex | ]
  36. ! !
  37. !HLModel methodsFor: 'testing'!
  38. isBrowserModel
  39. ^ false
  40. !
  41. isReferencesModel
  42. ^ false
  43. !
  44. isToolModel
  45. ^ false
  46. ! !
  47. HLModel subclass: #HLToolModel
  48. instanceVariableNames: 'selectedClass selectedPackage selectedProtocol selectedSelector'
  49. package: 'Helios-Core'!
  50. !HLToolModel commentStamp!
  51. I am a model specific to package and class manipulation. All browsers should either use me or a subclass as their model.
  52. I provide methods for package, class, protocol and method manipulation and access, forwarding to my environment.
  53. I also handle compilation of classes and methods as well as compilation and parsing errors.!
  54. !HLToolModel methodsFor: 'accessing'!
  55. allSelectors
  56. ^ self environment allSelectors
  57. !
  58. availableClassNames
  59. ^ self environment availableClassNames
  60. !
  61. availablePackageNames
  62. ^ self environment availablePackageNames
  63. !
  64. availablePackages
  65. ^ self environment availablePackageNames
  66. !
  67. availableProtocols
  68. ^ self environment availableProtocolsFor: self selectedClass
  69. !
  70. packages
  71. ^ self environment packages
  72. !
  73. selectedClass
  74. ^ selectedClass
  75. !
  76. selectedClass: aClass
  77. (self selectedClass = aClass and: [ aClass isNil ])
  78. ifTrue: [ ^ self ].
  79. self withChangesDo: [
  80. selectedClass = aClass ifTrue: [
  81. self selectedProtocol: nil ].
  82. aClass
  83. ifNil: [ selectedClass := nil ]
  84. ifNotNil: [
  85. self selectedPackage: aClass theNonMetaClass package.
  86. self showInstance
  87. ifTrue: [ selectedClass := aClass theNonMetaClass ]
  88. ifFalse: [ selectedClass := aClass theMetaClass ] ].
  89. self selectedProtocol: nil.
  90. self announcer announce: (HLClassSelected on: self selectedClass) ]
  91. !
  92. selectedMethod
  93. ^ self selectedClass ifNotNil: [
  94. self selectedClass methodDictionary
  95. at: selectedSelector
  96. ifAbsent: [ nil ] ]
  97. !
  98. selectedMethod: aCompiledMethod
  99. selectedSelector = aCompiledMethod ifTrue: [ ^ self ].
  100. self withChangesDo: [
  101. aCompiledMethod
  102. ifNil: [ selectedSelector := nil ]
  103. ifNotNil: [
  104. selectedClass := aCompiledMethod methodClass.
  105. selectedPackage := selectedClass theNonMetaClass package.
  106. selectedSelector := aCompiledMethod selector ].
  107. self announcer announce: (HLMethodSelected on: aCompiledMethod) ]
  108. !
  109. selectedPackage
  110. ^ selectedPackage
  111. !
  112. selectedPackage: aPackage
  113. selectedPackage = aPackage ifTrue: [ ^ self ].
  114. self withChangesDo: [
  115. selectedPackage := aPackage.
  116. self selectedClass: nil.
  117. self announcer announce: (HLPackageSelected on: aPackage) ]
  118. !
  119. selectedProtocol
  120. ^ selectedProtocol
  121. !
  122. selectedProtocol: aString
  123. selectedProtocol = aString ifTrue: [ ^ self ].
  124. self withChangesDo: [
  125. selectedProtocol := aString.
  126. self selectedMethod: nil.
  127. self announcer announce: (HLProtocolSelected on: aString) ]
  128. ! !
  129. !HLToolModel methodsFor: 'actions'!
  130. addInstVarNamed: aString
  131. self environment addInstVarNamed: aString to: self selectedClass.
  132. self announcer announce: (HLInstVarAdded new
  133. theClass: self selectedClass;
  134. variableName: aString;
  135. yourself)
  136. !
  137. save: aString
  138. self announcer announce: HLSourceCodeSaved new.
  139. (self shouldCompileClassDefinition: aString)
  140. ifTrue: [ self compileClassDefinition: aString ]
  141. ifFalse: [ self compileMethod: aString ]
  142. !
  143. saveSourceCode
  144. self announcer announce: HLSaveSourceCode new
  145. ! !
  146. !HLToolModel methodsFor: 'commands actions'!
  147. commitPackage
  148. "self
  149. withHelperLabelled: 'Committing package ', self selectedPackage name, '...'
  150. do: [ "self environment commitPackage: self selectedPackage" ]"
  151. !
  152. copyClassTo: aClassName
  153. self withChangesDo: [
  154. self environment
  155. copyClass: self selectedClass theNonMetaClass
  156. to: aClassName ]
  157. !
  158. moveClassToPackage: aPackageName
  159. self withChangesDo: [
  160. self environment
  161. moveClass: self selectedClass theNonMetaClass
  162. toPackage: aPackageName ]
  163. !
  164. moveMethodToClass: aClassName
  165. self withChangesDo: [
  166. self environment
  167. moveMethod: self selectedMethod
  168. toClass: aClassName ]
  169. !
  170. moveMethodToProtocol: aProtocol
  171. self withChangesDo: [
  172. self environment
  173. moveMethod: self selectedMethod
  174. toProtocol: aProtocol ]
  175. !
  176. openClassNamed: aString
  177. | class |
  178. self withChangesDo: [
  179. class := self environment classNamed: aString.
  180. self selectedPackage: class package.
  181. self selectedClass: class ]
  182. !
  183. removeClass
  184. self withChangesDo: [
  185. self manager
  186. confirm: 'Do you REALLY want to remove class ', self selectedClass name
  187. ifTrue: [ self environment removeClass: self selectedClass ] ]
  188. !
  189. removeMethod
  190. self withChangesDo: [
  191. self manager
  192. confirm: 'Do you REALLY want to remove method ', self selectedMethod methodClass name,' >> #', self selectedMethod selector
  193. ifTrue: [ self environment removeMethod: self selectedMethod ] ]
  194. !
  195. removeProtocol
  196. self withChangesDo: [
  197. self manager
  198. confirm: 'Do you REALLY want to remove protocol ', self selectedProtocol
  199. ifTrue: [ self environment
  200. removeProtocol: self selectedProtocol
  201. from: self selectedClass ] ]
  202. !
  203. renameClassTo: aClassName
  204. self withChangesDo: [
  205. self environment
  206. renameClass: self selectedClass theNonMetaClass
  207. to: aClassName ]
  208. !
  209. renameProtocolTo: aString
  210. self withChangesDo: [
  211. self environment
  212. renameProtocol: self selectedProtocol
  213. to: aString
  214. in: self selectedClass ]
  215. ! !
  216. !HLToolModel methodsFor: 'compiling'!
  217. compileClassComment: aString
  218. self environment
  219. compileClassComment: aString
  220. for: self selectedClass
  221. !
  222. compileClassDefinition: aString
  223. self environment compileClassDefinition: aString
  224. !
  225. compileMethod: aString
  226. | method |
  227. self withCompileErrorHandling: [
  228. method := self environment
  229. compileMethod: aString
  230. for: self selectedClass
  231. protocol: self compilationProtocol.
  232. self selectedMethod: method ]
  233. ! !
  234. !HLToolModel methodsFor: 'defaults'!
  235. allProtocol
  236. ^ '-- all --'
  237. !
  238. unclassifiedProtocol
  239. ^ 'as yet unclassified'
  240. ! !
  241. !HLToolModel methodsFor: 'error handling'!
  242. handleCompileError: anError
  243. self announcer announce: (HLCompileErrorRaised new
  244. error: anError;
  245. yourself)
  246. !
  247. handleParseError: anError
  248. | split line column messageToInsert |
  249. split := anError messageText tokenize: ' : '.
  250. messageToInsert := split second.
  251. "21 = 'Parse error on line ' size + 1"
  252. split := split first copyFrom: 21 to: split first size.
  253. split := split tokenize: ' column '.
  254. line := split first.
  255. column := split second.
  256. self announcer announce: (HLParseErrorRaised new
  257. line: line asNumber;
  258. column: column asNumber;
  259. message: messageToInsert;
  260. error: anError;
  261. yourself)
  262. !
  263. handleUnkownVariableError: anError
  264. self announcer announce: (HLUnknownVariableErrorRaised new
  265. error: anError;
  266. yourself)
  267. !
  268. withCompileErrorHandling: aBlock
  269. self environment
  270. evaluate: [
  271. self environment
  272. evaluate: [
  273. self environment
  274. evaluate: aBlock
  275. on: ParseError
  276. do: [:ex | self handleParseError: ex ] ]
  277. on: UnknownVariableError
  278. do: [ :ex | self handleUnkownVariableError: ex ] ]
  279. on: CompilerError
  280. do: [ :ex | self handleCompileError: ex ]
  281. ! !
  282. !HLToolModel methodsFor: 'private'!
  283. compilationProtocol
  284. | currentProtocol |
  285. currentProtocol := self selectedProtocol.
  286. currentProtocol ifNil: [ currentProtocol := self unclassifiedProtocol ].
  287. self selectedMethod ifNotNil: [ currentProtocol := self selectedMethod protocol ].
  288. ^ currentProtocol = self allProtocol
  289. ifTrue: [ self unclassifiedProtocol ]
  290. ifFalse: [ currentProtocol ]
  291. !
  292. withHelperLabelled: aString do: aBlock
  293. "TODO: doesn't belong here"
  294. '#helper' asJQuery remove.
  295. [ :html |
  296. html div
  297. id: 'helper';
  298. with: aString ] appendToJQuery: 'body' asJQuery.
  299. [
  300. aBlock value.
  301. '#helper' asJQuery remove
  302. ]
  303. valueWithTimeout: 10
  304. ! !
  305. !HLToolModel methodsFor: 'testing'!
  306. isToolModel
  307. ^ true
  308. !
  309. shouldCompileClassDefinition: aString
  310. ^ self selectedClass isNil or: [
  311. aString match: '^[A-Z]' ]
  312. ! !
  313. !HLToolModel class methodsFor: 'actions'!
  314. on: anEnvironment
  315. ^ self new
  316. environment: anEnvironment;
  317. yourself
  318. ! !
  319. ProgressHandler subclass: #HLProgressHandler
  320. instanceVariableNames: ''
  321. package: 'Helios-Core'!
  322. !HLProgressHandler commentStamp!
  323. I am a specific progress handler for Helios, displaying progresses in a modal window.!
  324. !HLProgressHandler methodsFor: 'progress handling'!
  325. do: aBlock on: aCollection displaying: aString
  326. HLProgressWidget default
  327. do: aBlock
  328. on: aCollection
  329. displaying: aString
  330. ! !
  331. Widget subclass: #HLTabWidget
  332. instanceVariableNames: 'widget label root'
  333. package: 'Helios-Core'!
  334. !HLTabWidget commentStamp!
  335. I am a widget specialized into building another widget as an Helios tab.
  336. I should not be used directly, `HLWidget class >> #openAsTab` should be used instead.
  337. ## Example
  338. HLWorkspace openAsTab!
  339. !HLTabWidget methodsFor: 'accessing'!
  340. activate
  341. self manager activate: self
  342. !
  343. add
  344. self manager addTab: self
  345. !
  346. cssClass
  347. ^ self widget tabClass
  348. !
  349. displayLabel
  350. ^ self label size > 20
  351. ifTrue: [ (self label first: 20), '...' ]
  352. ifFalse: [ self label ]
  353. !
  354. focus
  355. self widget canHaveFocus ifTrue: [
  356. self widget focus ]
  357. !
  358. label
  359. ^ label ifNil: [ '' ]
  360. !
  361. label: aString
  362. label := aString
  363. !
  364. manager
  365. ^ HLManager current
  366. !
  367. widget
  368. ^ widget
  369. !
  370. widget: aWidget
  371. widget := aWidget
  372. ! !
  373. !HLTabWidget methodsFor: 'actions'!
  374. hide
  375. root ifNotNil: [ root asJQuery css: 'visibility' put: 'hidden' ]
  376. !
  377. registerBindings
  378. self widget registerBindings
  379. !
  380. remove
  381. self widget unregister.
  382. root ifNotNil: [ root asJQuery remove ]
  383. !
  384. show
  385. root
  386. ifNil: [ self appendToJQuery: 'body' asJQuery ]
  387. ifNotNil: [ root asJQuery css: 'visibility' put: 'visible' ]
  388. ! !
  389. !HLTabWidget methodsFor: 'rendering'!
  390. renderOn: html
  391. root := html div
  392. class: 'tab';
  393. yourself.
  394. self renderTab
  395. !
  396. renderTab
  397. root contents: [ :html |
  398. html div
  399. class: 'amber_box';
  400. with: [ self widget renderOn: html ] ]
  401. ! !
  402. !HLTabWidget methodsFor: 'testing'!
  403. isActive
  404. ^ self manager activeTab = self
  405. ! !
  406. !HLTabWidget class methodsFor: 'instance creation'!
  407. on: aWidget labelled: aString
  408. ^ self new
  409. widget: aWidget;
  410. label: aString;
  411. yourself
  412. ! !
  413. Widget subclass: #HLWidget
  414. instanceVariableNames: 'wrapper'
  415. package: 'Helios-Core'!
  416. !HLWidget commentStamp!
  417. I am the abstract superclass of all Helios widgets.
  418. I provide common methods, additional behavior to widgets useful for Helios, like dialog creation, command execution and tab creation.
  419. ## API
  420. 1. Rendering
  421. Instead of overriding `#renderOn:` as with other Widget subclasses, my subclasses should override `#renderContentOn:`.
  422. 2. Refreshing
  423. To re-render a widget, use `#refresh`.
  424. 3. Key bindings registration and tabs
  425. When displayed as a tab, the widget has a chance to register keybindings with the `#registerBindingsOn:` hook method.
  426. 4. Unregistration
  427. When a widget has subscribed to announcements or other actions that need to be cleared when closing the tab, the hook method `#unregister` will be called by helios.
  428. 5. Tabs
  429. To enable a widget class to be open as a tab, override the class-side `#canBeOpenAsTab` method to answer `true`. `#tabClass` and `#tabPriority` can be overridden too to respectively change the css class of the tab and the order of tabs in the main menu.
  430. 6. Command execution
  431. An helios command (instance of `HLCommand` or one of its subclass) can be executed with `#execute:`.!
  432. !HLWidget methodsFor: 'accessing'!
  433. manager
  434. ^ HLManager current
  435. !
  436. tabClass
  437. ^ self class tabClass
  438. !
  439. wrapper
  440. ^ wrapper
  441. ! !
  442. !HLWidget methodsFor: 'actions'!
  443. alert: aString
  444. window alert: aString
  445. !
  446. confirm: aString ifTrue: aBlock
  447. self manager confirm: aString ifTrue: aBlock
  448. !
  449. execute: aCommand
  450. HLManager current keyBinder
  451. activate;
  452. applyBinding: aCommand asBinding
  453. !
  454. openAsTab
  455. HLManager current addTab: (HLTabWidget on: self labelled: self class tabLabel)
  456. !
  457. request: aString do: aBlock
  458. self manager request: aString do: aBlock
  459. !
  460. request: aString value: valueString do: aBlock
  461. self manager
  462. request: aString
  463. value: valueString
  464. do: aBlock
  465. !
  466. unregister
  467. "This method is called whenever the receiver is closed (as a tab).
  468. Widgets subscribing to announcements should unregister there"
  469. ! !
  470. !HLWidget methodsFor: 'keybindings'!
  471. bindKeyDown: keyDownBlock up: keyUpBlock
  472. self wrapper asJQuery
  473. keydown: keyDownBlock;
  474. keyup: keyUpBlock
  475. !
  476. registerBindings
  477. self registerBindingsOn: self manager keyBinder bindings
  478. !
  479. registerBindingsOn: aBindingGroup
  480. !
  481. unbindKeyDownUp
  482. self wrapper asJQuery
  483. unbind: 'keydown';
  484. unbind: 'keyup'
  485. ! !
  486. !HLWidget methodsFor: 'rendering'!
  487. renderContentOn: html
  488. !
  489. renderOn: html
  490. wrapper := html div.
  491. [ :renderer | self renderContentOn: renderer ] appendToJQuery: wrapper asJQuery
  492. ! !
  493. !HLWidget methodsFor: 'testing'!
  494. canHaveFocus
  495. ^ false
  496. ! !
  497. !HLWidget methodsFor: 'updating'!
  498. refresh
  499. self wrapper ifNil: [ ^ self ].
  500. self wrapper asJQuery empty.
  501. [ :html | self renderContentOn: html ] appendToJQuery: self wrapper asJQuery
  502. ! !
  503. !HLWidget class methodsFor: 'accessing'!
  504. openAsTab
  505. HLManager current addTab: (HLTabWidget on: self new labelled: self tabLabel)
  506. !
  507. tabClass
  508. ^ ''
  509. !
  510. tabLabel
  511. ^ 'Tab'
  512. !
  513. tabPriority
  514. ^ 500
  515. ! !
  516. !HLWidget class methodsFor: 'testing'!
  517. canBeOpenAsTab
  518. ^ false
  519. ! !
  520. HLWidget subclass: #HLFocusableWidget
  521. instanceVariableNames: ''
  522. package: 'Helios-Core'!
  523. !HLFocusableWidget commentStamp!
  524. I am a widget that can be focused.
  525. ## API
  526. Instead of overriding `#renderOn:` as with other `Widget` subclasses, my subclasses should override `#renderContentOn:`.
  527. To bring the focus to the widget, use the `#focus` method.!
  528. !HLFocusableWidget methodsFor: 'accessing'!
  529. focusClass
  530. ^ 'focused'
  531. ! !
  532. !HLFocusableWidget methodsFor: 'events'!
  533. blur
  534. self wrapper asJQuery blur
  535. !
  536. focus
  537. self wrapper asJQuery focus
  538. ! !
  539. !HLFocusableWidget methodsFor: 'rendering'!
  540. renderContentOn: html
  541. !
  542. renderOn: html
  543. wrapper := html div
  544. class: 'hl_widget';
  545. yourself.
  546. wrapper with: [ self renderContentOn: html ].
  547. wrapper
  548. at: 'tabindex' put: '0';
  549. onBlur: [ self wrapper asJQuery removeClass: self focusClass ];
  550. onFocus: [ self wrapper asJQuery addClass: self focusClass ]
  551. ! !
  552. !HLFocusableWidget methodsFor: 'testing'!
  553. canHaveFocus
  554. ^ true
  555. !
  556. hasFocus
  557. ^ self wrapper notNil and: [ self wrapper asJQuery hasClass: self focusClass ]
  558. ! !
  559. HLFocusableWidget subclass: #HLListWidget
  560. instanceVariableNames: 'items selectedItem mapping'
  561. package: 'Helios-Core'!
  562. !HLListWidget methodsFor: 'accessing'!
  563. cssClassForItem: anObject
  564. ^ ''
  565. !
  566. items
  567. ^ items ifNil: [ items := self defaultItems ]
  568. !
  569. items: aCollection
  570. items := aCollection
  571. !
  572. listCssClassForItem: anObject
  573. ^ self selectedItem = anObject
  574. ifTrue: [ 'active' ]
  575. ifFalse: [ 'inactive' ]
  576. !
  577. positionOf: aListItem
  578. <
  579. return aListItem.parent().children().get().indexOf(aListItem.get(0)) + 1
  580. >
  581. !
  582. selectedItem
  583. ^ selectedItem
  584. !
  585. selectedItem: anObject
  586. selectedItem := anObject
  587. ! !
  588. !HLListWidget methodsFor: 'actions'!
  589. activateFirstListItem
  590. self activateListItem: ((wrapper asJQuery find: 'li.inactive') eq: 0)
  591. !
  592. activateItem: anObject
  593. self activateListItem: (mapping
  594. at: anObject
  595. ifAbsent: [ ^ self ]) asJQuery
  596. !
  597. activateListItem: aListItem
  598. | item |
  599. (aListItem get: 0) ifNil: [ ^self ].
  600. aListItem parent children removeClass: 'active'.
  601. aListItem addClass: 'active'.
  602. self ensureVisible: aListItem.
  603. "Activate the corresponding item"
  604. item := (self items at: (aListItem attr: 'list-data') asNumber).
  605. self selectedItem == item ifFalse: [
  606. self selectItem: item ]
  607. !
  608. activateNextListItem
  609. self activateListItem: (self wrapper asJQuery find: 'li.active') next.
  610. "select the first item if none is selected"
  611. (self wrapper asJQuery find: ' .active') get ifEmpty: [
  612. self activateFirstListItem ]
  613. !
  614. activatePreviousListItem
  615. self activateListItem: (self wrapper asJQuery find: 'li.active') prev
  616. !
  617. ensureVisible: aListItem
  618. "Move the scrollbar to show the active element"
  619. | perent position |
  620. position := self positionOf: aListItem.
  621. parent := aListItem parent.
  622. aListItem position top < 0 ifTrue: [
  623. (parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem position top - 10) ].
  624. aListItem position top + aListItem height > parent height ifTrue: [
  625. (parent get: 0) scrollTop: ((parent get: 0) scrollTop + aListItem height - (parent height - aListItem position top)) +10 ]
  626. !
  627. focus
  628. super focus.
  629. self items isEmpty ifFalse: [
  630. self selectedItem ifNil: [ self activateFirstListItem ] ]
  631. !
  632. refresh
  633. super refresh.
  634. self ensureVisible: (mapping
  635. at: self selectedItem
  636. ifAbsent: [ ^ self ]) asJQuery
  637. !
  638. selectItem: anObject
  639. self selectedItem: anObject
  640. ! !
  641. !HLListWidget methodsFor: 'defaults'!
  642. defaultItems
  643. ^ #()
  644. ! !
  645. !HLListWidget methodsFor: 'events'!
  646. setupKeyBindings
  647. (HLRepeatingKeyBindingHandler forWidget: self)
  648. whileKeyPressed: 38 do: [ self activatePreviousListItem ];
  649. whileKeyPressed: 40 do: [ self activateNextListItem ];
  650. rebindKeys
  651. ! !
  652. !HLListWidget methodsFor: 'initialization'!
  653. initialize
  654. super initialize.
  655. mapping := Dictionary new.
  656. ! !
  657. !HLListWidget methodsFor: 'private'!
  658. registerMappingFrom: anObject to: aTag
  659. mapping at: anObject put: aTag
  660. ! !
  661. !HLListWidget methodsFor: 'rendering'!
  662. renderButtonsOn: html
  663. !
  664. renderContentOn: html
  665. html ul
  666. class: 'nav nav-pills nav-stacked';
  667. with: [ self renderListOn: html ].
  668. html div class: 'pane_actions form-actions'; with: [
  669. self renderButtonsOn: html ].
  670. self setupKeyBindings
  671. !
  672. renderItem: anObject on: html
  673. | li |
  674. li := html li.
  675. self registerMappingFrom: anObject to: li.
  676. li
  677. at: 'list-data' put: (self items indexOf: anObject) asString;
  678. class: (self listCssClassForItem: anObject);
  679. with: [
  680. html a
  681. with: [
  682. (html tag: 'i') class: (self cssClassForItem: anObject).
  683. self renderItemLabel: anObject on: html ];
  684. onClick: [
  685. self activateListItem: li asJQuery ] ]
  686. !
  687. renderItemLabel: anObject on: html
  688. html with: anObject asString
  689. !
  690. renderListOn: html
  691. mapping := Dictionary new.
  692. self items do: [ :each |
  693. self renderItem: each on: html ]
  694. ! !
  695. HLListWidget subclass: #HLNavigationListWidget
  696. instanceVariableNames: 'previous next'
  697. package: 'Helios-Core'!
  698. !HLNavigationListWidget methodsFor: 'accessing'!
  699. next
  700. ^ next
  701. !
  702. next: aWidget
  703. next := aWidget.
  704. aWidget previous = self ifFalse: [ aWidget previous: self ]
  705. !
  706. previous
  707. ^ previous
  708. !
  709. previous: aWidget
  710. previous := aWidget.
  711. aWidget next = self ifFalse: [ aWidget next: self ]
  712. ! !
  713. !HLNavigationListWidget methodsFor: 'actions'!
  714. nextFocus
  715. self next ifNotNil: [ self next focus ]
  716. !
  717. previousFocus
  718. self previous ifNotNil: [ self previous focus ]
  719. ! !
  720. !HLNavigationListWidget methodsFor: 'events'!
  721. setupKeyBindings
  722. super setupKeyBindings.
  723. self wrapper asJQuery keydown: [ :e |
  724. e which = 39 ifTrue: [
  725. self nextFocus ].
  726. e which = 37 ifTrue: [
  727. self previousFocus ] ]
  728. ! !
  729. HLNavigationListWidget subclass: #HLToolListWidget
  730. instanceVariableNames: 'model'
  731. package: 'Helios-Core'!
  732. !HLToolListWidget methodsFor: 'accessing'!
  733. commandCategory
  734. ^ self label
  735. !
  736. label
  737. ^ 'List'
  738. !
  739. menuCommands
  740. "Answer a collection of commands to be put in the cog menu"
  741. ^ ((HLToolCommand concreteClasses
  742. select: [ :each | each isValidFor: self model ])
  743. collect: [ :each | each for: self model ])
  744. select: [ :each |
  745. each category = self commandCategory and: [
  746. each isAction and: [ each isActive ] ] ]
  747. !
  748. model
  749. ^ model
  750. !
  751. model: aBrowserModel
  752. model := aBrowserModel.
  753. self
  754. observeSystem;
  755. observeModel
  756. !
  757. selectedItem: anItem
  758. "Selection changed, update the cog menu"
  759. super selectedItem: anItem.
  760. self updateMenu
  761. ! !
  762. !HLToolListWidget methodsFor: 'actions'!
  763. activateListItem: anItem
  764. self model withChangesDo: [ super activateListItem: anItem ]
  765. !
  766. activateNextListItem
  767. self model withChangesDo: [ super activateNextListItem ]
  768. !
  769. activatePreviousListItem
  770. self model withChangesDo: [ super activatePreviousListItem ]
  771. !
  772. observeModel
  773. !
  774. observeSystem
  775. !
  776. unregister
  777. super unregister.
  778. self model announcer unsubscribe: self.
  779. self model systemAnnouncer unsubscribe: self
  780. ! !
  781. !HLToolListWidget methodsFor: 'rendering'!
  782. renderContentOn: html
  783. self renderHeadOn: html.
  784. super renderContentOn: html
  785. !
  786. renderHeadOn: html
  787. html div
  788. class: 'list-label';
  789. with: [
  790. html with: self label.
  791. self renderMenuOn: html ]
  792. !
  793. renderMenuOn: html
  794. | commands |
  795. commands := self menuCommands.
  796. commands isEmpty ifTrue: [ ^ self ].
  797. html div
  798. class: 'btn-group cog';
  799. with: [
  800. html a
  801. class: 'btn dropdown-toggle';
  802. at: 'data-toggle' put: 'dropdown';
  803. with: [ (html tag: 'i') class: 'icon-cog' ].
  804. html ul
  805. class: 'dropdown-menu pull-right';
  806. with: [
  807. self menuCommands do: [ :each |
  808. html li with: [ html a
  809. with: each menuLabel;
  810. onClick: [ self execute: each ] ] ] ] ]
  811. ! !
  812. !HLToolListWidget methodsFor: 'updating'!
  813. updateMenu
  814. (self wrapper asJQuery find: '.cog') remove.
  815. [ :html | self renderMenuOn: html ]
  816. appendToJQuery: (self wrapper asJQuery find: '.list-label')
  817. ! !
  818. !HLToolListWidget class methodsFor: 'instance creation'!
  819. on: aModel
  820. ^ self new
  821. model: aModel;
  822. yourself
  823. ! !
  824. HLWidget subclass: #HLManager
  825. instanceVariableNames: 'tabs activeTab keyBinder environment history'
  826. package: 'Helios-Core'!
  827. !HLManager methodsFor: 'accessing'!
  828. activeTab
  829. ^ activeTab
  830. !
  831. environment
  832. "The default environment used by all Helios objects"
  833. ^ environment ifNil: [ environment := self defaultEnvironment ]
  834. !
  835. environment: anEnvironment
  836. environment := anEnvironment
  837. !
  838. history
  839. ^ history ifNil: [ history := OrderedCollection new ]
  840. !
  841. history: aCollection
  842. history := aCollection
  843. !
  844. keyBinder
  845. ^ keyBinder ifNil: [ keyBinder := HLKeyBinder new ]
  846. !
  847. tabs
  848. ^ tabs ifNil: [ tabs := OrderedCollection new ]
  849. ! !
  850. !HLManager methodsFor: 'actions'!
  851. activate: aTab
  852. self keyBinder flushBindings.
  853. aTab registerBindings.
  854. activeTab := aTab.
  855. self
  856. refresh;
  857. addToHistory: aTab;
  858. show: aTab
  859. !
  860. addTab: aTab
  861. self tabs add: aTab.
  862. self activate: aTab
  863. !
  864. addToHistory: aTab
  865. self removeFromHistory: aTab.
  866. self history add: aTab
  867. !
  868. confirm: aString ifFalse: aBlock
  869. (HLConfirmationWidget new
  870. confirmationString: aString;
  871. cancelBlock: aBlock;
  872. yourself)
  873. appendToJQuery: 'body' asJQuery
  874. !
  875. confirm: aString ifTrue: aBlock
  876. (HLConfirmationWidget new
  877. confirmationString: aString;
  878. actionBlock: aBlock;
  879. yourself)
  880. appendToJQuery: 'body' asJQuery
  881. !
  882. registerErrorHandler: anErrorHandler
  883. self environment registerErrorHandler: anErrorHandler
  884. !
  885. registerInspector: anInspector
  886. self environment registerInspector: anInspector
  887. !
  888. registerProgressHandler: aProgressHandler
  889. self environment registerProgressHandler: aProgressHandler
  890. !
  891. removeActiveTab
  892. self removeTab: self activeTab
  893. !
  894. removeFromHistory: aTab
  895. self history: (self history reject: [ :each | each == aTab ])
  896. !
  897. removeTab: aTab
  898. (self tabs includes: aTab) ifFalse: [ ^ self ].
  899. self removeFromHistory: aTab.
  900. self tabs remove: aTab.
  901. self keyBinder flushBindings.
  902. aTab remove.
  903. self refresh.
  904. self history ifNotEmpty: [
  905. self history last activate ]
  906. !
  907. request: aString do: aBlock
  908. self
  909. request: aString
  910. value: ''
  911. do: aBlock
  912. !
  913. request: aString value: valueString do: aBlock
  914. (HLRequestWidget new
  915. confirmationString: aString;
  916. actionBlock: aBlock;
  917. value: valueString;
  918. yourself)
  919. appendToJQuery: 'body' asJQuery
  920. ! !
  921. !HLManager methodsFor: 'defaults'!
  922. defaultEnvironment
  923. "If helios is loaded from within a frame, answer the parent window environment"
  924. | parent |
  925. parent := window opener ifNil: [ window parent ].
  926. parent ifNil: [ ^ Environment new ].
  927. ^ ((parent at: 'global_smalltalk')
  928. at: 'Environment') new
  929. ! !
  930. !HLManager methodsFor: 'initialization'!
  931. initialize
  932. super initialize.
  933. HLErrorHandler register.
  934. HLProgressHandler register.
  935. self registerInspector: HLInspector.
  936. self registerErrorHandler: ErrorHandler current.
  937. self registerProgressHandler: ProgressHandler current.
  938. self keyBinder setupEvents
  939. ! !
  940. !HLManager methodsFor: 'rendering'!
  941. refresh
  942. '.navbar' asJQuery remove.
  943. self appendToJQuery: 'body' asJQuery
  944. !
  945. renderAddOn: html
  946. html li
  947. class: 'dropdown';
  948. with: [
  949. html a
  950. class: 'dropdown-toggle';
  951. at: 'data-toggle' put: 'dropdown';
  952. with: [
  953. html with: 'Open...'.
  954. (html tag: 'b') class: 'caret' ].
  955. html ul
  956. class: 'dropdown-menu';
  957. with: [
  958. ((HLWidget withAllSubclasses
  959. select: [ :each | each canBeOpenAsTab ])
  960. sorted: [ :a :b | a tabPriority < b tabPriority ])
  961. do: [ :each |
  962. html li with: [
  963. html a
  964. with: each tabLabel;
  965. onClick: [ each openAsTab ] ] ] ] ]
  966. !
  967. renderContentOn: html
  968. html div
  969. class: 'navbar navbar-fixed-top';
  970. with: [ html div
  971. class: 'navbar-inner';
  972. with: [ self renderTabsOn: html ] ]
  973. !
  974. renderTabsOn: html
  975. html ul
  976. class: 'nav';
  977. with: [
  978. self tabs do: [ :each |
  979. html li
  980. class: (each isActive ifTrue: [ 'active' ] ifFalse: [ 'inactive' ]);
  981. with: [
  982. html a
  983. with: [
  984. ((html tag: 'i') class: 'close')
  985. onClick: [ self removeTab: each ].
  986. html span
  987. class: each cssClass;
  988. with: each displayLabel ];
  989. onClick: [ each activate ] ] ].
  990. self renderAddOn: html ]
  991. !
  992. show: aTab
  993. self tabs do: [ :each | each hide ].
  994. aTab show; focus
  995. ! !
  996. HLManager class instanceVariableNames: 'current'!
  997. !HLManager class methodsFor: 'accessing'!
  998. current
  999. ^ current ifNil: [ current := self basicNew initialize ]
  1000. ! !
  1001. !HLManager class methodsFor: 'initialization'!
  1002. initialize
  1003. self current appendToJQuery: 'body' asJQuery.
  1004. self clearKeydownEvent
  1005. ! !
  1006. !HLManager class methodsFor: 'instance creation'!
  1007. new
  1008. "Use current instead"
  1009. self shouldNotImplement
  1010. ! !
  1011. !HLManager class methodsFor: 'private'!
  1012. clearKeydownEvent
  1013. "Prevent default keydown event with arrow key from scrolling the parent page
  1014. when helios is run inside a frame."
  1015. 'body' asJQuery keydown: [ :e |
  1016. (e keyCode >= 37 and: [ e keyCode <= 40 ])
  1017. ifTrue: [ false ] ]
  1018. ! !
  1019. HLWidget subclass: #HLModalWidget
  1020. instanceVariableNames: ''
  1021. package: 'Helios-Core'!
  1022. !HLModalWidget commentStamp!
  1023. I implement an abstract modal widget.!
  1024. !HLModalWidget methodsFor: 'accessing'!
  1025. cssClass
  1026. ^ ''
  1027. ! !
  1028. !HLModalWidget methodsFor: 'actions'!
  1029. cancel
  1030. self remove
  1031. !
  1032. remove
  1033. '.dialog' asJQuery removeClass: 'active'.
  1034. [
  1035. '#overlay' asJQuery remove.
  1036. '.dialog' asJQuery remove
  1037. ] valueWithTimeout: 300
  1038. ! !
  1039. !HLModalWidget methodsFor: 'rendering'!
  1040. renderButtonsOn: html
  1041. !
  1042. renderContentOn: html
  1043. | confirmButton |
  1044. html div id: 'overlay'.
  1045. html div
  1046. class: 'dialog ', self cssClass;
  1047. with: [
  1048. self
  1049. renderMainOn: html;
  1050. renderButtonsOn: html ].
  1051. '.dialog' asJQuery addClass: 'active'.
  1052. self setupKeyBindings
  1053. !
  1054. renderMainOn: html
  1055. !
  1056. setupKeyBindings
  1057. '.dialog' asJQuery keyup: [ :e |
  1058. e keyCode = 27 ifTrue: [ self cancel ] ]
  1059. ! !
  1060. HLModalWidget subclass: #HLConfirmationWidget
  1061. instanceVariableNames: 'confirmationString actionBlock cancelBlock'
  1062. package: 'Helios-Core'!
  1063. !HLConfirmationWidget commentStamp!
  1064. I display confirmation messages.
  1065. Instead of creating an instance directly, use `HLWidget >> #confirm:ifTrue:`.!
  1066. !HLConfirmationWidget methodsFor: 'accessing'!
  1067. actionBlock
  1068. ^ actionBlock ifNil: [ [] ]
  1069. !
  1070. actionBlock: aBlock
  1071. actionBlock := aBlock
  1072. !
  1073. cancelBlock
  1074. ^ cancelBlock ifNil: [ [] ]
  1075. !
  1076. cancelBlock: aBlock
  1077. cancelBlock := aBlock
  1078. !
  1079. confirmationString
  1080. ^ confirmationString ifNil: [ 'Confirm' ]
  1081. !
  1082. confirmationString: aString
  1083. confirmationString := aString
  1084. ! !
  1085. !HLConfirmationWidget methodsFor: 'actions'!
  1086. cancel
  1087. self cancelBlock value.
  1088. self remove
  1089. !
  1090. confirm
  1091. self actionBlock value.
  1092. self remove
  1093. !
  1094. remove
  1095. '.dialog' asJQuery removeClass: 'active'.
  1096. [
  1097. '#overlay' asJQuery remove.
  1098. '.dialog' asJQuery remove
  1099. ] valueWithTimeout: 300
  1100. ! !
  1101. !HLConfirmationWidget methodsFor: 'rendering'!
  1102. renderButtonsOn: html
  1103. | confirmButton |
  1104. html div
  1105. class: 'buttons';
  1106. with: [
  1107. html button
  1108. class: 'button';
  1109. with: 'Cancel';
  1110. onClick: [ self cancel ].
  1111. confirmButton := html button
  1112. class: 'button default';
  1113. with: 'Confirm';
  1114. onClick: [ self confirm ] ].
  1115. confirmButton asJQuery focus
  1116. !
  1117. renderMainOn: html
  1118. html span with: self confirmationString
  1119. ! !
  1120. HLConfirmationWidget subclass: #HLRequestWidget
  1121. instanceVariableNames: 'input value'
  1122. package: 'Helios-Core'!
  1123. !HLRequestWidget commentStamp!
  1124. I display a modal window requesting user input.
  1125. Instead of creating instances manually, use `HLWidget >> #request:do:` and `#request:value:do:`.!
  1126. !HLRequestWidget methodsFor: 'accessing'!
  1127. cssClass
  1128. ^ 'large'
  1129. !
  1130. value
  1131. ^ value ifNil: [ '' ]
  1132. !
  1133. value: aString
  1134. value := aString
  1135. ! !
  1136. !HLRequestWidget methodsFor: 'actions'!
  1137. confirm
  1138. self actionBlock value: input asJQuery val.
  1139. self remove
  1140. ! !
  1141. !HLRequestWidget methodsFor: 'rendering'!
  1142. renderMainOn: html
  1143. super renderMainOn: html.
  1144. input := html textarea.
  1145. input asJQuery val: self value
  1146. ! !
  1147. HLModalWidget subclass: #HLProgressWidget
  1148. instanceVariableNames: 'progressBars visible'
  1149. package: 'Helios-Core'!
  1150. !HLProgressWidget commentStamp!
  1151. I am a widget used to display progress modal dialogs.
  1152. My default instance is accessed with `HLProgressWidget class >> #default`.
  1153. See `HLProgressHandler` for usage.!
  1154. !HLProgressWidget methodsFor: 'accessing'!
  1155. progressBars
  1156. ^ progressBars ifNil: [ progressBars := OrderedCollection new ]
  1157. ! !
  1158. !HLProgressWidget methodsFor: 'actions'!
  1159. addProgressBar: aProgressBar
  1160. self show.
  1161. self progressBars add: aProgressBar.
  1162. aProgressBar appendToJQuery: (self wrapper asJQuery find: '.dialog')
  1163. !
  1164. do: aBlock on: aCollection displaying: aString
  1165. | progressBar |
  1166. progressBar := HLProgressBarWidget new
  1167. parent: self;
  1168. label: aString;
  1169. workBlock: aBlock;
  1170. collection: aCollection;
  1171. yourself.
  1172. self addProgressBar: progressBar.
  1173. progressBar start
  1174. !
  1175. flush
  1176. self progressBars do: [ :each |
  1177. self removeProgressBar: each ]
  1178. !
  1179. remove
  1180. self isVisible ifTrue: [
  1181. visible := false.
  1182. super remove ]
  1183. !
  1184. removeProgressBar: aProgressBar
  1185. self progressBars remove: aProgressBar ifAbsent: [].
  1186. aProgressBar wrapper asJQuery remove.
  1187. self progressBars ifEmpty: [ self remove ]
  1188. !
  1189. show
  1190. self isVisible ifFalse: [
  1191. visible := true.
  1192. self appendToJQuery: 'body' asJQuery ]
  1193. ! !
  1194. !HLProgressWidget methodsFor: 'rendering'!
  1195. renderButtonsOn: html
  1196. !
  1197. renderMainOn: html
  1198. self progressBars do: [ :each |
  1199. html with: each ]
  1200. ! !
  1201. !HLProgressWidget methodsFor: 'testing'!
  1202. isVisible
  1203. ^ visible ifNil: [ false ]
  1204. ! !
  1205. HLProgressWidget class instanceVariableNames: 'default'!
  1206. !HLProgressWidget class methodsFor: 'accessing'!
  1207. default
  1208. ^ default ifNil: [ default := self new ]
  1209. ! !
  1210. HLWidget subclass: #HLProgressBarWidget
  1211. instanceVariableNames: 'label parent workBlock collection bar'
  1212. package: 'Helios-Core'!
  1213. !HLProgressBarWidget commentStamp!
  1214. I am a widget used to display a progress bar while iterating over a collection.!
  1215. !HLProgressBarWidget methodsFor: 'accessing'!
  1216. collection
  1217. ^ collection
  1218. !
  1219. collection: aCollection
  1220. collection := aCollection
  1221. !
  1222. label
  1223. ^ label
  1224. !
  1225. label: aString
  1226. label := aString
  1227. !
  1228. parent
  1229. ^ parent
  1230. !
  1231. parent: aProgress
  1232. parent := aProgress
  1233. !
  1234. workBlock
  1235. ^ workBlock
  1236. !
  1237. workBlock: aBlock
  1238. workBlock := aBlock
  1239. ! !
  1240. !HLProgressBarWidget methodsFor: 'actions'!
  1241. evaluateAt: anInteger
  1242. self updateProgress: (anInteger / self collection size) * 100.
  1243. anInteger <= self collection size
  1244. ifTrue: [
  1245. [
  1246. self workBlock value: (self collection at: anInteger).
  1247. self evaluateAt: anInteger + 1 ] valueWithTimeout: 10 ]
  1248. ifFalse: [ [ self remove ] valueWithTimeout: 500 ]
  1249. !
  1250. remove
  1251. self parent removeProgressBar: self
  1252. !
  1253. start
  1254. "Make sure the UI has some time to update itself between each iteration"
  1255. self evaluateAt: 1
  1256. !
  1257. updateProgress: anInteger
  1258. bar asJQuery css: 'width' put: anInteger asString, '%'
  1259. ! !
  1260. !HLProgressBarWidget methodsFor: 'rendering'!
  1261. renderContentOn: html
  1262. html span with: self label.
  1263. html div
  1264. class: 'progress';
  1265. with: [
  1266. bar := html div
  1267. class: 'bar';
  1268. style: 'width: 0%' ]
  1269. ! !
  1270. HLProgressBarWidget class instanceVariableNames: 'default'!
  1271. !HLProgressBarWidget class methodsFor: 'accessing'!
  1272. default
  1273. ^ default ifNil: [ default := self new ]
  1274. ! !
  1275. HLWidget subclass: #HLSUnit
  1276. instanceVariableNames: ''
  1277. package: 'Helios-Core'!
  1278. !HLSUnit class methodsFor: 'accessing'!
  1279. tabClass
  1280. ^ 'sunit'
  1281. !
  1282. tabLabel
  1283. ^ 'SUnit'
  1284. !
  1285. tabPriority
  1286. ^ 1000
  1287. ! !
  1288. !HLSUnit class methodsFor: 'testing'!
  1289. canBeOpenAsTab
  1290. ^ true
  1291. ! !