1
0

IDE.st 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631
  1. Widget subclass: #TabManager
  2. instanceVariableNames: 'selectedTab tabs opened ul'
  3. category: 'IDE'!
  4. !TabManager methodsFor: 'accessing'!
  5. tabs
  6. ^tabs ifNil: [tabs := Array new]
  7. ! !
  8. !TabManager methodsFor: 'actions'!
  9. updateBodyMargin
  10. self setBodyMargin: '#jtalk' asJQuery height + 27
  11. !
  12. updatePosition
  13. <jQuery('#jtalk').css('top', '').css('bottom', '27px')>
  14. !
  15. removeBodyMargin
  16. self setBodyMargin: 0
  17. !
  18. setBodyMargin: anInteger
  19. '.jtalkBody' asJQuery cssAt: 'margin-bottom' put: anInteger asString, 'px'
  20. !
  21. onResize: aBlock
  22. <jQuery('#jtalk').resizable({
  23. handles: 'n',
  24. resize: aBlock,
  25. minHeight: 230
  26. })>
  27. !
  28. onWindowResize: aBlock
  29. <jQuery(window).resize(aBlock)>
  30. !
  31. open
  32. opened ifFalse: [
  33. 'body' asJQuery addClass: 'jtalkBody'.
  34. '#jtalk' asJQuery show.
  35. ul asJQuery show.
  36. self updateBodyMargin.
  37. selectedTab show.
  38. opened := true]
  39. !
  40. close
  41. opened ifTrue: [
  42. '#jtalk' asJQuery hide.
  43. ul asJQuery hide.
  44. selectedTab hide.
  45. self removeBodyMargin.
  46. 'body' asJQuery removeClass: 'jtalkBody'.
  47. opened := false]
  48. !
  49. newBrowserTab
  50. Browser open
  51. !
  52. selectTab: aWidget
  53. self open.
  54. selectedTab := aWidget.
  55. self tabs do: [:each |
  56. each hide].
  57. aWidget show.
  58. self update
  59. !
  60. closeTab: aWidget
  61. self removeTab: aWidget.
  62. self selectTab: self tabs last.
  63. aWidget remove.
  64. self update
  65. ! !
  66. !TabManager methodsFor: 'adding/Removing'!
  67. addTab: aWidget
  68. self tabs add: aWidget.
  69. '#jtalk' asJQuery append: aWidget.
  70. aWidget hide
  71. !
  72. removeTab: aWidget
  73. self tabs remove: aWidget.
  74. self update
  75. ! !
  76. !TabManager methodsFor: 'initialization'!
  77. initialize
  78. super initialize.
  79. opened := true.
  80. 'body' asJQuery
  81. append: self;
  82. append: [:html | html div id: 'jtalk'];
  83. addClass: 'jtalkBody'.
  84. self
  85. addTab: Transcript current;
  86. addTab: Workspace new.
  87. self selectTab: self tabs last.
  88. self
  89. onResize: [self updateBodyMargin; updatePosition];
  90. onWindowResize: [self updatePosition]
  91. ! !
  92. !TabManager methodsFor: 'rendering'!
  93. renderOn: html
  94. ul := html ul
  95. id: 'jtalkTabs';
  96. yourself.
  97. self renderTabs
  98. !
  99. renderTabFor: aWidget on: html
  100. | li |
  101. li := html li.
  102. selectedTab = aWidget ifTrue: [
  103. li class: 'selected'].
  104. li with: [
  105. html span
  106. with: aWidget label;
  107. onClick: [self selectTab: aWidget].
  108. aWidget canBeClosed ifTrue: [
  109. html span
  110. class: 'close';
  111. with: 'x';
  112. onClick: [self closeTab: aWidget]]]
  113. !
  114. renderTabs
  115. ul contents: [:html |
  116. html li
  117. class: 'closeAll';
  118. with: 'x';
  119. onClick: [self close].
  120. self tabs do: [:each |
  121. self renderTabFor: each on: html].
  122. html li
  123. class: 'newtab';
  124. with: ' + ';
  125. onClick: [self newBrowserTab]]
  126. ! !
  127. !TabManager methodsFor: 'updating'!
  128. update
  129. self renderTabs
  130. ! !
  131. TabManager class instanceVariableNames: 'current'!
  132. !TabManager class methodsFor: 'instance creation'!
  133. current
  134. ^current ifNil: [current := super new]
  135. !
  136. new
  137. self shouldNotImplement
  138. ! !
  139. Widget subclass: #TabWidget
  140. instanceVariableNames: 'div'
  141. category: 'IDE'!
  142. !TabWidget methodsFor: 'accessing'!
  143. label
  144. self subclassResponsibility
  145. ! !
  146. !TabWidget methodsFor: 'actions'!
  147. open
  148. TabManager current addTab: self.
  149. TabManager current selectTab: self
  150. !
  151. show
  152. div asJQuery show
  153. !
  154. hide
  155. div asJQuery hide
  156. !
  157. remove
  158. div asJQuery remove
  159. ! !
  160. !TabWidget methodsFor: 'rendering'!
  161. renderOn: html
  162. div := html div
  163. class: 'jtalkTool';
  164. yourself.
  165. self renderTab
  166. !
  167. renderBoxOn: html
  168. !
  169. renderButtonsOn: html
  170. !
  171. update
  172. self renderTab
  173. !
  174. renderTab
  175. div contents: [:html |
  176. html div
  177. class: 'jt_box';
  178. with: [self renderBoxOn: html].
  179. html div
  180. class: 'jt_buttons';
  181. with: [self renderButtonsOn: html]]
  182. ! !
  183. !TabWidget methodsFor: 'testing'!
  184. canBeClosed
  185. ^false
  186. ! !
  187. !TabWidget class methodsFor: 'instance creation'!
  188. open
  189. ^self new open
  190. ! !
  191. TabWidget subclass: #Workspace
  192. instanceVariableNames: 'sourceArea'
  193. category: 'IDE'!
  194. !Workspace methodsFor: 'accessing'!
  195. label
  196. ^'[Workspace]'
  197. ! !
  198. !Workspace methodsFor: 'actions'!
  199. clearWorkspace
  200. sourceArea clear
  201. !
  202. doIt
  203. sourceArea doIt
  204. !
  205. printIt
  206. sourceArea printIt
  207. !
  208. inspectIt
  209. sourceArea inspectIt
  210. ! !
  211. !Workspace methodsFor: 'rendering'!
  212. renderBoxOn: html
  213. sourceArea := SourceArea new.
  214. sourceArea renderOn: html
  215. !
  216. renderButtonsOn: html
  217. html button
  218. with: 'DoIt';
  219. title: 'ctrl+d';
  220. onClick: [self doIt].
  221. html button
  222. with: 'PrintIt';
  223. title: 'ctrl+p';
  224. onClick: [self printIt].
  225. html button
  226. with: 'InspectIt';
  227. title: 'ctrl+i';
  228. onClick: [self inspectIt].
  229. html button
  230. with: 'Clear workspace';
  231. onClick: [self clearWorkspace]
  232. ! !
  233. TabWidget subclass: #Transcript
  234. instanceVariableNames: 'textarea'
  235. category: 'IDE'!
  236. !Transcript methodsFor: 'accessing'!
  237. label
  238. ^'[Transcript]'
  239. ! !
  240. !Transcript methodsFor: 'actions'!
  241. show: anObject
  242. textarea asJQuery val: textarea asJQuery val, anObject asString.
  243. !
  244. cr
  245. textarea asJQuery val: textarea asJQuery val, String cr.
  246. !
  247. clear
  248. textarea asJQuery val: ''
  249. ! !
  250. !Transcript methodsFor: 'rendering'!
  251. renderBoxOn: html
  252. textarea := html textarea.
  253. textarea asJQuery call: 'tabby'.
  254. textarea
  255. class: 'jt_transcript';
  256. at: 'spellcheck' put: 'false'
  257. !
  258. renderButtonsOn: html
  259. html button
  260. with: 'Clear transcript';
  261. onClick: [self clear]
  262. ! !
  263. Transcript class instanceVariableNames: 'current'!
  264. !Transcript class methodsFor: 'instance creation'!
  265. open
  266. self current open
  267. !
  268. new
  269. self shouldNotImplement
  270. !
  271. current
  272. ^current ifNil: [current := super new]
  273. ! !
  274. !Transcript class methodsFor: 'printing'!
  275. show: anObject
  276. self current show: anObject
  277. !
  278. cr
  279. self current show: String cr
  280. !
  281. clear
  282. self current clear
  283. ! !
  284. TabWidget subclass: #Browser
  285. instanceVariableNames: 'selectedCategory selectedClass selectedProtocol selectedMethod commitButton categoriesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges input'
  286. category: 'IDE'!
  287. !Browser methodsFor: 'accessing'!
  288. label
  289. ^selectedClass
  290. ifNil: ['Browser (nil)']
  291. ifNotNil: [selectedClass name]
  292. !
  293. categories
  294. | categories |
  295. categories := Array new.
  296. Smalltalk current classes do: [:each |
  297. (categories includes: each category) ifFalse: [
  298. categories add: each category]].
  299. ^categories sort
  300. !
  301. classes
  302. ^(Smalltalk current classes
  303. select: [:each | each category = selectedCategory])
  304. sort: [:a :b | a name > b name]
  305. !
  306. protocols
  307. | klass |
  308. selectedClass ifNotNil: [
  309. selectedTab = #comment ifTrue: [^#()].
  310. klass := selectedTab = #instance
  311. ifTrue: [selectedClass]
  312. ifFalse: [selectedClass class].
  313. klass methodDictionary isEmpty ifTrue: [
  314. ^Array with: 'not yet classified'].
  315. ^klass protocols].
  316. ^Array new
  317. !
  318. methods
  319. | klass |
  320. selectedTab = #comment ifTrue: [^#()].
  321. selectedClass ifNotNil: [
  322. klass := selectedTab = #instance
  323. ifTrue: [selectedClass]
  324. ifFalse: [selectedClass class]].
  325. ^(selectedProtocol
  326. ifNil: [
  327. klass
  328. ifNil: [#()]
  329. ifNotNil: [klass methodDictionary values]]
  330. ifNotNil: [
  331. klass methodDictionary values select: [:each |
  332. each category = selectedProtocol]]) sort: [:a :b | a selector > b selector]
  333. !
  334. source
  335. selectedTab = #comment ifFalse: [
  336. ^(selectedProtocol notNil or: [selectedMethod notNil])
  337. ifFalse: [self declarationSource]
  338. ifTrue: [self methodSource]].
  339. ^selectedClass
  340. ifNil: ['']
  341. ifNotNil: [self classCommentSource]
  342. !
  343. methodSource
  344. ^selectedMethod
  345. ifNil: [self dummyMethodSource]
  346. ifNotNil: [selectedMethod source]
  347. !
  348. dummyMethodSource
  349. ^'messageSelectorAndArgumentNames
  350. "comment stating purpose of message"
  351. | temporary variable names |
  352. statements'
  353. !
  354. declarationSource
  355. ^selectedTab = #instance
  356. ifTrue: [self classDeclarationSource]
  357. ifFalse: [self metaclassDeclarationSource]
  358. !
  359. classDeclarationSource
  360. | stream |
  361. stream := '' writeStream.
  362. selectedClass ifNotNil: [
  363. stream
  364. nextPutAll: selectedClass superclass asString;
  365. nextPutAll: ' subclass: #';
  366. nextPutAll: selectedClass name;
  367. nextPutAll: String lf, String tab;
  368. nextPutAll: 'instanceVariableNames: '''.
  369. selectedClass instanceVariableNames
  370. do: [:each | stream nextPutAll: each]
  371. separatedBy: [stream nextPutAll: ' '].
  372. stream
  373. nextPutAll: '''', String lf, String tab;
  374. nextPutAll: 'category: ''';
  375. nextPutAll: selectedClass category;
  376. nextPutAll: ''''].
  377. ^stream contents
  378. !
  379. metaclassDeclarationSource
  380. | stream |
  381. stream := '' writeStream.
  382. selectedClass ifNotNil: [
  383. stream
  384. nextPutAll: selectedClass asString;
  385. nextPutAll: ' class ';
  386. nextPutAll: 'instanceVariableNames: '''.
  387. selectedClass class instanceVariableNames
  388. do: [:each | stream nextPutAll: each]
  389. separatedBy: [stream nextPutAll: ' '].
  390. stream nextPutAll: ''''].
  391. ^stream contents
  392. !
  393. classCommentSource
  394. ^selectedClass comment
  395. !
  396. selectedClass
  397. ^selectedClass
  398. ! !
  399. !Browser methodsFor: 'actions'!
  400. disableSaveButton
  401. saveButton ifNotNil: [
  402. saveButton at: 'disabled' put: true].
  403. unsavedChanges := false
  404. !
  405. hideClassButtons
  406. classButtons asJQuery hide
  407. !
  408. showClassButtons
  409. classButtons asJQuery show
  410. !
  411. hideMethodButtons
  412. methodButtons asJQuery hide
  413. !
  414. showMethodButtons
  415. methodButtons asJQuery show
  416. !
  417. compile
  418. self disableSaveButton.
  419. selectedTab = #comment ifTrue: [
  420. selectedClass ifNotNil: [
  421. self compileClassComment]].
  422. (selectedProtocol notNil or: [selectedMethod notNil])
  423. ifFalse: [self compileDefinition]
  424. ifTrue: [self compileMethodDefinition]
  425. !
  426. compileClassComment
  427. selectedClass comment: sourceArea val
  428. !
  429. compileMethodDefinition
  430. selectedTab = #instance
  431. ifTrue: [self compileMethodDefinitionFor: selectedClass]
  432. ifFalse: [self compileMethodDefinitionFor: selectedClass class]
  433. !
  434. compileMethodDefinitionFor: aClass
  435. | compiler method source node |
  436. source := sourceArea val.
  437. selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
  438. compiler := Compiler new.
  439. node := compiler parse: source.
  440. node isParseFailure ifTrue: [
  441. ^self alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
  442. compiler currentClass: aClass.
  443. method := compiler eval: (compiler compileNode: node).
  444. method category: selectedProtocol.
  445. compiler unknownVariables do: [:each |
  446. (self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  447. self addInstanceVariableNamed: each toClass: aClass.
  448. ^self compileMethodDefinitionFor: aClass]].
  449. aClass addCompiledMethod: method.
  450. compiler setupClass: aClass.
  451. self updateMethodsList.
  452. self selectMethod: method
  453. !
  454. compileDefinition
  455. | newClass |
  456. newClass := Compiler new loadExpression: sourceArea textarea asJQuery val.
  457. self
  458. resetClassesList;
  459. updateCategoriesList;
  460. updateClassesList
  461. !
  462. commitCategory
  463. selectedCategory ifNotNil: [
  464. (Ajax url: self class commitPathJs, '/', selectedCategory, '.js')
  465. at: 'type' put: 'PUT';
  466. at: 'data' put: (Exporter new exportCategory: selectedCategory);
  467. at: 'error' put: [self alert: 'Commit failed!!'];
  468. send.
  469. (Ajax url: self class commitPathSt, '/', selectedCategory, '.st')
  470. at: 'type' put: 'PUT';
  471. at: 'data' put: (ChunkExporter new exportCategory: selectedCategory);
  472. at: 'error' put: [self alert: 'Commit failed!!'];
  473. send]
  474. !
  475. cancelChanges
  476. ^unsavedChanges
  477. ifTrue: [self confirm: 'Cancel changes?']
  478. ifFalse: [true]
  479. !
  480. removeClass
  481. (self confirm: 'Do you really want to remove ', selectedClass name, '?')
  482. ifTrue: [
  483. Smalltalk current basicDelete: selectedClass name.
  484. self resetClassesList.
  485. self selectClass: nil]
  486. !
  487. removeMethod
  488. self cancelChanges ifTrue: [
  489. (self confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  490. ifTrue: [
  491. selectedTab = #instance
  492. ifTrue: [selectedClass removeCompiledMethod: selectedMethod]
  493. ifFalse: [selectedClass class removeCompiledMethod: selectedMethod].
  494. self selectMethod: nil]]
  495. !
  496. setMethodProtocol: aString
  497. self cancelChanges ifTrue: [
  498. (self protocols includes: aString)
  499. ifFalse: [self addNewProtocol]
  500. ifTrue: [
  501. selectedMethod category: aString.
  502. selectedProtocol := aString.
  503. selectedMethod := selectedMethod.
  504. self
  505. updateProtocolsList;
  506. updateMethodsList;
  507. updateSourceAndButtons]]
  508. !
  509. addNewProtocol
  510. | newProtocol |
  511. newProtocol := self prompt: 'New method protocol'.
  512. newProtocol notEmpty ifTrue: [
  513. selectedMethod category: newProtocol.
  514. self setMethodProtocol: newProtocol]
  515. !
  516. selectCategory: aCategory
  517. self cancelChanges ifTrue: [
  518. selectedCategory := aCategory.
  519. selectedClass := selectedProtocol := selectedMethod := nil.
  520. self resetClassesList.
  521. self
  522. updateCategoriesList;
  523. updateClassesList;
  524. updateProtocolsList;
  525. updateMethodsList;
  526. updateSourceAndButtons]
  527. !
  528. selectClass: aClass
  529. self cancelChanges ifTrue: [
  530. selectedClass := aClass.
  531. selectedProtocol := selectedMethod := nil.
  532. self
  533. updateClassesList;
  534. updateProtocolsList;
  535. updateMethodsList;
  536. updateSourceAndButtons]
  537. !
  538. selectProtocol: aString
  539. self cancelChanges ifTrue: [
  540. selectedProtocol := aString.
  541. selectedMethod := nil.
  542. self
  543. updateProtocolsList;
  544. updateMethodsList;
  545. updateSourceAndButtons]
  546. !
  547. selectMethod: aMethod
  548. self cancelChanges ifTrue: [
  549. selectedMethod := aMethod.
  550. self
  551. updateProtocolsList;
  552. updateMethodsList;
  553. updateSourceAndButtons]
  554. !
  555. selectTab: aString
  556. self cancelChanges ifTrue: [
  557. selectedTab := aString.
  558. self selectProtocol: nil.
  559. self updateTabsList]
  560. !
  561. renameClass
  562. | newName |
  563. newName := self prompt: 'Rename class ', selectedClass name.
  564. newName notEmpty ifTrue: [
  565. selectedClass rename: newName.
  566. self
  567. updateClassesList;
  568. updateSourceAndButtons]
  569. !
  570. addInstanceVariableNamed: aString toClass: aClass
  571. ClassBuilder new
  572. addSubclassOf: aClass superclass named: aClass name instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
  573. !
  574. searchReferencesOf: aString
  575. ReferencesBrowser search: aString
  576. !
  577. searchClassReferences
  578. ReferencesBrowser search: selectedClass name
  579. !
  580. search: aString
  581. self cancelChanges ifTrue: [| searchedClass |
  582. searchedClass := Smalltalk current at: aString.
  583. searchedClass isClass
  584. ifTrue: [self class openOn: searchedClass]
  585. ifFalse: [self searchReferencesOf: aString]]
  586. ! !
  587. !Browser methodsFor: 'initialization'!
  588. initialize
  589. super initialize.
  590. selectedTab := #instance.
  591. unsavedChanges := false
  592. ! !
  593. !Browser methodsFor: 'rendering'!
  594. renderBoxOn: html
  595. self
  596. renderTopPanelOn: html;
  597. renderTabsOn: html;
  598. renderBottomPanelOn: html
  599. !
  600. renderTopPanelOn: html
  601. html div
  602. class: 'top';
  603. with: [
  604. self renderInputOn: html.
  605. categoriesList := html ul class: 'jt_column browser categories'.
  606. commitButton := html button
  607. class: 'jt_commit';
  608. title: 'Commit classes in this category to disk';
  609. onClick: [self commitCategory];
  610. with: 'Commit category'.
  611. classesList := ClassesList on: self.
  612. classesList renderOn: html.
  613. protocolsList := html ul class: 'jt_column browser protocols'.
  614. methodsList := html ul class: 'jt_column browser methods'.
  615. self
  616. updateCategoriesList;
  617. updateClassesList;
  618. updateProtocolsList;
  619. updateMethodsList.
  620. html div class: 'jt_clear']
  621. !
  622. renderTabsOn: html
  623. tabsList := html ul class: 'jt_tabs'.
  624. self updateTabsList.
  625. !
  626. renderBottomPanelOn: html
  627. html div
  628. class: 'jt_sourceCode';
  629. with: [
  630. sourceArea := SourceArea new.
  631. sourceArea renderOn: html.
  632. sourceArea textarea
  633. onKeyUp: [self updateStatus]]
  634. !
  635. renderButtonsOn: html
  636. saveButton := html button.
  637. saveButton
  638. with: 'Save';
  639. onClick: [self compile].
  640. methodButtons := html span.
  641. classButtons := html span.
  642. html div
  643. class: 'right';
  644. with: [
  645. html button
  646. with: 'DoIt';
  647. onClick: [sourceArea doIt].
  648. html button
  649. with: 'PrintIt';
  650. onClick: [sourceArea printIt].
  651. html button with: 'InspectIt';
  652. onClick: [sourceArea inspectit]].
  653. self updateSourceAndButtons
  654. !
  655. renderInputOn: html
  656. input := html input
  657. class: 'implementors';
  658. yourself.
  659. input onKeyPress: [:event |
  660. event keyCode = 13 ifTrue: [
  661. self search: input asJQuery val]]
  662. ! !
  663. !Browser methodsFor: 'testing'!
  664. canBeClosed
  665. ^true
  666. ! !
  667. !Browser methodsFor: 'updating'!
  668. updateCategoriesList
  669. categoriesList contents: [:html |
  670. self categories do: [:each || li label |
  671. each isEmpty
  672. ifTrue: [label := 'Unclassified']
  673. ifFalse: [label := each].
  674. li := html li.
  675. selectedCategory = each ifTrue: [
  676. li class: 'selected'].
  677. li
  678. with: label;
  679. onClick: [self selectCategory: each]]]
  680. !
  681. updateClassesList
  682. TabManager current update.
  683. classesList updateNodes.
  684. "classesList contents: [:html |
  685. self classes do: [:each || li |
  686. li := html li.
  687. selectedClass = each ifTrue: [
  688. li class: 'selected'].
  689. li
  690. with: each name;
  691. onClick: [self selectClass: each]]]"
  692. !
  693. updateProtocolsList
  694. protocolsList contents: [:html |
  695. self protocols do: [:each || li |
  696. li := html li.
  697. selectedProtocol = each ifTrue: [
  698. li class: 'selected'].
  699. li
  700. with: each;
  701. onClick: [self selectProtocol: each]]]
  702. !
  703. updateMethodsList
  704. methodsList contents: [:html |
  705. self methods do: [:each || li |
  706. li := html li.
  707. selectedMethod = each ifTrue: [
  708. li class: 'selected'].
  709. li
  710. with: each selector;
  711. onClick: [self selectMethod: each]]]
  712. !
  713. updateTabsList
  714. tabsList contents: [:html || li |
  715. li := html li.
  716. selectedTab = #instance ifTrue: [li class: 'selected'].
  717. li
  718. with: 'Instance';
  719. onClick: [self selectTab: #instance].
  720. li := html li.
  721. selectedTab = #class ifTrue: [li class: 'selected'].
  722. li
  723. with: 'Class';
  724. onClick: [self selectTab: #class].
  725. li := html li.
  726. selectedTab = #comment ifTrue: [li class: 'selected'].
  727. li
  728. with: 'Comment';
  729. onClick: [self selectTab: #comment]]
  730. !
  731. updateSourceAndButtons
  732. self disableSaveButton.
  733. classButtons contents: [:html |
  734. html button
  735. with: 'Rename class';
  736. onClick: [self renameClass].
  737. html button
  738. with: 'Remove class';
  739. onClick: [self removeClass].
  740. html button
  741. with: 'References';
  742. onClick: [self searchClassReferences]].
  743. methodButtons contents: [:html |
  744. html button
  745. with: 'Remove method';
  746. onClick: [self removeMethod].
  747. html select
  748. onChange: [:e :select | self setMethodProtocol: select val];
  749. with: [
  750. html option
  751. with: 'Method protocol';
  752. at: 'disabled' put: 'disabled'.
  753. html option
  754. class: 'important';
  755. with: 'New...'.
  756. self protocols do: [:each |
  757. html option with: each]].
  758. selectedMethod isNil ifFalse: [
  759. html select
  760. onChange: [:e :select | self searchReferencesOf: select val];
  761. with: [
  762. html option
  763. with: 'References';
  764. at: 'disabled' put: 'disabled'.
  765. html option
  766. class: 'important';
  767. with: selectedMethod selector.
  768. selectedMethod messageSends sorted do: [:each |
  769. html option with: each]]]].
  770. selectedMethod isNil
  771. ifTrue: [
  772. self hideMethodButtons.
  773. (selectedClass isNil or: [selectedProtocol notNil])
  774. ifTrue: [self hideClassButtons]
  775. ifFalse: [self showClassButtons]]
  776. ifFalse: [
  777. self hideClassButtons.
  778. self showMethodButtons].
  779. sourceArea val: self source
  780. !
  781. updateStatus
  782. sourceArea textarea asJQuery val = self source
  783. ifTrue: [
  784. saveButton ifNotNil: [
  785. saveButton at: 'disabled' put: true].
  786. unsavedChanges := false]
  787. ifFalse: [
  788. saveButton ifNotNil: [
  789. saveButton removeAt: 'disabled'].
  790. unsavedChanges := true]
  791. !
  792. resetClassesList
  793. classesList resetNodes
  794. ! !
  795. !Browser class methodsFor: 'accessing'!
  796. commitPathJs
  797. ^'js'
  798. !
  799. commitPathSt
  800. ^'st'
  801. ! !
  802. !Browser class methodsFor: 'convenience'!
  803. openOn: aClass
  804. ^self new
  805. open;
  806. selectCategory: aClass category;
  807. selectClass: aClass
  808. !
  809. open
  810. self new open
  811. ! !
  812. TabWidget subclass: #Inspector
  813. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea workspaceTextarea diveButton'
  814. category: 'IDE'!
  815. !Inspector methodsFor: 'accessing'!
  816. label
  817. ^label ifNil: ['Inspector (nil)']
  818. !
  819. variables
  820. ^variables
  821. !
  822. setVariables: aCollection
  823. variables := aCollection
  824. !
  825. setLabel: aString
  826. label := aString
  827. !
  828. selectedVariable
  829. ^selectedVariable
  830. !
  831. selectedVariable: aString
  832. selectedVariable := aString
  833. ! !
  834. !Inspector methodsFor: 'actions'!
  835. inspect: anObject
  836. object := anObject.
  837. variables := #().
  838. object inspectOn: self
  839. !
  840. dive
  841. (self variables at: self selectedVariable) inspect
  842. !
  843. refresh
  844. self
  845. inspect: object;
  846. updateVariablesList;
  847. updateValueTextarea
  848. ! !
  849. !Inspector methodsFor: 'rendering'!
  850. renderBoxOn: html
  851. self
  852. renderTopPanelOn: html;
  853. renderBottomPanelOn: html
  854. !
  855. renderTopPanelOn: html
  856. html div
  857. class: 'top';
  858. with: [
  859. variablesList := html ul class: 'jt_column variables'.
  860. valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
  861. self
  862. updateVariablesList;
  863. updateValueTextarea.
  864. html div class: 'jt_clear']
  865. !
  866. renderBottomPanelOn: html
  867. html div
  868. class: 'jt_sourceCode';
  869. with: [
  870. workspaceTextarea := html textarea
  871. class: 'source';
  872. at: 'spellcheck' put: 'false'.
  873. workspaceTextarea asJQuery call: 'tabby']
  874. !
  875. renderButtonsOn: html
  876. html button
  877. with: 'Refresh';
  878. onClick: [self refresh].
  879. diveButton := html button
  880. with: 'Dive';
  881. onClick: [self dive].
  882. self updateButtons
  883. ! !
  884. !Inspector methodsFor: 'testing'!
  885. canBeClosed
  886. ^true
  887. ! !
  888. !Inspector methodsFor: 'updating'!
  889. updateVariablesList
  890. variablesList contents: [:html |
  891. self variables keys do: [:each || li |
  892. li := html li.
  893. li
  894. with: each;
  895. onClick: [self selectVariable: each].
  896. self selectedVariable = each ifTrue: [
  897. li class: 'selected']]]
  898. !
  899. selectVariable: aString
  900. self selectedVariable: aString.
  901. self
  902. updateVariablesList;
  903. updateValueTextarea;
  904. updateButtons
  905. !
  906. updateValueTextarea
  907. valueTextarea asJQuery val: (self selectedVariable isNil
  908. ifTrue: ['']
  909. ifFalse: [(self variables at: self selectedVariable) printString])
  910. !
  911. updateButtons
  912. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  913. ifFalse: [diveButton at: 'disabled' put: true]
  914. ifTrue: [diveButton removeAt: 'disabled']
  915. ! !
  916. !Inspector class methodsFor: 'instance creation'!
  917. on: anObject
  918. ^self new
  919. inspect: anObject;
  920. yourself
  921. ! !
  922. TabWidget subclass: #ReferencesBrowser
  923. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
  924. category: 'IDE'!
  925. !ReferencesBrowser methodsFor: 'accessing'!
  926. implementors
  927. ^implementors ifNil: [implementors := Array new]
  928. !
  929. label
  930. ^'[ReferencesBrowser]'
  931. !
  932. selector
  933. ^selector
  934. !
  935. senders
  936. ^senders ifNil: [senders := Array new]
  937. !
  938. classesAndMetaclasses
  939. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  940. !
  941. referencedClasses
  942. ^referencedClasses ifNil: [referencedClasses := Array new]
  943. ! !
  944. !ReferencesBrowser methodsFor: 'actions'!
  945. openBrowserOn: aMethod
  946. | browser |
  947. browser := Browser openOn: (aMethod class isMetaclass
  948. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  949. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  950. browser
  951. selectProtocol: aMethod category;
  952. selectMethod: aMethod
  953. !
  954. searchReferencesFor: aString
  955. selector := aString.
  956. implementors := Array new.
  957. senders := Array new.
  958. referencedClasses := Array new.
  959. (selector match: '^[A-Z]')
  960. ifFalse: [self searchSelectorReferencesFor: selector]
  961. ifTrue: [self searchReferencedClassesFor: selector]
  962. !
  963. search: aString
  964. self
  965. searchReferencesFor: aString;
  966. updateImplementorsList;
  967. updateSendersList;
  968. updateReferencedClassesList
  969. !
  970. searchReferencedClassesFor: aString
  971. self classesAndMetaclasses do: [:each |
  972. each methodDictionary values do: [:value |
  973. (((value referencedClasses select: [:each | each notNil])collect: [:each | each name]) includes: selector) ifTrue: [
  974. self referencedClasses add: value]]]
  975. !
  976. searchSelectorReferencesFor: aString
  977. self classesAndMetaclasses do: [:each |
  978. each methodDictionary keysAndValuesDo: [:key :value |
  979. key = selector ifTrue: [self implementors add: value]].
  980. each methodDictionary keysAndValuesDo: [:key :value |
  981. (value messageSends includes: selector) ifTrue: [
  982. self senders add: value]]]
  983. ! !
  984. !ReferencesBrowser methodsFor: 'initialization'!
  985. initialize
  986. super initialize.
  987. selector := ''
  988. ! !
  989. !ReferencesBrowser methodsFor: 'private'!
  990. setInputEvents
  991. input
  992. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  993. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  994. ! !
  995. !ReferencesBrowser methodsFor: 'rendering'!
  996. renderBoxOn: html
  997. self
  998. renderInputOn: html;
  999. renderImplementorsOn: html;
  1000. renderSendersOn: html;
  1001. renderReferencedClassesOn: html
  1002. !
  1003. renderInputOn: html
  1004. input := html input
  1005. class: 'implementors';
  1006. yourself.
  1007. input asJQuery val: selector.
  1008. self setInputEvents
  1009. !
  1010. renderImplementorsOn: html
  1011. implementorsList := html ul class: 'jt_column implementors'.
  1012. self updateImplementorsList
  1013. !
  1014. renderSendersOn: html
  1015. sendersList := html ul class: 'jt_column senders'.
  1016. self updateSendersList
  1017. !
  1018. renderReferencedClassesOn: html
  1019. referencedClassesList := html ul class: 'jt_column referenced_classes'.
  1020. self updateReferencedClassesList
  1021. ! !
  1022. !ReferencesBrowser methodsFor: 'testing'!
  1023. canBeClosed
  1024. ^true
  1025. ! !
  1026. !ReferencesBrowser methodsFor: 'updating'!
  1027. updateImplementorsList
  1028. implementorsList contents: [:html |
  1029. html li
  1030. class: 'column_label';
  1031. with: 'Implementors (', self implementors size asString, ')';
  1032. style: 'font-weight: bold'.
  1033. self implementors do: [:each || li |
  1034. li := html li.
  1035. li
  1036. with: (each methodClass asString, ' >> ', self selector);
  1037. onClick: [self openBrowserOn: each]]]
  1038. !
  1039. updateSendersList
  1040. sendersList contents: [:html |
  1041. html li
  1042. class: 'column_label';
  1043. with: 'Senders (', self senders size asString, ')';
  1044. style: 'font-weight: bold'.
  1045. self senders do: [:each |
  1046. html li
  1047. with: (each methodClass asString, ' >> ', each selector);
  1048. onClick: [self openBrowserOn: each]]]
  1049. !
  1050. updateReferencedClassesList
  1051. referencedClassesList contents: [:html |
  1052. html li
  1053. class: 'column_label';
  1054. with: 'Class references (', self referencedClasses size asString, ')';
  1055. style: 'font-weight: bold'.
  1056. self referencedClasses do: [:each |
  1057. html li
  1058. with: (each methodClass asString, ' >> ', each selector);
  1059. onClick: [self openBrowserOn: each]]]
  1060. ! !
  1061. !ReferencesBrowser class methodsFor: 'instance creation'!
  1062. search: aString
  1063. ^self new
  1064. searchReferencesFor: aString;
  1065. open
  1066. ! !
  1067. Widget subclass: #SourceArea
  1068. instanceVariableNames: 'textarea'
  1069. category: 'IDE'!
  1070. !SourceArea methodsFor: 'accessing'!
  1071. val
  1072. ^textarea asJQuery val
  1073. !
  1074. val: aString
  1075. textarea asJQuery val: aString
  1076. !
  1077. currentLine
  1078. | lines startLine endLine|
  1079. lines := textarea asJQuery val tokenize: String lf.
  1080. startLine := endLine := 0.
  1081. lines do: [:each |
  1082. endLine := startLine + each size.
  1083. startLine := endLine + 1.
  1084. endLine >= self selectionStart ifTrue: [
  1085. self selectionEnd: endLine.
  1086. ^each]]
  1087. !
  1088. selection
  1089. <return document.selection>
  1090. !
  1091. selectionEnd
  1092. ^textarea element selectionEnd
  1093. !
  1094. selectionStart
  1095. ^textarea element selectionStart
  1096. !
  1097. selectionStart: anInteger
  1098. textarea element selectionStart: anInteger
  1099. !
  1100. selectionEnd: anInteger
  1101. textarea element selectionEnd: anInteger
  1102. !
  1103. textarea
  1104. ^textarea
  1105. ! !
  1106. !SourceArea methodsFor: 'actions'!
  1107. clear
  1108. textarea asJQuery val: ''
  1109. !
  1110. doIt
  1111. | selection |
  1112. textarea asJQuery focus.
  1113. self selectionStart = self selectionEnd
  1114. ifTrue: [selection := self currentLine]
  1115. ifFalse: [
  1116. selection := textarea asJQuery val copyFrom: self selectionStart + 1 to: self selectionEnd + 1].
  1117. ^self eval: selection
  1118. !
  1119. eval: aString
  1120. | compiler node |
  1121. compiler := Compiler new.
  1122. node := compiler parseExpression: aString.
  1123. node isParseFailure ifTrue: [
  1124. ^self alert: node reason, ', position: ', node position].
  1125. ^compiler loadExpression: aString
  1126. !
  1127. handleKeyDown: anEvent
  1128. <if(anEvent.ctrlKey) {
  1129. if(anEvent.keyCode === 80) { //ctrl+p
  1130. self._printIt();
  1131. anEvent.preventDefault();
  1132. return false;
  1133. }
  1134. if(anEvent.keyCode === 68) { //ctrl+d
  1135. self._doIt();
  1136. anEvent.preventDefault();
  1137. return false;
  1138. }
  1139. if(anEvent.keyCode === 73) { //ctrl+i
  1140. self._inspectIt();
  1141. anEvent.preventDefault();
  1142. return false;
  1143. }
  1144. }>
  1145. !
  1146. inspectIt
  1147. self doIt inspect
  1148. !
  1149. print: aString
  1150. | start |
  1151. start := self selectionEnd.
  1152. textarea asJQuery val: (
  1153. (textarea asJQuery val copyFrom: 1 to: start),
  1154. ' ', aString, ' ',
  1155. (textarea asJQuery val copyFrom: start + 1 to: textarea asJQuery val size)).
  1156. self selectionStart: start.
  1157. self selectionEnd: start + aString size + 2
  1158. !
  1159. printIt
  1160. self print: self doIt printString
  1161. ! !
  1162. !SourceArea methodsFor: 'rendering'!
  1163. renderOn: html
  1164. textarea := html textarea.
  1165. textarea asJQuery call: 'tabby'.
  1166. textarea onKeyDown: [:e | self handleKeyDown: e].
  1167. textarea
  1168. class: 'jt_workspace';
  1169. at: 'spellcheck' put: 'false'
  1170. ! !
  1171. Widget subclass: #ClassesList
  1172. instanceVariableNames: 'browser ul nodes'
  1173. category: 'IDE'!
  1174. !ClassesList methodsFor: 'accessing'!
  1175. category
  1176. ^self browser selectedCategory
  1177. !
  1178. nodes
  1179. nodes ifNil: [nodes := self getNodes].
  1180. ^nodes
  1181. !
  1182. browser
  1183. ^browser
  1184. !
  1185. browser: aBrowser
  1186. browser := aBrowser
  1187. !
  1188. getNodes
  1189. | classes children others |
  1190. classes := self browser classes.
  1191. children := #().
  1192. others := #().
  1193. classes do: [:each |
  1194. (classes includes: each superclass)
  1195. ifFalse: [children add: each]
  1196. ifTrue: [others add: each]].
  1197. ^children collect: [:each |
  1198. ClassesListNode on: each browser: self browser classes: others level: 0]
  1199. !
  1200. resetNodes
  1201. nodes := nil
  1202. ! !
  1203. !ClassesList methodsFor: 'rendering'!
  1204. renderOn: html
  1205. ul := html ul
  1206. class: 'jt_column browser classes';
  1207. yourself.
  1208. self updateNodes
  1209. !
  1210. updateNodes
  1211. ul contents: [:html |
  1212. self nodes do: [:each |
  1213. each renderOn: html]]
  1214. ! !
  1215. !ClassesList class methodsFor: 'instance creation'!
  1216. on: aBrowser
  1217. ^self new
  1218. browser: aBrowser;
  1219. yourself
  1220. ! !
  1221. Widget subclass: #ClassesListNode
  1222. instanceVariableNames: 'browser theClass level nodes'
  1223. category: 'IDE'!
  1224. !ClassesListNode methodsFor: 'accessing'!
  1225. nodes
  1226. ^nodes
  1227. !
  1228. theClass
  1229. ^theClass
  1230. !
  1231. theClass: aClass
  1232. theClass := aClass
  1233. !
  1234. browser
  1235. ^browser
  1236. !
  1237. browser: aBrowser
  1238. browser := aBrowser
  1239. !
  1240. level
  1241. ^level
  1242. !
  1243. level: anInteger
  1244. level := anInteger
  1245. !
  1246. label
  1247. | str |
  1248. str := String new writeStream.
  1249. self level timesRepeat: [
  1250. str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
  1251. str nextPutAll: self theClass name.
  1252. ^str contents
  1253. !
  1254. getNodesFrom: aCollection
  1255. | classes children others |
  1256. classes := aCollection.
  1257. children := #().
  1258. others := #().
  1259. classes do: [:each |
  1260. (each superclass = self theClass)
  1261. ifTrue: [children add: each]
  1262. ifFalse: [others add: each]].
  1263. nodes:= children collect: [:each |
  1264. ClassesListNode on: each browser: self browser classes: others level: self level + 1]
  1265. ! !
  1266. !ClassesListNode methodsFor: 'rendering'!
  1267. renderOn: html
  1268. | li |
  1269. li := html li
  1270. onClick: [self browser selectClass: self theClass].
  1271. li asJQuery contents: self label.
  1272. self browser selectedClass = self theClass ifTrue: [
  1273. li class: 'selected'].
  1274. self nodes do: [:each |
  1275. each renderOn: html]
  1276. ! !
  1277. !ClassesListNode class methodsFor: 'instance creation'!
  1278. on: aClass browser: aBrowser classes: aCollection level: anInteger
  1279. ^self new
  1280. theClass: aClass;
  1281. browser: aBrowser;
  1282. level: anInteger;
  1283. getNodesFrom: aCollection;
  1284. yourself
  1285. ! !
  1286. !Object methodsFor: '*IDE'!
  1287. inspect
  1288. Inspector new
  1289. inspect: self;
  1290. open
  1291. !
  1292. inspectOn: anInspector
  1293. | variables |
  1294. variables := Dictionary new.
  1295. variables at: '#self' put: self.
  1296. self class allInstanceVariableNames do: [:each |
  1297. variables at: each put: (self instVarAt: each)].
  1298. anInspector
  1299. setLabel: self printString;
  1300. setVariables: variables
  1301. ! !
  1302. !Date methodsFor: '*IDE'!
  1303. inspectOn: anInspector
  1304. | variables |
  1305. variables := Dictionary new.
  1306. variables at: '#self' put: self.
  1307. variables at: '#year' put: self year.
  1308. variables at: '#month' put: self month.
  1309. variables at: '#day' put: self day.
  1310. variables at: '#hours' put: self hours.
  1311. variables at: '#minutes' put: self minutes.
  1312. variables at: '#seconds' put: self seconds.
  1313. variables at: '#milliseconds' put: self milliseconds.
  1314. anInspector
  1315. setLabel: self printString;
  1316. setVariables: variables
  1317. ! !
  1318. !Collection methodsFor: '*IDE'!
  1319. inspectOn: anInspector
  1320. | variables |
  1321. variables := Dictionary new.
  1322. variables at: '#self' put: self.
  1323. self withIndexDo: [:each :i |
  1324. variables at: i put: each].
  1325. anInspector
  1326. setLabel: self printString;
  1327. setVariables: variables
  1328. ! !
  1329. !String methodsFor: '*IDE'!
  1330. inspectOn: anInspector
  1331. | label |
  1332. super inspectOn: anInspector.
  1333. self printString size > 30
  1334. ifTrue: [label := (self printString copyFrom: 1 to: 30), '...''']
  1335. ifFalse: [label := self printString].
  1336. anInspector setLabel: label
  1337. ! !
  1338. !MethodContext methodsFor: '*IDE'!
  1339. inspectOn: anInspector
  1340. | variables |
  1341. variables := Dictionary new.
  1342. variables at: '#self' put: self.
  1343. variables at: '#home' put: self home.
  1344. variables at: '#receiver' put: self receiver.
  1345. variables at: '#selector' put: self selector.
  1346. self class instanceVariableNames do: [:each |
  1347. variables at: each put: (self instVarAt: each)].
  1348. anInspector
  1349. setLabel: self printString;
  1350. setVariables: variables
  1351. ! !
  1352. !Dictionary methodsFor: '*IDE'!
  1353. inspectOn: anInspector
  1354. | variables |
  1355. variables := Dictionary new.
  1356. variables at: '#self' put: self.
  1357. variables at: '#keys' put: self keys.
  1358. self keysAndValuesDo: [:key :value |
  1359. variables at: key put: value].
  1360. anInspector
  1361. setLabel: self printString;
  1362. setVariables: variables
  1363. ! !