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. compiler source: source.
  440. node := compiler parse: source.
  441. node isParseFailure ifTrue: [
  442. ^self alert: 'PARSE ERROR: ', node reason, ', position: ', node position asString].
  443. compiler currentClass: aClass.
  444. method := compiler eval: (compiler compileNode: node).
  445. method category: selectedProtocol.
  446. compiler unknownVariables do: [:each |
  447. (self confirm: 'Declare ''', each, ''' as instance variable?') ifTrue: [
  448. self addInstanceVariableNamed: each toClass: aClass.
  449. ^self compileMethodDefinitionFor: aClass]].
  450. aClass addCompiledMethod: method.
  451. compiler setupClass: aClass.
  452. self updateMethodsList.
  453. self selectMethod: method
  454. !
  455. compileDefinition
  456. | newClass |
  457. newClass := Compiler new loadExpression: sourceArea val.
  458. self
  459. resetClassesList;
  460. updateCategoriesList;
  461. updateClassesList
  462. !
  463. commitCategory
  464. selectedCategory ifNotNil: [
  465. (Ajax url: self class commitPathJs, '/', selectedCategory, '.js')
  466. at: 'type' put: 'PUT';
  467. at: 'data' put: (Exporter new exportCategory: selectedCategory);
  468. at: 'error' put: [self alert: 'Commit failed!!'];
  469. send.
  470. (Ajax url: self class commitPathJs, '/', selectedCategory, '.deploy.js')
  471. at: 'type' put: 'PUT';
  472. at: 'data' put: (StrippedExporter new exportCategory: selectedCategory);
  473. at: 'error' put: [self alert: 'Commit failed!!'];
  474. send.
  475. (Ajax url: self class commitPathSt, '/', selectedCategory, '.st')
  476. at: 'type' put: 'PUT';
  477. at: 'data' put: (ChunkExporter new exportCategory: selectedCategory);
  478. at: 'error' put: [self alert: 'Commit failed!!'];
  479. send]
  480. !
  481. cancelChanges
  482. ^unsavedChanges
  483. ifTrue: [self confirm: 'Cancel changes?']
  484. ifFalse: [true]
  485. !
  486. removeClass
  487. (self confirm: 'Do you really want to remove ', selectedClass name, '?')
  488. ifTrue: [
  489. Smalltalk current removeClass: selectedClass.
  490. self resetClassesList.
  491. self selectClass: nil]
  492. !
  493. removeMethod
  494. self cancelChanges ifTrue: [
  495. (self confirm: 'Do you really want to remove #', selectedMethod selector, '?')
  496. ifTrue: [
  497. selectedTab = #instance
  498. ifTrue: [selectedClass removeCompiledMethod: selectedMethod]
  499. ifFalse: [selectedClass class removeCompiledMethod: selectedMethod].
  500. self selectMethod: nil]]
  501. !
  502. setMethodProtocol: aString
  503. self cancelChanges ifTrue: [
  504. (self protocols includes: aString)
  505. ifFalse: [self addNewProtocol]
  506. ifTrue: [
  507. selectedMethod category: aString.
  508. selectedProtocol := aString.
  509. selectedMethod := selectedMethod.
  510. self
  511. updateProtocolsList;
  512. updateMethodsList;
  513. updateSourceAndButtons]]
  514. !
  515. addNewProtocol
  516. | newProtocol |
  517. newProtocol := self prompt: 'New method protocol'.
  518. newProtocol notEmpty ifTrue: [
  519. selectedMethod category: newProtocol.
  520. self setMethodProtocol: newProtocol]
  521. !
  522. selectCategory: aCategory
  523. self cancelChanges ifTrue: [
  524. selectedCategory := aCategory.
  525. selectedClass := selectedProtocol := selectedMethod := nil.
  526. self resetClassesList.
  527. self
  528. updateCategoriesList;
  529. updateClassesList;
  530. updateProtocolsList;
  531. updateMethodsList;
  532. updateSourceAndButtons]
  533. !
  534. selectClass: aClass
  535. self cancelChanges ifTrue: [
  536. selectedClass := aClass.
  537. selectedProtocol := selectedMethod := nil.
  538. self
  539. updateClassesList;
  540. updateProtocolsList;
  541. updateMethodsList;
  542. updateSourceAndButtons]
  543. !
  544. selectProtocol: aString
  545. self cancelChanges ifTrue: [
  546. selectedProtocol := aString.
  547. selectedMethod := nil.
  548. self
  549. updateProtocolsList;
  550. updateMethodsList;
  551. updateSourceAndButtons]
  552. !
  553. selectMethod: aMethod
  554. self cancelChanges ifTrue: [
  555. selectedMethod := aMethod.
  556. self
  557. updateProtocolsList;
  558. updateMethodsList;
  559. updateSourceAndButtons]
  560. !
  561. selectTab: aString
  562. self cancelChanges ifTrue: [
  563. selectedTab := aString.
  564. self selectProtocol: nil.
  565. self updateTabsList]
  566. !
  567. renameClass
  568. | newName |
  569. newName := self prompt: 'Rename class ', selectedClass name.
  570. newName notEmpty ifTrue: [
  571. selectedClass rename: newName.
  572. self
  573. updateClassesList;
  574. updateSourceAndButtons]
  575. !
  576. addInstanceVariableNamed: aString toClass: aClass
  577. ClassBuilder new
  578. addSubclassOf: aClass superclass named: aClass name instanceVariableNames: (aClass instanceVariableNames copy add: aString; yourself)
  579. !
  580. searchReferencesOf: aString
  581. ReferencesBrowser search: aString
  582. !
  583. searchClassReferences
  584. ReferencesBrowser search: selectedClass name
  585. !
  586. search: aString
  587. self cancelChanges ifTrue: [| searchedClass |
  588. searchedClass := Smalltalk current at: aString.
  589. searchedClass isClass
  590. ifTrue: [self class openOn: searchedClass]
  591. ifFalse: [self searchReferencesOf: aString]]
  592. ! !
  593. !Browser methodsFor: 'initialization'!
  594. initialize
  595. super initialize.
  596. selectedTab := #instance.
  597. unsavedChanges := false
  598. ! !
  599. !Browser methodsFor: 'rendering'!
  600. renderBoxOn: html
  601. self
  602. renderTopPanelOn: html;
  603. renderTabsOn: html;
  604. renderBottomPanelOn: html
  605. !
  606. renderTopPanelOn: html
  607. html div
  608. class: 'top';
  609. with: [
  610. self renderInputOn: html.
  611. categoriesList := html ul class: 'jt_column browser categories'.
  612. commitButton := html button
  613. class: 'jt_commit';
  614. title: 'Commit classes in this category to disk';
  615. onClick: [self commitCategory];
  616. with: 'Commit category'.
  617. classesList := ClassesList on: self.
  618. classesList renderOn: html.
  619. protocolsList := html ul class: 'jt_column browser protocols'.
  620. methodsList := html ul class: 'jt_column browser methods'.
  621. self
  622. updateCategoriesList;
  623. updateClassesList;
  624. updateProtocolsList;
  625. updateMethodsList.
  626. html div class: 'jt_clear']
  627. !
  628. renderTabsOn: html
  629. tabsList := html ul class: 'jt_tabs'.
  630. self updateTabsList.
  631. !
  632. renderBottomPanelOn: html
  633. html div
  634. class: 'jt_sourceCode';
  635. with: [
  636. sourceArea := SourceArea new.
  637. sourceArea renderOn: html.
  638. sourceArea
  639. onKeyUp: [self updateStatus]]
  640. !
  641. renderButtonsOn: html
  642. saveButton := html button.
  643. saveButton
  644. with: 'Save';
  645. onClick: [self compile].
  646. methodButtons := html span.
  647. classButtons := html span.
  648. html div
  649. class: 'right';
  650. with: [
  651. html button
  652. with: 'DoIt';
  653. onClick: [sourceArea doIt].
  654. html button
  655. with: 'PrintIt';
  656. onClick: [sourceArea printIt].
  657. html button with: 'InspectIt';
  658. onClick: [sourceArea inspectit]].
  659. self updateSourceAndButtons
  660. !
  661. renderInputOn: html
  662. input := html input
  663. class: 'implementors';
  664. yourself.
  665. input onKeyPress: [:event |
  666. event keyCode = 13 ifTrue: [
  667. self search: input asJQuery val]]
  668. ! !
  669. !Browser methodsFor: 'testing'!
  670. canBeClosed
  671. ^true
  672. ! !
  673. !Browser methodsFor: 'updating'!
  674. updateCategoriesList
  675. categoriesList contents: [:html |
  676. self categories do: [:each || li label |
  677. each isEmpty
  678. ifTrue: [label := 'Unclassified']
  679. ifFalse: [label := each].
  680. li := html li.
  681. selectedCategory = each ifTrue: [
  682. li class: 'selected'].
  683. li
  684. with: label;
  685. onClick: [self selectCategory: each]]]
  686. !
  687. updateClassesList
  688. TabManager current update.
  689. classesList updateNodes.
  690. "classesList contents: [:html |
  691. self classes do: [:each || li |
  692. li := html li.
  693. selectedClass = each ifTrue: [
  694. li class: 'selected'].
  695. li
  696. with: each name;
  697. onClick: [self selectClass: each]]]"
  698. !
  699. updateProtocolsList
  700. protocolsList contents: [:html |
  701. self protocols do: [:each || li |
  702. li := html li.
  703. selectedProtocol = each ifTrue: [
  704. li class: 'selected'].
  705. li
  706. with: each;
  707. onClick: [self selectProtocol: each]]]
  708. !
  709. updateMethodsList
  710. methodsList contents: [:html |
  711. self methods do: [:each || li |
  712. li := html li.
  713. selectedMethod = each ifTrue: [
  714. li class: 'selected'].
  715. li
  716. with: each selector;
  717. onClick: [self selectMethod: each]]]
  718. !
  719. updateTabsList
  720. tabsList contents: [:html || li |
  721. li := html li.
  722. selectedTab = #instance ifTrue: [li class: 'selected'].
  723. li
  724. with: 'Instance';
  725. onClick: [self selectTab: #instance].
  726. li := html li.
  727. selectedTab = #class ifTrue: [li class: 'selected'].
  728. li
  729. with: 'Class';
  730. onClick: [self selectTab: #class].
  731. li := html li.
  732. selectedTab = #comment ifTrue: [li class: 'selected'].
  733. li
  734. with: 'Comment';
  735. onClick: [self selectTab: #comment]]
  736. !
  737. updateSourceAndButtons
  738. self disableSaveButton.
  739. classButtons contents: [:html |
  740. html button
  741. with: 'Rename class';
  742. onClick: [self renameClass].
  743. html button
  744. with: 'Remove class';
  745. onClick: [self removeClass].
  746. html button
  747. with: 'References';
  748. onClick: [self searchClassReferences]].
  749. methodButtons contents: [:html |
  750. html button
  751. with: 'Remove method';
  752. onClick: [self removeMethod].
  753. html select
  754. onChange: [:e :select | self setMethodProtocol: select val];
  755. with: [
  756. html option
  757. with: 'Method protocol';
  758. at: 'disabled' put: 'disabled'.
  759. html option
  760. class: 'important';
  761. with: 'New...'.
  762. self protocols do: [:each |
  763. html option with: each]].
  764. selectedMethod isNil ifFalse: [
  765. html select
  766. onChange: [:e :select | self searchReferencesOf: select val];
  767. with: [
  768. html option
  769. with: 'References';
  770. at: 'disabled' put: 'disabled'.
  771. html option
  772. class: 'important';
  773. with: selectedMethod selector.
  774. selectedMethod messageSends sorted do: [:each |
  775. html option with: each]]]].
  776. selectedMethod isNil
  777. ifTrue: [
  778. self hideMethodButtons.
  779. (selectedClass isNil or: [selectedProtocol notNil])
  780. ifTrue: [self hideClassButtons]
  781. ifFalse: [self showClassButtons]]
  782. ifFalse: [
  783. self hideClassButtons.
  784. self showMethodButtons].
  785. sourceArea val: self source
  786. !
  787. updateStatus
  788. sourceArea val = self source
  789. ifTrue: [
  790. saveButton ifNotNil: [
  791. saveButton at: 'disabled' put: true].
  792. unsavedChanges := false]
  793. ifFalse: [
  794. saveButton ifNotNil: [
  795. saveButton removeAt: 'disabled'].
  796. unsavedChanges := true]
  797. !
  798. resetClassesList
  799. classesList resetNodes
  800. ! !
  801. !Browser class methodsFor: 'accessing'!
  802. commitPathJs
  803. ^'js'
  804. !
  805. commitPathSt
  806. ^'st'
  807. ! !
  808. !Browser class methodsFor: 'convenience'!
  809. openOn: aClass
  810. ^self new
  811. open;
  812. selectCategory: aClass category;
  813. selectClass: aClass
  814. !
  815. open
  816. self new open
  817. ! !
  818. TabWidget subclass: #Inspector
  819. instanceVariableNames: 'label variables object selectedVariable variablesList valueTextarea workspaceTextarea diveButton'
  820. category: 'IDE'!
  821. !Inspector methodsFor: 'accessing'!
  822. label
  823. ^label ifNil: ['Inspector (nil)']
  824. !
  825. variables
  826. ^variables
  827. !
  828. setVariables: aCollection
  829. variables := aCollection
  830. !
  831. setLabel: aString
  832. label := aString
  833. !
  834. selectedVariable
  835. ^selectedVariable
  836. !
  837. selectedVariable: aString
  838. selectedVariable := aString
  839. ! !
  840. !Inspector methodsFor: 'actions'!
  841. inspect: anObject
  842. object := anObject.
  843. variables := #().
  844. object inspectOn: self
  845. !
  846. dive
  847. (self variables at: self selectedVariable) inspect
  848. !
  849. refresh
  850. self
  851. inspect: object;
  852. updateVariablesList;
  853. updateValueTextarea
  854. ! !
  855. !Inspector methodsFor: 'rendering'!
  856. renderBoxOn: html
  857. self
  858. renderTopPanelOn: html;
  859. renderBottomPanelOn: html
  860. !
  861. renderTopPanelOn: html
  862. html div
  863. class: 'top';
  864. with: [
  865. variablesList := html ul class: 'jt_column variables'.
  866. valueTextarea := html textarea class: 'jt_column value'; at: 'readonly' put: 'readonly'.
  867. self
  868. updateVariablesList;
  869. updateValueTextarea.
  870. html div class: 'jt_clear']
  871. !
  872. renderBottomPanelOn: html
  873. html div
  874. class: 'jt_sourceCode';
  875. with: [
  876. workspaceTextarea := html textarea
  877. class: 'source';
  878. at: 'spellcheck' put: 'false'.
  879. workspaceTextarea asJQuery call: 'tabby']
  880. !
  881. renderButtonsOn: html
  882. html button
  883. with: 'Refresh';
  884. onClick: [self refresh].
  885. diveButton := html button
  886. with: 'Dive';
  887. onClick: [self dive].
  888. self updateButtons
  889. ! !
  890. !Inspector methodsFor: 'testing'!
  891. canBeClosed
  892. ^true
  893. ! !
  894. !Inspector methodsFor: 'updating'!
  895. updateVariablesList
  896. variablesList contents: [:html |
  897. self variables keys do: [:each || li |
  898. li := html li.
  899. li
  900. with: each;
  901. onClick: [self selectVariable: each].
  902. self selectedVariable = each ifTrue: [
  903. li class: 'selected']]]
  904. !
  905. selectVariable: aString
  906. self selectedVariable: aString.
  907. self
  908. updateVariablesList;
  909. updateValueTextarea;
  910. updateButtons
  911. !
  912. updateValueTextarea
  913. valueTextarea asJQuery val: (self selectedVariable isNil
  914. ifTrue: ['']
  915. ifFalse: [(self variables at: self selectedVariable) printString])
  916. !
  917. updateButtons
  918. (self selectedVariable notNil and: [(self variables at: self selectedVariable) notNil])
  919. ifFalse: [diveButton at: 'disabled' put: true]
  920. ifTrue: [diveButton removeAt: 'disabled']
  921. ! !
  922. !Inspector class methodsFor: 'instance creation'!
  923. on: anObject
  924. ^self new
  925. inspect: anObject;
  926. yourself
  927. ! !
  928. TabWidget subclass: #ReferencesBrowser
  929. instanceVariableNames: 'implementors senders implementorsList input timer selector sendersList referencedClasses referencedClassesList'
  930. category: 'IDE'!
  931. !ReferencesBrowser methodsFor: 'accessing'!
  932. implementors
  933. ^implementors ifNil: [implementors := Array new]
  934. !
  935. label
  936. ^'[ReferencesBrowser]'
  937. !
  938. selector
  939. ^selector
  940. !
  941. senders
  942. ^senders ifNil: [senders := Array new]
  943. !
  944. classesAndMetaclasses
  945. ^Smalltalk current classes, (Smalltalk current classes collect: [:each | each class])
  946. !
  947. referencedClasses
  948. ^referencedClasses ifNil: [referencedClasses := Array new]
  949. ! !
  950. !ReferencesBrowser methodsFor: 'actions'!
  951. openBrowserOn: aMethod
  952. | browser |
  953. browser := Browser openOn: (aMethod class isMetaclass
  954. ifTrue: [aMethod methodClass instanceClass] ifFalse: [aMethod methodClass]).
  955. aMethod methodClass isMetaclass ifTrue: [browser selectTab: #class].
  956. browser
  957. selectProtocol: aMethod category;
  958. selectMethod: aMethod
  959. !
  960. searchReferencesFor: aString
  961. selector := aString.
  962. implementors := Array new.
  963. senders := Array new.
  964. referencedClasses := Array new.
  965. (selector match: '^[A-Z]')
  966. ifFalse: [self searchSelectorReferencesFor: selector]
  967. ifTrue: [self searchReferencedClassesFor: selector]
  968. !
  969. search: aString
  970. self
  971. searchReferencesFor: aString;
  972. updateImplementorsList;
  973. updateSendersList;
  974. updateReferencedClassesList
  975. !
  976. searchReferencedClassesFor: aString
  977. self classesAndMetaclasses do: [:each |
  978. each methodDictionary values do: [:value |
  979. (((value referencedClasses select: [:each | each notNil])collect: [:each | each name]) includes: selector) ifTrue: [
  980. self referencedClasses add: value]]]
  981. !
  982. searchSelectorReferencesFor: aString
  983. self classesAndMetaclasses do: [:each |
  984. each methodDictionary keysAndValuesDo: [:key :value |
  985. key = selector ifTrue: [self implementors add: value]].
  986. each methodDictionary keysAndValuesDo: [:key :value |
  987. (value messageSends includes: selector) ifTrue: [
  988. self senders add: value]]]
  989. ! !
  990. !ReferencesBrowser methodsFor: 'initialization'!
  991. initialize
  992. super initialize.
  993. selector := ''
  994. ! !
  995. !ReferencesBrowser methodsFor: 'private'!
  996. setInputEvents
  997. input
  998. onKeyUp: [timer := [self search: input asJQuery val] valueWithTimeout: 100];
  999. onKeyDown: [timer ifNotNil: [timer clearTimeout]]
  1000. ! !
  1001. !ReferencesBrowser methodsFor: 'rendering'!
  1002. renderBoxOn: html
  1003. self
  1004. renderInputOn: html;
  1005. renderImplementorsOn: html;
  1006. renderSendersOn: html;
  1007. renderReferencedClassesOn: html
  1008. !
  1009. renderInputOn: html
  1010. input := html input
  1011. class: 'implementors';
  1012. yourself.
  1013. input asJQuery val: selector.
  1014. self setInputEvents
  1015. !
  1016. renderImplementorsOn: html
  1017. implementorsList := html ul class: 'jt_column implementors'.
  1018. self updateImplementorsList
  1019. !
  1020. renderSendersOn: html
  1021. sendersList := html ul class: 'jt_column senders'.
  1022. self updateSendersList
  1023. !
  1024. renderReferencedClassesOn: html
  1025. referencedClassesList := html ul class: 'jt_column referenced_classes'.
  1026. self updateReferencedClassesList
  1027. ! !
  1028. !ReferencesBrowser methodsFor: 'testing'!
  1029. canBeClosed
  1030. ^true
  1031. ! !
  1032. !ReferencesBrowser methodsFor: 'updating'!
  1033. updateImplementorsList
  1034. implementorsList contents: [:html |
  1035. html li
  1036. class: 'column_label';
  1037. with: 'Implementors (', self implementors size asString, ')';
  1038. style: 'font-weight: bold'.
  1039. self implementors do: [:each || li |
  1040. li := html li.
  1041. li
  1042. with: (each methodClass asString, ' >> ', self selector);
  1043. onClick: [self openBrowserOn: each]]]
  1044. !
  1045. updateSendersList
  1046. sendersList contents: [:html |
  1047. html li
  1048. class: 'column_label';
  1049. with: 'Senders (', self senders size asString, ')';
  1050. style: 'font-weight: bold'.
  1051. self senders do: [:each |
  1052. html li
  1053. with: (each methodClass asString, ' >> ', each selector);
  1054. onClick: [self openBrowserOn: each]]]
  1055. !
  1056. updateReferencedClassesList
  1057. referencedClassesList contents: [:html |
  1058. html li
  1059. class: 'column_label';
  1060. with: 'Class references (', self referencedClasses size asString, ')';
  1061. style: 'font-weight: bold'.
  1062. self referencedClasses do: [:each |
  1063. html li
  1064. with: (each methodClass asString, ' >> ', each selector);
  1065. onClick: [self openBrowserOn: each]]]
  1066. ! !
  1067. !ReferencesBrowser class methodsFor: 'instance creation'!
  1068. search: aString
  1069. ^self new
  1070. searchReferencesFor: aString;
  1071. open
  1072. ! !
  1073. Widget subclass: #SourceArea
  1074. instanceVariableNames: 'editor div'
  1075. category: 'IDE'!
  1076. !SourceArea methodsFor: 'accessing'!
  1077. val
  1078. ^editor getValue
  1079. !
  1080. val: aString
  1081. editor setValue: aString
  1082. !
  1083. currentLine
  1084. ^editor getLine: (editor getCursor line)
  1085. !
  1086. selection
  1087. ^editor getSelection
  1088. !
  1089. selectionEnd
  1090. ^textarea element selectionEnd
  1091. !
  1092. selectionStart
  1093. ^textarea element selectionStart
  1094. !
  1095. selectionStart: anInteger
  1096. textarea element selectionStart: anInteger
  1097. !
  1098. selectionEnd: anInteger
  1099. textarea element selectionEnd: anInteger
  1100. !
  1101. setEditorOn: aTextarea
  1102. <self['@editor'] = CodeMirror.fromTextArea(aTextarea, {
  1103. theme: 'jtalk',
  1104. lineNumbers: true,
  1105. enterMode: 'classic',
  1106. matchBrackets: true,
  1107. electricChars: false,
  1108. })>
  1109. !
  1110. editor
  1111. ^editor
  1112. ! !
  1113. !SourceArea methodsFor: 'actions'!
  1114. clear
  1115. textarea asJQuery val: ''
  1116. !
  1117. doIt
  1118. | selection |
  1119. editor somethingSelected
  1120. ifFalse: [selection := self currentLine]
  1121. ifTrue: [selection := self selection].
  1122. ^self eval: selection
  1123. !
  1124. eval: aString
  1125. | compiler node |
  1126. compiler := Compiler new.
  1127. node := compiler parseExpression: aString.
  1128. node isParseFailure ifTrue: [
  1129. ^self alert: node reason, ', position: ', node position].
  1130. ^compiler loadExpression: aString
  1131. !
  1132. handleKeyDown: anEvent
  1133. <if(anEvent.ctrlKey) {
  1134. if(anEvent.keyCode === 80) { //ctrl+p
  1135. self._printIt();
  1136. anEvent.preventDefault();
  1137. return false;
  1138. }
  1139. if(anEvent.keyCode === 68) { //ctrl+d
  1140. self._doIt();
  1141. anEvent.preventDefault();
  1142. return false;
  1143. }
  1144. if(anEvent.keyCode === 73) { //ctrl+i
  1145. self._inspectIt();
  1146. anEvent.preventDefault();
  1147. return false;
  1148. }
  1149. }>
  1150. !
  1151. inspectIt
  1152. self doIt inspect
  1153. !
  1154. print: aString
  1155. | start stop |
  1156. start := Dictionary new.
  1157. stop := Dictionary new.
  1158. start at: 'line' put: (editor getCursor: false) line.
  1159. start at: 'ch' put: (editor getCursor: false) ch.
  1160. stop at: 'line' put: (start at: 'line').
  1161. stop at: 'ch' put: ((start at: 'ch') + aString size + 2).
  1162. editor replaceSelection: (editor getSelection, ' ', aString, ' ').
  1163. editor setCursor: (editor getCursor: true).
  1164. editor setSelection: stop end: start
  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. ! !