2
0

Helios-Commands-Browser.st 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. Smalltalk createPackage: 'Helios-Commands-Browser'!
  2. HLToolCommand subclass: #HLBrowserCommand
  3. instanceVariableNames: ''
  4. package: 'Helios-Commands-Browser'!
  5. !HLBrowserCommand class methodsFor: 'testing'!
  6. isValidFor: aModel
  7. ^ aModel isBrowserModel
  8. ! !
  9. HLBrowserCommand subclass: #HLBrowserGoToCommand
  10. instanceVariableNames: ''
  11. package: 'Helios-Commands-Browser'!
  12. !HLBrowserGoToCommand class methodsFor: 'accessing'!
  13. key
  14. ^ 'g'
  15. !
  16. label
  17. ^ 'Go to'
  18. ! !
  19. !HLBrowserGoToCommand class methodsFor: 'testing'!
  20. isValidFor: aModel
  21. ^ aModel isBrowserModel
  22. ! !
  23. HLBrowserGoToCommand subclass: #HLGoToClassesCommand
  24. instanceVariableNames: ''
  25. package: 'Helios-Commands-Browser'!
  26. !HLGoToClassesCommand methodsFor: 'executing'!
  27. execute
  28. self model focusOnClasses
  29. ! !
  30. !HLGoToClassesCommand class methodsFor: 'accessing'!
  31. key
  32. ^ 'c'
  33. !
  34. label
  35. ^ 'Classes'
  36. ! !
  37. HLBrowserGoToCommand subclass: #HLGoToMethodsCommand
  38. instanceVariableNames: ''
  39. package: 'Helios-Commands-Browser'!
  40. !HLGoToMethodsCommand methodsFor: 'executing'!
  41. execute
  42. self model focusOnMethods
  43. ! !
  44. !HLGoToMethodsCommand class methodsFor: 'accessing'!
  45. key
  46. ^ 'm'
  47. !
  48. label
  49. ^ 'Methods'
  50. ! !
  51. HLBrowserGoToCommand subclass: #HLGoToPackagesCommand
  52. instanceVariableNames: ''
  53. package: 'Helios-Commands-Browser'!
  54. !HLGoToPackagesCommand methodsFor: 'executing'!
  55. execute
  56. self model focusOnPackages
  57. ! !
  58. !HLGoToPackagesCommand class methodsFor: 'accessing'!
  59. key
  60. ^ 'p'
  61. !
  62. label
  63. ^ 'Packages'
  64. ! !
  65. HLBrowserGoToCommand subclass: #HLGoToProtocolsCommand
  66. instanceVariableNames: ''
  67. package: 'Helios-Commands-Browser'!
  68. !HLGoToProtocolsCommand methodsFor: 'executing'!
  69. execute
  70. self model focusOnProtocols
  71. ! !
  72. !HLGoToProtocolsCommand class methodsFor: 'accessing'!
  73. key
  74. ^ 't'
  75. !
  76. label
  77. ^ 'Protocols'
  78. ! !
  79. HLBrowserGoToCommand subclass: #HLGoToSourceCodeCommand
  80. instanceVariableNames: ''
  81. package: 'Helios-Commands-Browser'!
  82. !HLGoToSourceCodeCommand methodsFor: 'executing'!
  83. execute
  84. self model focusOnSourceCode
  85. ! !
  86. !HLGoToSourceCodeCommand class methodsFor: 'accessing'!
  87. key
  88. ^ 's'
  89. !
  90. label
  91. ^ 'Source code'
  92. ! !
  93. HLBrowserCommand subclass: #HLEditCommentCommand
  94. instanceVariableNames: ''
  95. package: 'Helios-Commands-Browser'!
  96. !HLEditCommentCommand methodsFor: 'executing'!
  97. execute
  98. self model editComment
  99. ! !
  100. !HLEditCommentCommand methodsFor: 'testing'!
  101. isActive
  102. ^ self model showComment and: [ self model selectedClass notNil ]
  103. ! !
  104. !HLEditCommentCommand class methodsFor: 'accessing'!
  105. key
  106. ^ 'd'
  107. !
  108. label
  109. ^ 'Edit documentation'
  110. ! !
  111. HLBrowserCommand subclass: #HLGenerateCommand
  112. instanceVariableNames: ''
  113. package: 'Helios-Commands-Browser'!
  114. !HLGenerateCommand commentStamp!
  115. I am a group command used to gather all the commands generating code (`accessors`, `initialize`, etc)!
  116. !HLGenerateCommand class methodsFor: 'accessing'!
  117. key
  118. ^ 'h'
  119. !
  120. label
  121. ^ 'Generate'
  122. ! !
  123. HLGenerateCommand subclass: #HLCategorizeUnclassifiedCommand
  124. instanceVariableNames: ''
  125. package: 'Helios-Commands-Browser'!
  126. !HLCategorizeUnclassifiedCommand commentStamp!
  127. I am the command used to categorize unclassified methods!
  128. !HLCategorizeUnclassifiedCommand methodsFor: 'executing'!
  129. execute
  130. | targetClass unclassified |
  131. targetClass := self model selectedClass.
  132. unclassified := targetClass methods select:[ :e | e protocol = 'as yet unclassified' ].
  133. HLMethodClassifier new
  134. classifyAll: unclassified
  135. ! !
  136. !HLCategorizeUnclassifiedCommand class methodsFor: 'accessing'!
  137. key
  138. ^ 'c'
  139. !
  140. label
  141. ^ 'Categorize'
  142. ! !
  143. HLGenerateCommand subclass: #HLGenerateAccessorsCommand
  144. instanceVariableNames: ''
  145. package: 'Helios-Commands-Browser'!
  146. !HLGenerateAccessorsCommand commentStamp!
  147. I am the command used to generate the `getter` and the `setter` methods depending of the selected class!
  148. !HLGenerateAccessorsCommand methodsFor: 'executing'!
  149. execute
  150. | targetClass output first |
  151. targetClass := self model selectedClass.
  152. output := HLInitializeGenerator new
  153. class: targetClass;
  154. generate;
  155. output.
  156. output compile.
  157. first := output sourceCodes first.
  158. self model
  159. selectedProtocol: output protocol;
  160. selectedMethod:(targetClass>>first selector);
  161. focusOnSourceCode
  162. ! !
  163. !HLGenerateAccessorsCommand class methodsFor: 'accessing'!
  164. key
  165. ^ 'i'
  166. !
  167. label
  168. ^ 'Initialize'
  169. ! !
  170. HLGenerateCommand subclass: #HLGenerateInitializeCommand
  171. instanceVariableNames: ''
  172. package: 'Helios-Commands-Browser'!
  173. !HLGenerateInitializeCommand commentStamp!
  174. I am the command used to generate the `initialize` method depending of the selected class!
  175. !HLGenerateInitializeCommand methodsFor: 'executing'!
  176. execute
  177. | targetClass output |
  178. targetClass := self model selectedClass.
  179. output := HLAccessorsGenerator new
  180. class: targetClass;
  181. generate;
  182. output.
  183. output compile.
  184. self model selectedProtocol: output protocol
  185. ! !
  186. !HLGenerateInitializeCommand class methodsFor: 'accessing'!
  187. key
  188. ^ 'a'
  189. !
  190. label
  191. ^ 'Accessors'
  192. ! !
  193. HLBrowserCommand subclass: #HLToggleCommand
  194. instanceVariableNames: ''
  195. package: 'Helios-Commands-Browser'!
  196. !HLToggleCommand class methodsFor: 'accessing'!
  197. key
  198. ^ 't'
  199. !
  200. label
  201. ^ 'Toggle'
  202. ! !
  203. HLToggleCommand subclass: #HLToggleClassCommentCommand
  204. instanceVariableNames: ''
  205. package: 'Helios-Commands-Browser'!
  206. !HLToggleClassCommentCommand methodsFor: 'executing'!
  207. execute
  208. self model showComment: self model showComment not
  209. ! !
  210. !HLToggleClassCommentCommand class methodsFor: 'accessing'!
  211. key
  212. ^ 'd'
  213. !
  214. label
  215. ^ 'Documentation'
  216. ! !
  217. HLToggleCommand subclass: #HLToggleClassSideCommand
  218. instanceVariableNames: ''
  219. package: 'Helios-Commands-Browser'!
  220. !HLToggleClassSideCommand methodsFor: 'executing'!
  221. execute
  222. self model showInstance: false
  223. ! !
  224. !HLToggleClassSideCommand class methodsFor: 'accessing'!
  225. key
  226. ^ 'c'
  227. !
  228. label
  229. ^ 'Class side'
  230. ! !
  231. HLToggleCommand subclass: #HLToggleInstanceSideCommand
  232. instanceVariableNames: ''
  233. package: 'Helios-Commands-Browser'!
  234. !HLToggleInstanceSideCommand methodsFor: 'executing'!
  235. execute
  236. self model showInstance: true
  237. ! !
  238. !HLToggleInstanceSideCommand class methodsFor: 'accessing'!
  239. key
  240. ^ 'i'
  241. !
  242. label
  243. ^ 'Instance side'
  244. ! !