| 256 | } |
| 257 | |
| 258 | func (a *Action) SetEnabledCondition(c Condition) { |
| 259 | if a.enabledCondition != nil { |
| 260 | a.enabledCondition.Changed().Detach(a.enabledConditionChangedHandle) |
| 261 | } |
| 262 | |
| 263 | a.enabledCondition = c |
| 264 | |
| 265 | if c != nil { |
| 266 | a.enabled = c.Satisfied() |
| 267 | |
| 268 | a.enabledConditionChangedHandle = c.Changed().Attach(func() { |
| 269 | if a.enabled != c.Satisfied() { |
| 270 | a.enabled = !a.enabled |
| 271 | |
| 272 | a.raiseChanged() |
| 273 | } |
| 274 | }) |
| 275 | } |
| 276 | |
| 277 | a.raiseChanged() |
| 278 | } |
| 279 | |
| 280 | func (a *Action) Exclusive() bool { |
| 281 | return a.exclusive |