1
0

IDE.st 50 KB

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