Helios-Commands-Browser.st 5.7 KB

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