Helios-Commands-Core.st 3.8 KB

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