2
0

Helios-Commands-Browser.st 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. Smalltalk current 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: #HLGenerateAccessorsCommand
  124. instanceVariableNames: ''
  125. package: 'Helios-Commands-Browser'!
  126. !HLGenerateAccessorsCommand commentStamp!
  127. I am the command used to generate the `getter` and the `setter` methods depending of the selected class!
  128. !HLGenerateAccessorsCommand methodsFor: 'executing'!
  129. execute
  130. | targetClass output first |
  131. targetClass := self model selectedClass.
  132. output := HLInitializeGenerator new
  133. class: targetClass;
  134. generate;
  135. output.
  136. output compile.
  137. first := output sourceCodes first.
  138. self model
  139. selectedProtocol: output protocol;
  140. selectedMethod:(targetClass>>first selector);
  141. focusOnSourceCode
  142. ! !
  143. !HLGenerateAccessorsCommand class methodsFor: 'accessing'!
  144. key
  145. ^ 'i'
  146. !
  147. label
  148. ^ 'Initialize'
  149. ! !
  150. HLGenerateCommand subclass: #HLGenerateInitializeCommand
  151. instanceVariableNames: ''
  152. package: 'Helios-Commands-Browser'!
  153. !HLGenerateInitializeCommand commentStamp!
  154. I am the command used to generate the `initialize` method depending of the selected class!
  155. !HLGenerateInitializeCommand methodsFor: 'executing'!
  156. execute
  157. | targetClass output |
  158. targetClass := self model selectedClass.
  159. output := HLAccessorsGenerator new
  160. class: targetClass;
  161. generate;
  162. output.
  163. output compile.
  164. self model selectedProtocol: output protocol
  165. ! !
  166. !HLGenerateInitializeCommand class methodsFor: 'accessing'!
  167. key
  168. ^ 'a'
  169. !
  170. label
  171. ^ 'Accessors'
  172. ! !
  173. HLBrowserCommand subclass: #HLToggleCommand
  174. instanceVariableNames: ''
  175. package: 'Helios-Commands-Browser'!
  176. !HLToggleCommand class methodsFor: 'accessing'!
  177. key
  178. ^ 't'
  179. !
  180. label
  181. ^ 'Toggle'
  182. ! !
  183. HLToggleCommand subclass: #HLToggleClassCommentCommand
  184. instanceVariableNames: ''
  185. package: 'Helios-Commands-Browser'!
  186. !HLToggleClassCommentCommand methodsFor: 'executing'!
  187. execute
  188. self model showComment: self model showComment not
  189. ! !
  190. !HLToggleClassCommentCommand class methodsFor: 'accessing'!
  191. key
  192. ^ 'd'
  193. !
  194. label
  195. ^ 'Documentation'
  196. ! !
  197. HLToggleCommand subclass: #HLToggleClassSideCommand
  198. instanceVariableNames: ''
  199. package: 'Helios-Commands-Browser'!
  200. !HLToggleClassSideCommand methodsFor: 'executing'!
  201. execute
  202. self model showInstance: false
  203. ! !
  204. !HLToggleClassSideCommand class methodsFor: 'accessing'!
  205. key
  206. ^ 'c'
  207. !
  208. label
  209. ^ 'Class side'
  210. ! !
  211. HLToggleCommand subclass: #HLToggleInstanceSideCommand
  212. instanceVariableNames: ''
  213. package: 'Helios-Commands-Browser'!
  214. !HLToggleInstanceSideCommand methodsFor: 'executing'!
  215. execute
  216. self model showInstance: true
  217. ! !
  218. !HLToggleInstanceSideCommand class methodsFor: 'accessing'!
  219. key
  220. ^ 'i'
  221. !
  222. label
  223. ^ 'Instance side'
  224. ! !