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