Helios-Commands-Tools.st 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. Smalltalk current createPackage: 'Helios-Commands-Tools'!
  2. HLModelCommand subclass: #HLToolCommand
  3. instanceVariableNames: ''
  4. package: 'Helios-Commands-Tools'!
  5. !HLToolCommand methodsFor: 'accessing'!
  6. category
  7. ^ nil
  8. ! !
  9. !HLToolCommand class methodsFor: 'instance creation'!
  10. for: aToolModel
  11. ^ self new
  12. model: aToolModel;
  13. yourself
  14. ! !
  15. !HLToolCommand class methodsFor: 'testing'!
  16. isValidFor: aModel
  17. ^ aModel isToolModel
  18. ! !
  19. HLToolCommand subclass: #HLCommitPackageCommand
  20. instanceVariableNames: ''
  21. package: 'Helios-Commands-Tools'!
  22. !HLCommitPackageCommand methodsFor: 'accessing'!
  23. category
  24. ^ 'Packages'
  25. ! !
  26. !HLCommitPackageCommand methodsFor: 'executing'!
  27. execute
  28. self model commitPackage
  29. ! !
  30. !HLCommitPackageCommand methodsFor: 'testing'!
  31. isActive
  32. ^ true
  33. " slf model isPackageDirty"
  34. ! !
  35. !HLCommitPackageCommand class methodsFor: 'accessing'!
  36. key
  37. ^ 'k'
  38. !
  39. label
  40. ^ 'Commit'
  41. ! !
  42. HLToolCommand subclass: #HLCopyCommand
  43. instanceVariableNames: ''
  44. package: 'Helios-Commands-Tools'!
  45. !HLCopyCommand class methodsFor: 'accessing'!
  46. key
  47. ^ 'c'
  48. !
  49. label
  50. ^ 'Copy'
  51. ! !
  52. HLCopyCommand subclass: #HLCopyClassCommand
  53. instanceVariableNames: ''
  54. package: 'Helios-Commands-Tools'!
  55. !HLCopyClassCommand methodsFor: 'accessing'!
  56. category
  57. ^ 'Classes'
  58. !
  59. displayLabel
  60. ^ 'New class name:'
  61. ! !
  62. !HLCopyClassCommand methodsFor: 'defaults'!
  63. defaultInput
  64. ^ self model selectedClass name
  65. ! !
  66. !HLCopyClassCommand methodsFor: 'executing'!
  67. execute
  68. self model copyClassTo: self input
  69. ! !
  70. !HLCopyClassCommand methodsFor: 'testing'!
  71. isActive
  72. ^ self model selectedClass notNil
  73. !
  74. isInputRequired
  75. ^ true
  76. ! !
  77. !HLCopyClassCommand class methodsFor: 'accessing'!
  78. key
  79. ^ 'c'
  80. !
  81. label
  82. ^ 'Class'
  83. !
  84. menuLabel
  85. ^ 'Copy class...'
  86. ! !
  87. HLToolCommand subclass: #HLFindCommand
  88. instanceVariableNames: ''
  89. package: 'Helios-Commands-Tools'!
  90. !HLFindCommand class methodsFor: 'accessing'!
  91. key
  92. ^ 'f'
  93. !
  94. label
  95. ^ 'Find'
  96. ! !
  97. HLFindCommand subclass: #HLFindClassCommand
  98. instanceVariableNames: ''
  99. package: 'Helios-Commands-Tools'!
  100. !HLFindClassCommand methodsFor: 'accessing'!
  101. displayLabel
  102. ^ 'select a class'
  103. !
  104. inputCompletion
  105. ^ self model availableClassNames
  106. !
  107. inputLabel
  108. ^ 'Find a class'
  109. ! !
  110. !HLFindClassCommand methodsFor: 'executing'!
  111. execute
  112. self model openClassNamed: self input
  113. ! !
  114. !HLFindClassCommand methodsFor: 'testing'!
  115. isInputRequired
  116. ^ true
  117. ! !
  118. !HLFindClassCommand class methodsFor: 'accessing'!
  119. key
  120. ^ 'c'
  121. !
  122. label
  123. ^ 'Class'
  124. ! !
  125. !HLFindClassCommand class methodsFor: 'testing'!
  126. isValidFor: aModel
  127. ^ aModel isBrowserModel
  128. ! !
  129. HLFindCommand subclass: #HLFindReferencesCommand
  130. instanceVariableNames: ''
  131. package: 'Helios-Commands-Tools'!
  132. !HLFindReferencesCommand methodsFor: 'accessing'!
  133. displayLabel
  134. ^ 'find references'
  135. !
  136. inputCompletion
  137. ^ self model availableClassNames, self model allSelectors
  138. !
  139. inputLabel
  140. ^ 'Find references of'
  141. ! !
  142. !HLFindReferencesCommand methodsFor: 'defaults'!
  143. defaultInput
  144. ^ self model selectedMethod
  145. ifNil: [
  146. self model selectedClass
  147. ifNil: [ '' ]
  148. ifNotNil: [ :class | class name ] ]
  149. ifNotNil: [ :method | method selector ]
  150. ! !
  151. !HLFindReferencesCommand methodsFor: 'executing'!
  152. execute
  153. HLReferences new
  154. openAsTab;
  155. search: self input
  156. ! !
  157. !HLFindReferencesCommand methodsFor: 'testing'!
  158. isInputRequired
  159. ^ true
  160. ! !
  161. !HLFindReferencesCommand class methodsFor: 'accessing'!
  162. key
  163. ^ 'r'
  164. !
  165. label
  166. ^ 'References'
  167. ! !
  168. HLToolCommand subclass: #HLMoveToCommand
  169. instanceVariableNames: ''
  170. package: 'Helios-Commands-Tools'!
  171. !HLMoveToCommand class methodsFor: 'accessing'!
  172. key
  173. ^ 'm'
  174. !
  175. label
  176. ^ 'Move'
  177. ! !
  178. HLMoveToCommand subclass: #HLMoveClassToCommand
  179. instanceVariableNames: ''
  180. package: 'Helios-Commands-Tools'!
  181. !HLMoveClassToCommand methodsFor: 'testing'!
  182. isActive
  183. ^ self model selectedClass notNil
  184. ! !
  185. !HLMoveClassToCommand class methodsFor: 'accessing'!
  186. key
  187. ^ 'c'
  188. !
  189. label
  190. ^ 'Class'
  191. ! !
  192. HLMoveClassToCommand subclass: #HLMoveClassToPackageCommand
  193. instanceVariableNames: ''
  194. package: 'Helios-Commands-Tools'!
  195. !HLMoveClassToPackageCommand methodsFor: 'accessing'!
  196. category
  197. ^ 'Classes'
  198. !
  199. displayLabel
  200. ^ 'select a package'
  201. !
  202. inputCompletion
  203. ^ self model availablePackageNames
  204. !
  205. inputLabel
  206. ^ 'Move class to package:'
  207. ! !
  208. !HLMoveClassToPackageCommand methodsFor: 'executing'!
  209. execute
  210. self model moveClassToPackage: self input
  211. ! !
  212. !HLMoveClassToPackageCommand methodsFor: 'testing'!
  213. isInputRequired
  214. ^ true
  215. ! !
  216. !HLMoveClassToPackageCommand class methodsFor: 'accessing'!
  217. key
  218. ^ 'p'
  219. !
  220. label
  221. ^ 'to package'
  222. !
  223. menuLabel
  224. ^ 'Move to package...'
  225. ! !
  226. HLMoveToCommand subclass: #HLMoveMethodToCommand
  227. instanceVariableNames: ''
  228. package: 'Helios-Commands-Tools'!
  229. !HLMoveMethodToCommand methodsFor: 'accessing'!
  230. category
  231. ^ 'Methods'
  232. ! !
  233. !HLMoveMethodToCommand methodsFor: 'testing'!
  234. isActive
  235. ^ self model selectedMethod notNil
  236. ! !
  237. !HLMoveMethodToCommand class methodsFor: 'accessing'!
  238. key
  239. ^ 'm'
  240. !
  241. label
  242. ^ 'Method'
  243. ! !
  244. HLMoveMethodToCommand subclass: #HLMoveMethodToClassCommand
  245. instanceVariableNames: ''
  246. package: 'Helios-Commands-Tools'!
  247. !HLMoveMethodToClassCommand methodsFor: 'accessing'!
  248. displayLabel
  249. ^ 'select a class'
  250. !
  251. inputCompletion
  252. ^ self model availableClassNames
  253. !
  254. inputLabel
  255. ^ 'Move method to class:'
  256. ! !
  257. !HLMoveMethodToClassCommand methodsFor: 'executing'!
  258. execute
  259. self model moveMethodToClass: self input
  260. ! !
  261. !HLMoveMethodToClassCommand methodsFor: 'testing'!
  262. isInputRequired
  263. ^ true
  264. ! !
  265. !HLMoveMethodToClassCommand class methodsFor: 'accessing'!
  266. key
  267. ^ 'c'
  268. !
  269. label
  270. ^ 'to class'
  271. !
  272. menuLabel
  273. ^ 'Move to class...'
  274. ! !
  275. HLMoveMethodToCommand subclass: #HLMoveMethodToProtocolCommand
  276. instanceVariableNames: ''
  277. package: 'Helios-Commands-Tools'!
  278. !HLMoveMethodToProtocolCommand methodsFor: 'accessing'!
  279. displayLabel
  280. ^ 'select a protocol'
  281. !
  282. inputCompletion
  283. ^ self model availableProtocols
  284. !
  285. inputLabel
  286. ^ 'Move method to a protocol:'
  287. ! !
  288. !HLMoveMethodToProtocolCommand methodsFor: 'executing'!
  289. execute
  290. self model moveMethodToProtocol: self input
  291. ! !
  292. !HLMoveMethodToProtocolCommand methodsFor: 'testing'!
  293. isInputRequired
  294. ^ true
  295. ! !
  296. !HLMoveMethodToProtocolCommand class methodsFor: 'accessing'!
  297. key
  298. ^ 't'
  299. !
  300. label
  301. ^ 'to protocol'
  302. !
  303. menuLabel
  304. ^ 'Move to protocol...'
  305. ! !
  306. HLToolCommand subclass: #HLRemoveCommand
  307. instanceVariableNames: ''
  308. package: 'Helios-Commands-Tools'!
  309. !HLRemoveCommand class methodsFor: 'accessing'!
  310. key
  311. ^ 'x'
  312. !
  313. label
  314. ^ 'Remove'
  315. ! !
  316. HLRemoveCommand subclass: #HLRemoveClassCommand
  317. instanceVariableNames: ''
  318. package: 'Helios-Commands-Tools'!
  319. !HLRemoveClassCommand methodsFor: 'accessing'!
  320. category
  321. ^ 'Classes'
  322. ! !
  323. !HLRemoveClassCommand methodsFor: 'executing'!
  324. execute
  325. self model removeClass
  326. ! !
  327. !HLRemoveClassCommand methodsFor: 'testing'!
  328. isActive
  329. ^ self model selectedClass notNil
  330. ! !
  331. !HLRemoveClassCommand class methodsFor: 'accessing'!
  332. key
  333. ^ 'c'
  334. !
  335. label
  336. ^ 'Class'
  337. !
  338. menuLabel
  339. ^ 'Remove class'
  340. ! !
  341. HLRemoveCommand subclass: #HLRemoveMethodCommand
  342. instanceVariableNames: ''
  343. package: 'Helios-Commands-Tools'!
  344. !HLRemoveMethodCommand methodsFor: 'accessing'!
  345. category
  346. ^ 'Methods'
  347. ! !
  348. !HLRemoveMethodCommand methodsFor: 'executing'!
  349. execute
  350. self model removeMethod
  351. ! !
  352. !HLRemoveMethodCommand methodsFor: 'testing'!
  353. isActive
  354. ^ self model selectedMethod notNil
  355. ! !
  356. !HLRemoveMethodCommand class methodsFor: 'accessing'!
  357. key
  358. ^ 'm'
  359. !
  360. label
  361. ^ 'Method'
  362. !
  363. menuLabel
  364. ^ 'Remove method'
  365. ! !
  366. HLRemoveCommand subclass: #HLRemoveProtocolCommand
  367. instanceVariableNames: ''
  368. package: 'Helios-Commands-Tools'!
  369. !HLRemoveProtocolCommand methodsFor: 'accessing'!
  370. category
  371. ^ 'Protocols'
  372. ! !
  373. !HLRemoveProtocolCommand methodsFor: 'executing'!
  374. execute
  375. self model removeProtocol
  376. ! !
  377. !HLRemoveProtocolCommand methodsFor: 'testing'!
  378. isActive
  379. ^ self model selectedProtocol notNil
  380. ! !
  381. !HLRemoveProtocolCommand class methodsFor: 'accessing'!
  382. key
  383. ^ 't'
  384. !
  385. label
  386. ^ 'Protocol'
  387. !
  388. menuLabel
  389. ^ 'Remove protocol'
  390. ! !
  391. HLToolCommand subclass: #HLRenameCommand
  392. instanceVariableNames: ''
  393. package: 'Helios-Commands-Tools'!
  394. !HLRenameCommand class methodsFor: 'accessing'!
  395. key
  396. ^ 'r'
  397. !
  398. label
  399. ^ 'Rename'
  400. ! !
  401. HLRenameCommand subclass: #HLRenameClassCommand
  402. instanceVariableNames: ''
  403. package: 'Helios-Commands-Tools'!
  404. !HLRenameClassCommand methodsFor: 'accessing'!
  405. category
  406. ^ 'Classes'
  407. !
  408. displayLabel
  409. ^ 'Rename class to:'
  410. ! !
  411. !HLRenameClassCommand methodsFor: 'defaults'!
  412. defaultInput
  413. ^ self model selectedClass theNonMetaClass name
  414. ! !
  415. !HLRenameClassCommand methodsFor: 'executing'!
  416. execute
  417. self model renameClassTo: self input
  418. ! !
  419. !HLRenameClassCommand methodsFor: 'testing'!
  420. isActive
  421. ^ self model selectedClass notNil
  422. !
  423. isInputRequired
  424. ^ true
  425. ! !
  426. !HLRenameClassCommand class methodsFor: 'accessing'!
  427. key
  428. ^ 'c'
  429. !
  430. label
  431. ^ 'Class'
  432. !
  433. menuLabel
  434. ^ 'Rename class...'
  435. ! !
  436. HLRenameCommand subclass: #HLRenameProtocolCommand
  437. instanceVariableNames: ''
  438. package: 'Helios-Commands-Tools'!
  439. !HLRenameProtocolCommand methodsFor: 'accessing'!
  440. category
  441. ^ 'Protocols'
  442. !
  443. displayLabel
  444. ^ 'Rename protocol to:'
  445. ! !
  446. !HLRenameProtocolCommand methodsFor: 'defaults'!
  447. defaultInput
  448. ^ self model selectedProtocol
  449. ! !
  450. !HLRenameProtocolCommand methodsFor: 'executing'!
  451. execute
  452. self model renameProtocolTo: self input
  453. ! !
  454. !HLRenameProtocolCommand methodsFor: 'testing'!
  455. isActive
  456. ^ self model selectedProtocol notNil
  457. !
  458. isInputRequired
  459. ^ true
  460. ! !
  461. !HLRenameProtocolCommand class methodsFor: 'accessing'!
  462. key
  463. ^ 't'
  464. !
  465. label
  466. ^ 'Protocol'
  467. !
  468. menuLabel
  469. ^ 'Rename protocol...'
  470. ! !