1
0

IDE.st 50 KB

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