Skip to content

Commit

Permalink
Merge pull request #179 from npasserini/Fixing-shortcuts
Browse files Browse the repository at this point in the history
Changing the selectionAction and selectionCondition to use enabledCon…
  • Loading branch information
npasserini authored Oct 13, 2016
2 parents 1d2357f + ec8aa89 commit f15a17f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ selectionAction: actionSelector
"action selector will be sent to the presentation selection.
If it accepts one argument, the presentation will be sent."

^ self action: [ :presentation |
(MessageSend
receiver: presentation selection
selector: actionSelector)
cull: presentation ];
condition: [ :presentation |
"This is a minimal condition, that can be overriden (refined) later"
presentation selection notNil ].
^ self
action: [ :presentation |
presentation selection
ifNotNil: [ :sel | (MessageSend receiver: sel selector: actionSelector) cull: presentation ] ];
enabledCondition:
[ :presentation | "This is a minimal condition, that can be overriden (refined) later" presentation selection notNil ]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ selectionCondition: selectionCondition
"selectionCondition can be anything that can respond #cull: such as a block or unary symbol.
It will only be evaluated if the presentation has a (not nil) selected element."

^ self condition: [ :presentation |
^ self enabledCondition: [ :presentation |
presentation selection notNil and: [
selectionCondition cull: presentation selection ]]

0 comments on commit f15a17f

Please sign in to comment.