Helios-Commands-Tools.st 9.8 KB

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