IDE.st 50 KB

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