public static class CommandRouteWhere a command id goes: the focus, its ancestors, the root, the document, the application.
Remarks
The responder chain, and it is derived rather than pushed. A menu declares what — an id — and the focus decides who. Two views can each declare a handler for edit.copy without either knowing the other exists, and focusing one or the other is the whole of the wiring.
⚠ The first handler that responds wins, and its canExecute is the only one asked. A second responder further up that would also have handled the id is not consulted — not even to break a tie when the first one says no. Consulting it would make "which handler runs" depend on how many things happen to be listening, which is a behaviour that changes when an unrelated panel is added.
⚠ Nobody responds ⇒ not executable. That is the affordance a hand-written enablement rule cannot express: an application declares a menu of ids and the items grey themselves out wherever nothing in the chain answers, with no rule written anywhere.
The walk is the same one CommandDispatcher.Available already does looking for a TextField — Focused to Parent — so the mechanism is the tree Vixen already owns and there is no selector dispatch and no reflection anywhere in it (ADR-002).
⚠ And it continues past the tree. AppKit's action chain runs first responder → views → window → window controller → delegate → document → NSApp → app delegate, and most of that tail is not views at all. IResponder is that tail: CommandResponder and then ApplicationCommandResponder, asked in that order once the last parent is gone. Every rule above holds across the join — first to answer wins, only that one is asked whether it can, silence means disabled.
Methods (5)
public static UiElement Origin(UiDocument document)Where the walk starts.
public static string? ScopeOf(UiDocument document)The scope the focus is in.
public static CommandHandler? Resolve(UiDocument document, string id)Finds the handler a command id resolves to.
public static bool CanExecute(UiDocument document, string id)Whether a command can run right now.
public static bool Execute(UiDocument document, string id)Runs a command through the route.
Used by (18)
- ShellHelloUi
- ButtonBaseVixen.Ui.Controls
- ClipboardTestsVixen.Ui.Controls.Tests
- CodeEditorClipboardTestsVixen.Ui.Controls.Advanced.Tests
- CommandBindingTestsVixen.Ui.Controls.Tests
- CommandDispatcherVixen.Ui.Controls
- CommandRegistryTestsVixen.Ui.Controls.Tests
- CommandResponderTestsVixen.Ui.Tests
- CommandRouteTestsVixen.Ui.Tests
- DerivedDirtyStateTestsVixen.Ui.Tests
- EditableDocumentTestsVixen.Ui.Tests
- KeyWindowTestsVixen.Ui.Tests
- ResponderChainTestsVixen.Ui.Tests
- SurfaceTestsVixen.Ui.Tests
- UndoCommandsTestsVixen.Ui.Tests
- CommandChainTestsVixen.Editor.Ui.Tests
- EditorApplicationVixen.Editor.App
- ToolbarPresenterVixen.Editor.Ui