/
CmAbstractCommand.class.st
45 lines (38 loc) · 1.05 KB
/
CmAbstractCommand.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"
I am an abstract class defining the API a command should understand.
See my subclasses for concrete examples.
"
Class {
#name : #CmAbstractCommand,
#superclass : #CmObject,
#category : #'Commander2-Commands'
}
{ #category : #visiting }
CmAbstractCommand >> acceptVisitor: aCmCommandOrGroup [
^ aCmCommandOrGroup visitCommand: self
]
{ #category : #testing }
CmAbstractCommand >> canBeExecuted [
"This hook allows the command decide if it can be run with the context it holds or not.
It should return a boolean.
"
^ self subclassResponsibility
]
{ #category : #accessing }
CmAbstractCommand >> context [
^ self subclassResponsibility
]
{ #category : #accessing }
CmAbstractCommand >> context: anObject [
^ self subclassResponsibility
]
{ #category : #executing }
CmAbstractCommand >> execute [
"Execute the actions that should be done by the command.
This method expect that the context has been put in #context inst. var. if any context is relevant."
self subclassResponsibility
]
{ #category : #testing }
CmAbstractCommand >> isCommand [
^ true
]