IDE.st 48 KB

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