Helios-Commands-Core.st 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. Smalltalk current createPackage: 'Helios-Commands-Core'!
  2. Object subclass: #HLCommand
  3. instanceVariableNames: 'input'
  4. package: 'Helios-Commands-Core'!
  5. !HLCommand methodsFor: 'accessing'!
  6. documentation
  7. ^ self class documentation
  8. !
  9. input
  10. ^ input
  11. !
  12. input: aString
  13. ^ input := aString
  14. !
  15. inputCompletion
  16. ^ #()
  17. !
  18. inputLabel
  19. ^ self label
  20. !
  21. key
  22. ^ self class key
  23. !
  24. label
  25. ^ self class label
  26. ! !
  27. !HLCommand methodsFor: 'converting'!
  28. asActionBinding
  29. ^ (HLBindingAction on: self key labelled: self label)
  30. command: self;
  31. yourself
  32. !
  33. asBinding
  34. ^ self isBindingGroup
  35. ifTrue: [ self asGroupBinding ]
  36. ifFalse: [ self asActionBinding ]
  37. !
  38. asGroupBinding
  39. ^ HLBindingGroup
  40. on: self key
  41. labelled: self label
  42. ! !
  43. !HLCommand methodsFor: 'error handling'!
  44. commandError: aString
  45. self error: aString
  46. ! !
  47. !HLCommand methodsFor: 'executing'!
  48. execute
  49. ! !
  50. !HLCommand methodsFor: 'registration'!
  51. registerOn: aBinding
  52. ^ aBinding add: self asBinding
  53. ! !
  54. !HLCommand methodsFor: 'testing'!
  55. isActive
  56. ^ true
  57. !
  58. isBindingGroup
  59. ^ (self class methodDictionary includesKey: 'execute') not
  60. !
  61. isInputRequired
  62. ^ false
  63. ! !
  64. !HLCommand class methodsFor: 'accessing'!
  65. documentation
  66. ^ ''
  67. !
  68. key
  69. ^ nil
  70. !
  71. label
  72. ^ ''
  73. ! !
  74. !HLCommand class methodsFor: 'registration'!
  75. registerConcreteClassesOn: aBinding
  76. | newBinding |
  77. self isConcrete
  78. ifTrue: [ newBinding := self registerOn: aBinding ]
  79. ifFalse: [ newBinding := aBinding ].
  80. self subclasses do: [ :each | each registerConcreteClassesOn: newBinding ]
  81. !
  82. registerOn: aBinding
  83. ^ self new registerOn: aBinding
  84. ! !
  85. !HLCommand class methodsFor: 'testing'!
  86. isConcrete
  87. ^ self key notNil
  88. ! !
  89. HLCommand subclass: #HLCloseTabCommand
  90. instanceVariableNames: ''
  91. package: 'Helios-Commands-Core'!
  92. !HLCloseTabCommand methodsFor: 'executing'!
  93. execute
  94. HLManager current removeActiveTab
  95. ! !
  96. !HLCloseTabCommand class methodsFor: 'accessing'!
  97. key
  98. ^ 87
  99. !
  100. label
  101. ^ 'Close tab'
  102. ! !
  103. HLCommand subclass: #HLModelCommand
  104. instanceVariableNames: 'model'
  105. package: 'Helios-Commands-Core'!
  106. !HLModelCommand methodsFor: 'accessing'!
  107. model
  108. ^ model
  109. !
  110. model: aModel
  111. model := aModel
  112. ! !
  113. !HLModelCommand class methodsFor: 'instance creation'!
  114. for: aModel
  115. ^ self new
  116. ! !
  117. !HLModelCommand class methodsFor: 'registration'!
  118. registerConcreteClassesOn: aBinding for: aModel
  119. | newBinding |
  120. self isConcrete
  121. ifTrue: [ newBinding := self registerOn: aBinding for: aModel ]
  122. ifFalse: [ newBinding := aBinding ].
  123. self subclasses do: [ :each |
  124. each registerConcreteClassesOn: newBinding for: aModel ]
  125. !
  126. registerOn: aBinding for: aModel
  127. ^ (self for: aModel) registerOn: aBinding
  128. ! !
  129. HLCommand subclass: #HLOpenCommand
  130. instanceVariableNames: ''
  131. package: 'Helios-Commands-Core'!
  132. !HLOpenCommand class methodsFor: 'accessing'!
  133. key
  134. ^ 79
  135. !
  136. label
  137. ^ 'Open'
  138. ! !
  139. HLOpenCommand subclass: #HLOpenBrowserCommand
  140. instanceVariableNames: ''
  141. package: 'Helios-Commands-Core'!
  142. !HLOpenBrowserCommand methodsFor: 'executing'!
  143. execute
  144. ^ HLBrowser openAsTab
  145. ! !
  146. !HLOpenBrowserCommand class methodsFor: 'accessing'!
  147. key
  148. ^ 66
  149. !
  150. label
  151. ^ 'Browser'
  152. ! !
  153. HLOpenCommand subclass: #HLOpenTranscriptCommand
  154. instanceVariableNames: ''
  155. package: 'Helios-Commands-Core'!
  156. !HLOpenTranscriptCommand methodsFor: 'executing'!
  157. execute
  158. ^ HLTranscript openAsTab
  159. ! !
  160. !HLOpenTranscriptCommand class methodsFor: 'accessing'!
  161. key
  162. ^ 84
  163. !
  164. label
  165. ^ 'Transcript'
  166. ! !
  167. HLOpenCommand subclass: #HLOpenWorkspaceCommand
  168. instanceVariableNames: ''
  169. package: 'Helios-Commands-Core'!
  170. !HLOpenWorkspaceCommand methodsFor: 'executing'!
  171. execute
  172. ^ HLCodeWidget openAsTab
  173. ! !
  174. !HLOpenWorkspaceCommand class methodsFor: 'accessing'!
  175. key
  176. ^ 87
  177. !
  178. label
  179. ^ 'Workspace'
  180. ! !
  181. HLCommand subclass: #HLViewCommand
  182. instanceVariableNames: ''
  183. package: 'Helios-Commands-Core'!
  184. !HLViewCommand class methodsFor: 'accessing'!
  185. label
  186. ^ 'View'
  187. ! !