2
0

IDE.st 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751
  1. Widget subclass: #TabManager
  2. instanceVariableNames: 'selectedTab tabs opened ul'
  3. category: 'IDE'!
  4. !TabManager methodsFor: 'accessing'!
  5. tabs
  6. ^tabs ifNil: [tabs := Array new]
  7. ! !
  8. !TabManager methodsFor: 'actions'!
  9. updateBodyMargin
  10. self setBodyMargin: '#jtalk' asJQuery height + 27
  11. !
  12. updatePosition
  13. <jQuery('#jtalk').css('top', '').css('bottom', '27px')>
  14. !
  15. removeBodyMargin
  16. self setBodyMargin: 0
  17. !
  18. setBodyMargin: anInteger
  19. '.jtalkBody' asJQuery cssAt: 'margin-bottom' put: anInteger asString, 'px'
  20. !
  21. onResize: aBlock
  22. <jQuery('#jtalk').resizable({
  23. handles: 'n',
  24. resize: aBlock,
  25. minHeight: 230
  26. })>
  27. !
  28. onWindowResize: aBlock
  29. <jQuery(window).resize(aBlock)>
  30. !
  31. open
  32. opened ifFalse: [
  33. 'body' asJQuery addClass: 'jtalkBody'.
  34. '#jtalk' asJQuery show.
  35. ul asJQuery show.
  36. self updateBodyMargin.
  37. selectedTab show.
  38. opened := true]
  39. !
  40. close
  41. opened ifTrue: [
  42. '#jtalk' asJQuery hide.
  43. ul asJQuery hide.
  44. selectedTab hide.
  45. self removeBodyMargin.
  46. 'body' asJQuery removeClass: 'jtalkBody'.
  47. opened := false]
  48. !
  49. newBrowserTab
  50. Browser open
  51. !
  52. selectTab: aWidget
  53. self open.
  54. selectedTab := aWidget.
  55. self tabs do: [:each |
  56. each hide].
  57. aWidget show.
  58. self update
  59. !
  60. closeTab: aWidget
  61. self removeTab: aWidget.
  62. self selectTab: self tabs last.
  63. aWidget remove.
  64. self update
  65. ! !
  66. !TabManager methodsFor: 'adding/Removing'!
  67. addTab: aWidget
  68. self tabs add: aWidget.
  69. '#jtalk' asJQuery append: aWidget.
  70. aWidget hide
  71. !
  72. removeTab: aWidget
  73. self tabs remove: aWidget.
  74. self update
  75. ! !
  76. !TabManager methodsFor: 'initialization'!
  77. initialize
  78. super initialize.
  79. opened := true.
  80. 'body' asJQuery
  81. append: self;
  82. append: [:html | html div id: 'jtalk'];
  83. addClass: 'jtalkBody'.
  84. self
  85. addTab: Transcript current;
  86. addTab: Workspace new.
  87. self selectTab: self tabs last.
  88. self
  89. onResize: [self updateBodyMargin; updatePosition];
  90. onWindowResize: [self updatePosition]
  91. ! !
  92. !TabManager methodsFor: 'rendering'!
  93. renderOn: html
  94. ul := html ul
  95. id: 'jtalkTabs';
  96. yourself.
  97. self renderTabs
  98. !
  99. renderTabFor: aWidget on: html
  100. | li |
  101. li := html li.
  102. selectedTab = aWidget ifTrue: [
  103. li class: 'selected'].
  104. li with: [
  105. aWidget canBeClosed ifTrue: [
  106. html span
  107. class: 'close';
  108. with: 'x';
  109. onClick: [self closeTab: aWidget]].
  110. html span
  111. with: aWidget label;
  112. onClick: [self selectTab: aWidget]]
  113. !
  114. renderTabs
  115. ul contents: [:html |
  116. html li
  117. class: 'closeAll';
  118. with: 'x';
  119. onClick: [self close].
  120. self tabs do: [:each |
  121. self renderTabFor: each on: html].
  122. html li
  123. class: 'newtab';
  124. with: ' + ';
  125. onClick: [self newBrowserTab]]
  126. ! !
  127. !TabManager methodsFor: 'updating'!
  128. update
  129. self renderTabs
  130. ! !
  131. TabManager class instanceVariableNames: 'current'!
  132. !TabManager class methodsFor: 'instance creation'!
  133. current
  134. ^current ifNil: [current := super new]
  135. !
  136. new
  137. self shouldNotImplement
  138. ! !
  139. Widget subclass: #TabWidget
  140. instanceVariableNames: 'div'
  141. category: 'IDE'!
  142. !TabWidget methodsFor: 'accessing'!
  143. label
  144. self subclassResponsibility
  145. ! !
  146. !TabWidget methodsFor: 'actions'!
  147. open
  148. TabManager current addTab: self.
  149. TabManager current selectTab: self
  150. !
  151. show
  152. div asJQuery show
  153. !
  154. hide
  155. div asJQuery hide
  156. !
  157. remove
  158. div asJQuery remove
  159. ! !
  160. !TabWidget methodsFor: 'rendering'!
  161. renderOn: html
  162. div := html div
  163. class: 'jtalkTool';
  164. yourself.
  165. self renderTab
  166. !
  167. renderBoxOn: html
  168. !
  169. renderButtonsOn: html
  170. !
  171. update
  172. self renderTab
  173. !
  174. renderTab
  175. div contents: [:html |
  176. html div
  177. class: 'jt_box';
  178. with: [self renderBoxOn: html].
  179. html div
  180. class: 'jt_buttons';
  181. with: [self renderButtonsOn: html]]
  182. ! !
  183. !TabWidget methodsFor: 'testing'!
  184. canBeClosed
  185. ^false
  186. ! !
  187. !TabWidget class methodsFor: 'instance creation'!
  188. open
  189. ^self new open
  190. ! !
  191. TabWidget subclass: #Workspace
  192. instanceVariableNames: 'sourceArea'
  193. category: 'IDE'!
  194. !Workspace methodsFor: 'accessing'!
  195. label
  196. ^'[Workspace]'
  197. ! !
  198. !Workspace methodsFor: 'actions'!
  199. clearWorkspace
  200. sourceArea clear
  201. !
  202. doIt
  203. sourceArea doIt
  204. !
  205. printIt
  206. sourceArea printIt
  207. !
  208. inspectIt
  209. sourceArea inspectIt
  210. ! !
  211. !Workspace methodsFor: 'rendering'!
  212. renderBoxOn: html
  213. sourceArea := SourceArea new.
  214. sourceArea renderOn: html
  215. !
  216. renderButtonsOn: html
  217. html button
  218. with: 'DoIt';
  219. title: 'ctrl+d';
  220. onClick: [self doIt].
  221. html button
  222. with: 'PrintIt';
  223. title: 'ctrl+p';
  224. onClick: [self printIt].
  225. html button
  226. with: 'InspectIt';
  227. title: 'ctrl+i';
  228. onClick: [self inspectIt].
  229. html button
  230. with: 'Clear workspace';
  231. onClick: [self clearWorkspace]
  232. ! !
  233. TabWidget subclass: #Transcript
  234. instanceVariableNames: 'textarea'
  235. category: 'IDE'!
  236. !Transcript methodsFor: 'accessing'!
  237. label
  238. ^'[Transcript]'
  239. ! !
  240. !Transcript methodsFor: 'actions'!
  241. show: anObject
  242. textarea asJQuery val: textarea asJQuery val, anObject asString.
  243. !
  244. cr
  245. textarea asJQuery val: textarea asJQuery val, String cr.
  246. !
  247. clear
  248. textarea asJQuery val: ''
  249. ! !
  250. !Transcript methodsFor: 'rendering'!
  251. renderBoxOn: html
  252. textarea := html textarea.
  253. textarea asJQuery call: 'tabby'.
  254. textarea
  255. class: 'jt_transcript';
  256. at: 'spellcheck' put: 'false'
  257. !
  258. renderButtonsOn: html
  259. html button
  260. with: 'Clear transcript';
  261. onClick: [self clear]
  262. ! !
  263. Transcript class instanceVariableNames: 'current'!
  264. !Transcript class methodsFor: 'instance creation'!
  265. open
  266. self current open
  267. !
  268. new
  269. self shouldNotImplement
  270. !
  271. current
  272. ^current ifNil: [current := super new]
  273. ! !
  274. !Transcript class methodsFor: 'printing'!
  275. show: anObject
  276. self current show: anObject
  277. !
  278. cr
  279. self current show: String cr
  280. !
  281. clear
  282. self current clear
  283. ! !
  284. TabWidget subclass: #Browser
  285. instanceVariableNames: 'selectedCategory selectedClass selectedProtocol selectedMethod commitButton categoriesList classesList protocolsList methodsList sourceArea tabsList selectedTab saveButton classButtons methodButtons unsavedChanges input'
  286. category: 'IDE'!
  287. !Browser methodsFor: 'accessing'!
  288. label
  289. ^selectedClass
  290. ifNil: ['Browser (nil)']
  291. ifNotNil: [selectedClass name]
  292. !
  293. categories
  294. | categories |
  295. categories := Array new.
  296. Smalltalk current classes do: [:each |
  297. (categories includes: each category) ifFalse: [
  298. categories add: each category]].
  299. ^categories sort
  300. !
  301. classes
  302. ^(Smalltalk current classes
  303. select: [:each | each category = selectedCategory])
  304. sort: [:a :b | a name > b name]
  305. !
  306. protocols
  307. | klass |
  308. selectedClass ifNotNil: [
  309. selectedTab = #comment ifTrue: [^#()].
  310. klass := selectedTab = #instance
  311. ifTrue: [selectedClass]
  312. ifFalse: [selectedClass class].
  313. klass methodDictionary isEmpty ifTrue: [
  314. ^Array with: 'not yet classified'].
  315. ^klass protocols].
  316. ^Array new
  317. !
  318. methods
  319. | klass |
  320. selectedTab = #comment ifTrue: [^#()].
  321. selectedClass ifNotNil: [
  322. klass := selectedTab = #instance
  323. ifTrue: [selectedClass]
  324. ifFalse: [selectedClass class]].
  325. ^(selectedProtocol
  326. ifNil: [
  327. klass
  328. ifNil: [#()]
  329. ifNotNil: [klass methodDictionary values]]
  330. ifNotNil: [
  331. klass methodDictionary values select: [:each |
  332. each category = selectedProtocol]]) sort: [:a :b | a selector > b selector]
  333. !
  334. source
  335. selectedTab = #comment ifFalse: [
  336. ^(selectedProtocol notNil or: [selectedMethod notNil])
  337. ifFalse: [self declarationSource]
  338. ifTrue: [self methodSource]].
  339. ^selectedClass
  340. ifNil: ['']
  341. ifNotNil: [self classCommentSource]
  342. !
  343. methodSource
  344. ^selectedMethod
  345. ifNil: [self dummyMethodSource]
  346. ifNotNil: [selectedMethod source]
  347. !
  348. dummyMethodSource
  349. ^'messageSelectorAndArgumentNames
  350. "comment stating purpose of message"
  351. | temporary variable names |
  352. statements'
  353. !
  354. declarationSource
  355. ^selectedTab = #instance
  356. ifTrue: [self classDeclarationSource]
  357. ifFalse: [self metaclassDeclarationSource]
  358. !
  359. classDeclarationSource
  360. | stream |
  361. stream := '' writeStream.
  362. selectedClass ifNotNil: [
  363. stream
  364. nextPutAll: selectedClass superclass asString;
  365. nextPutAll: ' subclass: #';
  366. nextPutAll: selectedClass name;
  367. nextPutAll: String lf, String tab;
  368. nextPutAll: 'instanceVariableNames: '''.
  369. selectedClass instanceVariableNames
  370. do: [:each | stream nextPutAll: each]
  371. separatedBy: [stream nextPutAll: ' '].
  372. stream
  373. nextPutAll: '''', String lf, String tab;
  374. nextPutAll: 'category: ''';
  375. nextPutAll: selectedClass category;
  376. nextPutAll: ''''].
  377. ^stream contents
  378. !
  379. metaclassDeclarationSource
  380. | stream |
  381. stream := '' writeStream.
  382. selectedClass ifNotNil: [
  383. stream
  384. nextPutAll: selectedClass asString;
  385. nextPutAll: ' class ';
  386. nextPutAll: 'instanceVariableNames: '''.
  387. selectedClass class instanceVariableNames
  388. do: [:each | stream nextPutAll: each]
  389. separatedBy: [stream nextPutAll: ' '].
  390. stream nextPutAll: ''''].
  391. ^stream contents
  392. !
  393. classCommentSource
  394. ^selectedClass comment
  395. !
  396. selectedClass
  397. ^selectedClass
  398. ! !
  399. !Browser methodsFor: 'actions'!
  400. disableSaveButton
  401. saveButton ifNotNil: [
  402. saveButton at: 'disabled' put: true].
  403. unsavedChanges := false
  404. !
  405. hideClassButtons
  406. classButtons asJQuery hide
  407. !
  408. showClassButtons
  409. classButtons asJQuery show
  410. !
  411. hideMethodButtons
  412. methodButtons asJQuery hide
  413. !
  414. showMethodButtons
  415. methodButtons asJQuery show
  416. !
  417. compile
  418. self disableSaveButton.
  419. selectedTab = #comment ifTrue: [
  420. selectedClass ifNotNil: [
  421. self compileClassComment]].
  422. (selectedProtocol notNil or: [selectedMethod notNil])
  423. ifFalse: [self compileDefinition]
  424. ifTrue: [self compileMethodDefinition]
  425. !
  426. compileClassComment
  427. selectedClass comment: sourceArea val
  428. !
  429. compileMethodDefinition
  430. selectedTab = #instance
  431. ifTrue: [self compileMethodDefinitionFor: selectedClass]
  432. ifFalse: [self compileMethodDefinitionFor: selectedClass class]
  433. !
  434. compileMethodDefinitionFor: aClass
  435. | compiler method source node |
  436. source := sourceArea val.
  437. selectedProtocol ifNil: [selectedProtocol := selectedMethod category].
  438. compiler := Compiler new.
  439. node := compiler parse: source.
  440. node isParseFailure ifTrue: [
  441. ^self alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
  442. compiler currentClass: aClass.
  443. method := compiler eval: (compiler compileNode: node).
  444. method category: selectedProtocol.
  445. compiler unknownVariables do: [:each |
  446. (self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  447. self addInstanceVariableNamed: each toClass: aClass.
  448. ^self compileMethodDefinitionFor: aClass]].
  449. aClass addCompiledMethod: method.
  450. compiler setupClass: aClass.
  451. self updateMethodsList.
  452. self selectMethod: method
  453. !
  454. compileDefinition
  455. | newClass |
  456. newClass := Compiler new loadExpression: sourceArea val.
  457. self
  458. resetClassesList;
  459. updateCategoriesList;
  460. updateClassesList
  461. !
  462. commitCategory
  463. selectedCategory ifNotNil: [
  464. (Ajax url: self class commitPathJs, '/', selectedCategory, '.js')
  465. at: 'type' put: 'PUT';
  466. at: 'data' put: (Exporter new exportCategory: selectedCategory);
  467. at: 'error' put: [self alert: 'Commit failed!!'];
  468. send.
  469. (Ajax url: self class commitPathJs, '/', selectedCategory, '.deploy.js')
  470. at: 'type' put: 'PUT';
  471. at: 'data' put: (Exporter new exportCategory: selectedCategory);
  472. at: 'error' put: [self alert: 'Commit failed!!'];
  473. send.
  474. (Ajax url: self class commitPathSt, '/', selectedCategory, '.st')
  475. at: 'type' put: 'PUT';
  476. at: 'data' put: (ChunkExporter new exportCategory: selectedCategory);
  477. at: 'error' put: [self alert: 'Commit failed!!'];
  478. send]
  479. !
  480. cancelChanges
  481. ^unsavedChanges
  482. ifTrue: [self confirm: 'Cancel changes?']
  483. ifFalse: [true]
  484. !
  485. removeClass
  486. (self confirm: 'Do you really want to remove ', selectedClass name, '?')
  487. ifTrue: [
  488. Smalltalk current removeClass: selectedClass.
  489. self resetClassesList.
  490. self selectClass: nil]
  491. !
  492. removeMethod
  493. self cancelChanges ifTrue: [
  494. (self confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  495. ifTrue: [
  496. selectedTab = #instance
  497. ifTrue: [selectedClass removeCompiledMethod: selectedMethod]
  498. ifFalse: [selectedClass class removeCompiledMethod: selectedMethod].
  499. self selectMethod: nil]]
  500. !
  501. setMethodProtocol: aString
  502. self cancelChanges ifTrue: [
  503. (self protocols includes: aString)
  504. ifFalse: [self addNewProtocol]
  505. ifTrue: [
  506. selectedMethod category: aString.
  507. selectedProtocol := aString.
  508. selectedMethod := selectedMethod.
  509. self
  510. updateProtocolsList;
  511. updateMethodsList;
  512. updateSourceAndButtons]]
  513. !
  514. addNewProtocol
  515. | newProtocol |
  516. newProtocol := self prompt: 'New method protocol'.
  517. newProtocol notEmpty ifTrue: [
  518. selectedMethod category: newProtocol.
  519. self setMethodProtocol: newProtocol]
  520. !
  521. selectCategory: aCategory
  522. self cancelChanges ifTrue: [
  523. selectedCategory := aCategory.
  524. selectedClass := selectedProtocol := selectedMethod := nil.
  525. self resetClassesList.
  526. self
  527. updateCategoriesList;
  528. updateClassesList;
  529. updateProtocolsList;
  530. updateMethodsList;
  531. updateSourceAndButtons]
  532. !
  533. selectClass: aClass
  534. self cancelChanges ifTrue: [
  535. selectedClass := aClass.
  536. selectedProtocol := selectedMethod := nil.
  537. self
  538. updateClassesList;
  539. updateProtocolsList;
  540. updateMethodsList;
  541. updateSourceAndButtons]
  542. !
  543. selectProtocol: aString
  544. self cancelChanges ifTrue: [
  545. selectedProtocol := aString.
  546. selectedMethod := nil.
  547. self
  548. updateProtocolsList;
  549. updateMethodsList;
  550. updateSourceAndButtons]
  551. !
  552. selectMethod: aMethod
  553. self cancelChanges ifTrue: [
  554. selectedMethod := aMethod.
  555. self
  556. updateProtocolsList;
  557. updateMethodsList;
  558. updateSourceAndButtons]
  559. !
  560. selectTab: aString
  561. self cancelChanges ifTrue: [
  562. selectedTab := aString.
  563. self selectProtocol: nil.
  564. self updateTabsList]
  565. !
  566. renameClass
  567. | newName |
  568. newName := self prompt: 'Rename class ', selectedClass name.
  569. newName notEmpty ifTrue: [
  570. selectedClass rename: newName.
  571. self
  572. updateClassesList;
  573. updateSourceAndButtons]
  574. !
  575. addInstanceVariableNamed: aString toClass: aClass
  576. ClassBuilder new
  577. addSubclassOf: aClass superclass named: aClass name instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
  578. !
  579. searchReferencesOf: aString
  580. ReferencesBrowser search: aString
  581. !
  582. searchClassReferences
  583. ReferencesBrowser search: selectedClass name
  584. !
  585. search: aString
  586. self cancelChanges ifTrue: [| searchedClass |
  587. searchedClass := Smalltalk current at: aString.
  588. searchedClass isClass
  589. ifTrue: [self class openOn: searchedClass]
  590. ifFalse: [self searchReferencesOf: aString]]
  591. ! !
  592. !Browser methodsFor: 'initialization'!
  593. initialize
  594. super initialize.
  595. selectedTab := #instance.
  596. unsavedChanges := false
  597. ! !
  598. !Browser methodsFor: 'rendering'!
  599. renderBoxOn: html
  600. self
  601. renderTopPanelOn: html;
  602. renderTabsOn: html;
  603. renderBottomPanelOn: html
  604. !
  605. renderTopPanelOn: html
  606. html div
  607. class: 'top';
  608. with: [
  609. self renderInputOn: html.
  610. categoriesList := html ul class: 'jt_column browser categories'.
  611. commitButton := html button
  612. class: 'jt_commit';
  613. title: 'Commit classes in this category to disk';
  614. onClick: [self commitCategory];
  615. with: 'Commit category'.
  616. classesList := ClassesList on: self.
  617. classesList renderOn: html.
  618. protocolsList := html ul class: 'jt_column browser protocols'.
  619. methodsList := html ul class: 'jt_column browser methods'.
  620. self
  621. updateCategoriesList;
  622. updateClassesList;
  623. updateProtocolsList;
  624. updateMethodsList.
  625. html div class: 'jt_clear']
  626. !
  627. renderTabsOn: html
  628. tabsList := html ul class: 'jt_tabs'.
  629. self updateTabsList.
  630. !
  631. renderBottomPanelOn: html
  632. html div
  633. class: 'jt_sourceCode';
  634. with: [
  635. sourceArea := SourceArea new.
  636. sourceArea renderOn: html.
  637. sourceArea
  638. onKeyUp: [self updateStatus]]
  639. !
  640. renderButtonsOn: html
  641. saveButton := html button.
  642. saveButton
  643. with: 'Save';
  644. onClick: [self compile].
  645. methodButtons := html span.
  646. classButtons := html span.
  647. html div
  648. class: 'right';
  649. with: [
  650. html button
  651. with: 'DoIt';
  652. onClick: [sourceArea doIt].
  653. html button
  654. with: 'PrintIt';
  655. onClick: [sourceArea printIt].
  656. html button with: 'InspectIt';
  657. onClick: [sourceArea inspectit]].
  658. self updateSourceAndButtons
  659. !
  660. renderInputOn: html
  661. input := html input
  662. class: 'implementors';
  663. yourself.
  664. input onKeyPress: [:event |
  665. event keyCode = 13 ifTrue: [
  666. self search: input asJQuery val]]
  667. ! !
  668. !Browser methodsFor: 'testing'!
  669. canBeClosed
  670. ^true
  671. ! !
  672. !Browser methodsFor: 'updating'!
  673. updateCategoriesList
  674. categoriesList contents: [:html |
  675. self categories do: [:each || li label |
  676. each isEmpty
  677. ifTrue: [label := 'Unclassified']
  678. ifFalse: [label := each].
  679. li := html li.
  680. selectedCategory = each ifTrue: [
  681. li class: 'selected'].
  682. li
  683. with: label;
  684. onClick: [self selectCategory: each]]]
  685. !
  686. updateClassesList
  687. TabManager current update.
  688. classesList updateNodes.
  689. "classesList contents: [:html |
  690. self classes do: [:each || li |
  691. li := html li.
  692. selectedClass = each ifTrue: [
  693. li class: 'selected'].
  694. li
  695. with: each name;
  696. onClick: [self selectClass: each]]]"
  697. !
  698. updateProtocolsList
  699. protocolsList contents: [:html |
  700. self protocols do: [:each || li |
  701. li := html li.
  702. selectedProtocol = each ifTrue: [
  703. li class: 'selected'].
  704. li
  705. with: each;
  706. onClick: [self selectProtocol: each]]]
  707. !
  708. updateMethodsList
  709. methodsList contents: [:html |
  710. self methods do: [:each || li |
  711. li := html li.
  712. selectedMethod = each ifTrue: [
  713. li class: 'selected'].
  714. li
  715. with: each selector;
  716. onClick: [self selectMethod: each]]]
  717. !
  718. updateTabsList
  719. tabsList contents: [:html || li |
  720. li := html li.
  721. selectedTab = #instance ifTrue: [li class: 'selected'].
  722. li
  723. with: 'Instance';
  724. onClick: [self selectTab: #instance].
  725. li := html li.
  726. selectedTab = #class ifTrue: [li class: 'selected'].
  727. li
  728. with: 'Class';
  729. onClick: [self selectTab: #class].
  730. li := html li.
  731. selectedTab = #comment ifTrue: [li class: 'selected'].
  732. li
  733. with: 'Comment';
  734. onClick: [self selectTab: #comment]]
  735. !
  736. updateSourceAndButtons
  737. self disableSaveButton.
  738. classButtons contents: [:html |
  739. html button
  740. with: 'Rename class';
  741. onClick: [self renameClass].
  742. html button
  743. with: 'Remove class';
  744. onClick: [self removeClass].
  745. html button
  746. with: 'References';
  747. onClick: [self searchClassReferences]].
  748. methodButtons contents: [:html |
  749. html button
  750. with: 'Remove method';
  751. onClick: [self removeMethod].
  752. html select
  753. onChange: [:e :select | self setMethodProtocol: select val];
  754. with: [
  755. html option
  756. with: 'Method protocol';
  757. at: 'disabled' put: 'disabled'.
  758. html option
  759. class: 'important';
  760. with: 'New...'.
  761. self protocols do: [:each |
  762. html option with: each]].
  763. selectedMethod isNil ifFalse: [
  764. html select
  765. onChange: [:e :select | self searchReferencesOf: select val];
  766. with: [
  767. html option
  768. with: 'References';
  769. at: 'disabled' put: 'disabled'.
  770. html option
  771. class: 'important';
  772. with: selectedMethod selector.
  773. selectedMethod messageSends sorted do: [:each |
  774. html option with: each]]]].
  775. selectedMethod isNil
  776. ifTrue: [
  777. self hideMethodButtons.
  778. (selectedClass isNil or: [selectedProtocol notNil])
  779. ifTrue: [self hideClassButtons]
  780. ifFalse: [self showClassButtons]]
  781. ifFalse: [
  782. self hideClassButtons.
  783. self showMethodButtons].
  784. sourceArea val: self source
  785. !
  786. updateStatus
  787. sourceArea val = self source
  788. ifTrue: [
  789. saveButton ifNotNil: [
  790. saveButton at: 'disabled' put: true].
  791. unsavedChanges := false]
  792. ifFalse: [
  793. saveButton ifNotNil: [
  794. saveButton removeAt: 'disabled'].
  795. unsavedChanges := true]
  796. !
  797. resetClassesList
  798. classesList resetNodes
  799. ! !
  800. !Browser class methodsFor: 'accessing'!
  801. commitPathJs
  802. ^'js'
  803. !
  804. commitPathSt
  805. ^'st'
  806. ! !
  807. !Browser class methodsFor: 'convenience'!
  808. openOn: aClass
  809. ^self new
  810. open;
  811. selectCategory: aClass category;
  812. selectClass: aClass
  813. !
  814. open
  815. self new open
  816. ! !
  817. TabWidget subclass: #Inspector
  818. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea workspaceTextarea diveButton'
  819. category: 'IDE'!
  820. !Inspector methodsFor: 'accessing'!
  821. label
  822. ^label ifNil: ['Inspector (nil)']
  823. !
  824. variables
  825. ^variables
  826. !
  827. setVariables: aCollection
  828. variables := aCollection
  829. !
  830. setLabel: aString
  831. label := aString
  832. !
  833. selectedVariable
  834. ^selectedVariable
  835. !
  836. selectedVariable: aString
  837. selectedVariable := aString
  838. ! !
  839. !Inspector methodsFor: 'actions'!
  840. inspect: anObject
  841. object := anObject.
  842. variables := #().
  843. object inspectOn: self
  844. !
  845. dive
  846. (self variables at: self selectedVariable) inspect
  847. !
  848. refresh
  849. self
  850. inspect: object;
  851. updateVariablesList;
  852. updateValueTextarea
  853. ! !
  854. !Inspector methodsFor: 'rendering'!
  855. renderBoxOn: html
  856. self
  857. renderTopPanelOn: html;
  858. renderBottomPanelOn: html
  859. !
  860. renderTopPanelOn: html
  861. html div
  862. class: 'top';
  863. with: [
  864. variablesList := html ul class: 'jt_column variables'.
  865. valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
  866. self
  867. updateVariablesList;
  868. updateValueTextarea.
  869. html div class: 'jt_clear']
  870. !
  871. renderBottomPanelOn: html
  872. html div
  873. class: 'jt_sourceCode';
  874. with: [
  875. workspaceTextarea := html textarea
  876. class: 'source';
  877. at: 'spellcheck' put: 'false'.
  878. workspaceTextarea asJQuery call: 'tabby']
  879. !
  880. renderButtonsOn: html
  881. html button
  882. with: 'Refresh';
  883. onClick: [self refresh].
  884. diveButton := html button
  885. with: 'Dive';
  886. onClick: [self dive].
  887. self updateButtons
  888. ! !
  889. !Inspector methodsFor: 'testing'!
  890. canBeClosed
  891. ^true
  892. ! !
  893. !Inspector methodsFor: 'updating'!
  894. updateVariablesList
  895. variablesList contents: [:html |
  896. self variables keys do: [:each || li |
  897. li := html li.
  898. li
  899. with: each;
  900. onClick: [self selectVariable: each].
  901. self selectedVariable = each ifTrue: [
  902. li class: 'selected']]]
  903. !
  904. selectVariable: aString
  905. self selectedVariable: aString.
  906. self
  907. updateVariablesList;
  908. updateValueTextarea;
  909. updateButtons
  910. !
  911. updateValueTextarea
  912. valueTextarea asJQuery val: (self selectedVariable isNil
  913. ifTrue: ['']
  914. ifFalse: [(self variables at: self selectedVariable) printString])
  915. !
  916. updateButtons
  917. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  918. ifFalse: [diveButton at: 'disabled' put: true]
  919. ifTrue: [diveButton removeAt: 'disabled']
  920. ! !
  921. !Inspector class methodsFor: 'instance creation'!
  922. on: anObject
  923. ^self new
  924. inspect: anObject;
  925. yourself
  926. ! !
  927. TabWidget subclass: #ReferencesBrowser
  928. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
  929. category: 'IDE'!
  930. !ReferencesBrowser methodsFor: 'accessing'!
  931. implementors
  932. ^implementors ifNil: [implementors := Array new]
  933. !
  934. label
  935. ^'[ReferencesBrowser]'
  936. !
  937. selector
  938. ^selector
  939. !
  940. senders
  941. ^senders ifNil: [senders := Array new]
  942. !
  943. classesAndMetaclasses
  944. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  945. !
  946. referencedClasses
  947. ^referencedClasses ifNil: [referencedClasses := Array new]
  948. ! !
  949. !ReferencesBrowser methodsFor: 'actions'!
  950. openBrowserOn: aMethod
  951. | browser |
  952. browser := Browser openOn: (aMethod class isMetaclass
  953. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  954. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  955. browser
  956. selectProtocol: aMethod category;
  957. selectMethod: aMethod
  958. !
  959. searchReferencesFor: aString
  960. selector := aString.
  961. implementors := Array new.
  962. senders := Array new.
  963. referencedClasses := Array new.
  964. (selector match: '^[A-Z]')
  965. ifFalse: [self searchSelectorReferencesFor: selector]
  966. ifTrue: [self searchReferencedClassesFor: selector]
  967. !
  968. search: aString
  969. self
  970. searchReferencesFor: aString;
  971. updateImplementorsList;
  972. updateSendersList;
  973. updateReferencedClassesList
  974. !
  975. searchReferencedClassesFor: aString
  976. self classesAndMetaclasses do: [:each |
  977. each methodDictionary values do: [:value |
  978. (((value referencedClasses select: [:each | each notNil])collect: [:each | each name]) includes: selector) ifTrue: [
  979. self referencedClasses add: value]]]
  980. !
  981. searchSelectorReferencesFor: aString
  982. self classesAndMetaclasses do: [:each |
  983. each methodDictionary keysAndValuesDo: [:key :value |
  984. key = selector ifTrue: [self implementors add: value]].
  985. each methodDictionary keysAndValuesDo: [:key :value |
  986. (value messageSends includes: selector) ifTrue: [
  987. self senders add: value]]]
  988. ! !
  989. !ReferencesBrowser methodsFor: 'initialization'!
  990. initialize
  991. super initialize.
  992. selector := ''
  993. ! !
  994. !ReferencesBrowser methodsFor: 'private'!
  995. setInputEvents
  996. input
  997. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  998. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  999. ! !
  1000. !ReferencesBrowser methodsFor: 'rendering'!
  1001. renderBoxOn: html
  1002. self
  1003. renderInputOn: html;
  1004. renderImplementorsOn: html;
  1005. renderSendersOn: html;
  1006. renderReferencedClassesOn: html
  1007. !
  1008. renderInputOn: html
  1009. input := html input
  1010. class: 'implementors';
  1011. yourself.
  1012. input asJQuery val: selector.
  1013. self setInputEvents
  1014. !
  1015. renderImplementorsOn: html
  1016. implementorsList := html ul class: 'jt_column implementors'.
  1017. self updateImplementorsList
  1018. !
  1019. renderSendersOn: html
  1020. sendersList := html ul class: 'jt_column senders'.
  1021. self updateSendersList
  1022. !
  1023. renderReferencedClassesOn: html
  1024. referencedClassesList := html ul class: 'jt_column referenced_classes'.
  1025. self updateReferencedClassesList
  1026. ! !
  1027. !ReferencesBrowser methodsFor: 'testing'!
  1028. canBeClosed
  1029. ^true
  1030. ! !
  1031. !ReferencesBrowser methodsFor: 'updating'!
  1032. updateImplementorsList
  1033. implementorsList contents: [:html |
  1034. html li
  1035. class: 'column_label';
  1036. with: 'Implementors (', self implementors size asString, ')';
  1037. style: 'font-weight: bold'.
  1038. self implementors do: [:each || li |
  1039. li := html li.
  1040. li
  1041. with: (each methodClass asString, ' >> ', self selector);
  1042. onClick: [self openBrowserOn: each]]]
  1043. !
  1044. updateSendersList
  1045. sendersList contents: [:html |
  1046. html li
  1047. class: 'column_label';
  1048. with: 'Senders (', self senders size asString, ')';
  1049. style: 'font-weight: bold'.
  1050. self senders do: [:each |
  1051. html li
  1052. with: (each methodClass asString, ' >> ', each selector);
  1053. onClick: [self openBrowserOn: each]]]
  1054. !
  1055. updateReferencedClassesList
  1056. referencedClassesList contents: [:html |
  1057. html li
  1058. class: 'column_label';
  1059. with: 'Class references (', self referencedClasses size asString, ')';
  1060. style: 'font-weight: bold'.
  1061. self referencedClasses do: [:each |
  1062. html li
  1063. with: (each methodClass asString, ' >> ', each selector);
  1064. onClick: [self openBrowserOn: each]]]
  1065. ! !
  1066. !ReferencesBrowser class methodsFor: 'instance creation'!
  1067. search: aString
  1068. ^self new
  1069. searchReferencesFor: aString;
  1070. open
  1071. ! !
  1072. Widget subclass: #SourceArea
  1073. instanceVariableNames: 'editor div'
  1074. category: 'IDE'!
  1075. !SourceArea methodsFor: 'accessing'!
  1076. val
  1077. ^editor getValue
  1078. !
  1079. val: aString
  1080. editor setValue: aString
  1081. !
  1082. currentLine
  1083. ^editor getLine: (editor getCursor line)
  1084. !
  1085. selection
  1086. ^editor getSelection
  1087. !
  1088. selectionEnd
  1089. ^textarea element selectionEnd
  1090. !
  1091. selectionStart
  1092. ^textarea element selectionStart
  1093. !
  1094. selectionStart: anInteger
  1095. textarea element selectionStart: anInteger
  1096. !
  1097. selectionEnd: anInteger
  1098. textarea element selectionEnd: anInteger
  1099. !
  1100. setEditorOn: aTextarea
  1101. <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  1102. theme: 'jtalk',
  1103. lineNumbers: true,
  1104. enterMode: 'classic',
  1105. matchBrackets: true,
  1106. electricChars: false,
  1107. })>
  1108. !
  1109. editor
  1110. ^editor
  1111. ! !
  1112. !SourceArea methodsFor: 'actions'!
  1113. clear
  1114. textarea asJQuery val: ''
  1115. !
  1116. doIt
  1117. | selection |
  1118. editor somethingSelected
  1119. ifFalse: [selection := self currentLine]
  1120. ifTrue: [selection := self selection].
  1121. ^self eval: selection
  1122. !
  1123. eval: aString
  1124. | compiler node |
  1125. compiler := Compiler new.
  1126. node := compiler parseExpression: aString.
  1127. node isParseFailure ifTrue: [
  1128. ^self alert: node reason, ', position: ', node position].
  1129. ^compiler loadExpression: aString
  1130. !
  1131. handleKeyDown: anEvent
  1132. <if(anEvent.ctrlKey) {
  1133. if(anEvent.keyCode === 80) { //ctrl+p
  1134. self._printIt();
  1135. anEvent.preventDefault();
  1136. return false;
  1137. }
  1138. if(anEvent.keyCode === 68) { //ctrl+d
  1139. self._doIt();
  1140. anEvent.preventDefault();
  1141. return false;
  1142. }
  1143. if(anEvent.keyCode === 73) { //ctrl+i
  1144. self._inspectIt();
  1145. anEvent.preventDefault();
  1146. return false;
  1147. }
  1148. }>
  1149. !
  1150. inspectIt
  1151. self doIt inspect
  1152. !
  1153. print: aString
  1154. | start stop |
  1155. start := Dictionary new.
  1156. stop := Dictionary new.
  1157. start at: 'line' put: (editor getCursor: false) line.
  1158. start at: 'ch' put: (editor getCursor: false) ch.
  1159. stop at: 'line' put: (start at: 'line').
  1160. stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
  1161. editor replaceSelection: (editor getSelection, ' ', aString, ' ').
  1162. editor setCursor: (editor getCursor: true).
  1163. editor setSelection: stop end: start.
  1164. console log: start; log: stop
  1165. !
  1166. printIt
  1167. self print: self doIt printString
  1168. ! !
  1169. !SourceArea methodsFor: 'events'!
  1170. onKeyUp: aBlock
  1171. div onKeyUp: aBlock
  1172. !
  1173. onKeyDown: aBlock
  1174. div onKeyDown: aBlock
  1175. ! !
  1176. !SourceArea methodsFor: 'rendering'!
  1177. renderOn: html
  1178. | textarea |
  1179. div := html div class: 'source'.
  1180. div with: [textarea := html textarea].
  1181. self setEditorOn: textarea element.
  1182. div onKeyDown: [:e | self handleKeyDown: e]
  1183. ! !
  1184. Widget subclass: #ClassesList
  1185. instanceVariableNames: 'browser ul nodes'
  1186. category: 'IDE'!
  1187. !ClassesList methodsFor: 'accessing'!
  1188. category
  1189. ^self browser selectedCategory
  1190. !
  1191. nodes
  1192. nodes ifNil: [nodes := self getNodes].
  1193. ^nodes
  1194. !
  1195. browser
  1196. ^browser
  1197. !
  1198. browser: aBrowser
  1199. browser := aBrowser
  1200. !
  1201. getNodes
  1202. | classes children others |
  1203. classes := self browser classes.
  1204. children := #().
  1205. others := #().
  1206. classes do: [:each |
  1207. (classes includes: each superclass)
  1208. ifFalse: [children add: each]
  1209. ifTrue: [others add: each]].
  1210. ^children collect: [:each |
  1211. ClassesListNode on: each browser: self browser classes: others level: 0]
  1212. !
  1213. resetNodes
  1214. nodes := nil
  1215. ! !
  1216. !ClassesList methodsFor: 'rendering'!
  1217. renderOn: html
  1218. ul := html ul
  1219. class: 'jt_column browser classes';
  1220. yourself.
  1221. self updateNodes
  1222. !
  1223. updateNodes
  1224. ul contents: [:html |
  1225. self nodes do: [:each |
  1226. each renderOn: html]]
  1227. ! !
  1228. !ClassesList class methodsFor: 'instance creation'!
  1229. on: aBrowser
  1230. ^self new
  1231. browser: aBrowser;
  1232. yourself
  1233. ! !
  1234. Widget subclass: #ClassesListNode
  1235. instanceVariableNames: 'browser theClass level nodes'
  1236. category: 'IDE'!
  1237. !ClassesListNode methodsFor: 'accessing'!
  1238. nodes
  1239. ^nodes
  1240. !
  1241. theClass
  1242. ^theClass
  1243. !
  1244. theClass: aClass
  1245. theClass := aClass
  1246. !
  1247. browser
  1248. ^browser
  1249. !
  1250. browser: aBrowser
  1251. browser := aBrowser
  1252. !
  1253. level
  1254. ^level
  1255. !
  1256. level: anInteger
  1257. level := anInteger
  1258. !
  1259. label
  1260. | str |
  1261. str := String new writeStream.
  1262. self level timesRepeat: [
  1263. str nextPutAll: '&nbsp;&nbsp;&nbsp;&nbsp;'].
  1264. str nextPutAll: self theClass name.
  1265. ^str contents
  1266. !
  1267. getNodesFrom: aCollection
  1268. | children others |
  1269. children := #().
  1270. others := #().
  1271. aCollection do: [:each |
  1272. (each superclass = self theClass)
  1273. ifTrue: [children add: each]
  1274. ifFalse: [others add: each]].
  1275. nodes:= children collect: [:each |
  1276. ClassesListNode on: each browser: self browser classes: others level: self level + 1]
  1277. ! !
  1278. !ClassesListNode methodsFor: 'rendering'!
  1279. renderOn: html
  1280. | li |
  1281. li := html li
  1282. onClick: [self browser selectClass: self theClass].
  1283. li asJQuery contents: self label.
  1284. self browser selectedClass = self theClass ifTrue: [
  1285. li class: 'selected'].
  1286. self nodes do: [:each |
  1287. each renderOn: html]
  1288. ! !
  1289. !ClassesListNode class methodsFor: 'instance creation'!
  1290. on: aClass browser: aBrowser classes: aCollection level: anInteger
  1291. ^self new
  1292. theClass: aClass;
  1293. browser: aBrowser;
  1294. level: anInteger;
  1295. getNodesFrom: aCollection;
  1296. yourself
  1297. ! !
  1298. TabWidget subclass: #Debugger
  1299. instanceVariableNames: 'error selectedContext sourceArea ul'
  1300. category: 'IDE'!
  1301. !Debugger methodsFor: 'accessing'!
  1302. error
  1303. ^error
  1304. !
  1305. error: anError
  1306. error := anError
  1307. !
  1308. label
  1309. ^'[Debugger]'
  1310. ! !
  1311. !Debugger methodsFor: 'actions'!
  1312. selectContext: aContext
  1313. selectedContext := aContext.
  1314. self updateContextsList.
  1315. self updateSourceArea
  1316. ! !
  1317. !Debugger methodsFor: 'rendering'!
  1318. renderBoxOn: html
  1319. self
  1320. renderTopPanelOn: html;
  1321. renderBottomPanelOn: html
  1322. !
  1323. renderTopPanelOn: html
  1324. selectedContext := self error context.
  1325. html div
  1326. class: 'top';
  1327. with: [
  1328. html div
  1329. class: 'label';
  1330. with: self error messageText.
  1331. ul := html ul
  1332. class: 'jt_column debugger contexts';
  1333. with: [self renderContext: self error context on: html]]
  1334. !
  1335. renderContext: aContext on: html
  1336. | li |
  1337. li := html li.
  1338. selectedContext = aContext ifTrue: [
  1339. li class: 'selected'].
  1340. li
  1341. with: aContext asString;
  1342. onClick: [self selectContext: aContext].
  1343. aContext home ifNotNil: [self renderContext: aContext home on: html]
  1344. !
  1345. renderBottomPanelOn: html
  1346. html div
  1347. class: 'jt_sourceCode';
  1348. with: [
  1349. sourceArea := SourceArea new.
  1350. sourceArea renderOn: html].
  1351. self updateSourceArea
  1352. ! !
  1353. !Debugger methodsFor: 'testing'!
  1354. canBeClosed
  1355. ^true
  1356. ! !
  1357. !Debugger methodsFor: 'updating'!
  1358. updateContextsList
  1359. ul contents: [:html |
  1360. self renderContext: self error context on: html]
  1361. !
  1362. updateSourceArea
  1363. sourceArea val: (selectedContext receiver class methodAt: selectedContext selector) source
  1364. ! !
  1365. ErrorHandler subclass: #DebugErrorHandler
  1366. instanceVariableNames: ''
  1367. category: 'IDE'!
  1368. !DebugErrorHandler methodsFor: 'error handling'!
  1369. handleError: anError
  1370. [Debugger new
  1371. error: anError;
  1372. open] on: Error do: [:error |
  1373. ErrorHandler new handleError: error]
  1374. ! !
  1375. !DebugErrorHandler class methodsFor: 'initialization'!
  1376. initialize
  1377. self register
  1378. ! !
  1379. !Object methodsFor: '*IDE'!
  1380. inspect
  1381. Inspector new
  1382. inspect: self;
  1383. open
  1384. !
  1385. inspectOn: anInspector
  1386. | variables |
  1387. variables := Dictionary new.
  1388. variables at: '#self' put: self.
  1389. self class allInstanceVariableNames do: [:each |
  1390. variables at: each put: (self instVarAt: each)].
  1391. anInspector
  1392. setLabel: self printString;
  1393. setVariables: variables
  1394. ! !
  1395. !Date methodsFor: '*IDE'!
  1396. inspectOn: anInspector
  1397. | variables |
  1398. variables := Dictionary new.
  1399. variables at: '#self' put: self.
  1400. variables at: '#year' put: self year.
  1401. variables at: '#month' put: self month.
  1402. variables at: '#day' put: self day.
  1403. variables at: '#hours' put: self hours.
  1404. variables at: '#minutes' put: self minutes.
  1405. variables at: '#seconds' put: self seconds.
  1406. variables at: '#milliseconds' put: self milliseconds.
  1407. anInspector
  1408. setLabel: self printString;
  1409. setVariables: variables
  1410. ! !
  1411. !Collection methodsFor: '*IDE'!
  1412. inspectOn: anInspector
  1413. | variables |
  1414. variables := Dictionary new.
  1415. variables at: '#self' put: self.
  1416. self withIndexDo: [:each :i |
  1417. variables at: i put: each].
  1418. anInspector
  1419. setLabel: self printString;
  1420. setVariables: variables
  1421. ! !
  1422. !String methodsFor: '*IDE'!
  1423. inspectOn: anInspector
  1424. | label |
  1425. super inspectOn: anInspector.
  1426. self printString size > 30
  1427. ifTrue: [label := (self printString copyFrom: 1 to: 30), '...''']
  1428. ifFalse: [label := self printString].
  1429. anInspector setLabel: label
  1430. ! !
  1431. !MethodContext methodsFor: '*IDE'!
  1432. inspectOn: anInspector
  1433. | variables |
  1434. variables := Dictionary new.
  1435. variables at: '#self' put: self.
  1436. variables at: '#home' put: self home.
  1437. variables at: '#receiver' put: self receiver.
  1438. variables at: '#selector' put: self selector.
  1439. variables at: '#temps' put: self temps.
  1440. self class instanceVariableNames do: [:each |
  1441. variables at: each put: (self instVarAt: each)].
  1442. anInspector
  1443. setLabel: self printString;
  1444. setVariables: variables
  1445. ! !
  1446. !Dictionary methodsFor: '*IDE'!
  1447. inspectOn: anInspector
  1448. | variables |
  1449. variables := Dictionary new.
  1450. variables at: '#self' put: self.
  1451. variables at: '#keys' put: self keys.
  1452. self keysAndValuesDo: [:key :value |
  1453. variables at: key put: value].
  1454. anInspector
  1455. setLabel: self printString;
  1456. setVariables: variables
  1457. ! !