public sealed class EditorCommandSomething the editor can be asked to do, named by an id.
Remarks
Every action in the editor is one of these, and that is the whole architecture. Menus, toolbars, context menus and the command palette are views over the registry rather than four places that each know how to save a file — so an action added once appears everywhere it belongs, gets a keybinding, gets a place in the palette, and gets its enablement from one predicate instead of four copies that drift.
⚠ Enablement is a predicate rather than a flag. A flag has to be pushed at every menu, every toolbar and the palette whenever the world changes, which means a menu that is right only if somebody remembered to invalidate it. Asked on demand — a menu asks as it opens, a toolbar as the shell ticks — it cannot be stale. The cost is that the predicate runs often, so it has to be cheap: stack.CanUndo, not a directory scan.
A command carries no keybinding. That lives in KeyMap, because a binding is the user's and a command is the application's — putting the chord here would mean a remapped shortcut edited the command table, and a plugin's command would arrive with a chord it has no right to claim.
Fields and properties (17)
public string IdWhat everything refers to it by.
public StringId TitleWhat it is called on screen.
public Func<StringId>? CaptionWhat it is called right now, when that depends on state.
public StringId CurrentTitleWhat a menu line or a toolbar button should say for it now.
public StringId CategoryWhere the palette files it, and what a menu would group it under.
public string? ContextWhich focus context it belongs to, or null for "anywhere".
public string? RadioGroupWhich set of mutually-exclusive choices it is one of, or null.
public PathBuilder? IconThe icon a toolbar draws for it, if it has one.
public IconArt? ArtColoured art for it, drawn with its title underneath.
public string? ClassNameA style class every view puts on the control it makes for this command.
public Func<bool>? EnablementWhether it can be run right now, or null for "always".
public StringId UnavailableWhy it cannot be run at all yet, or the default for one that can.
public bool IsUnavailableWhether it is declared but not built yet.
public Func<bool>? CheckedWhether it is a toggle that is currently on, or null if it is not a toggle.
public bool IsHiddenFromPaletteWhether it is hidden from the palette.
public bool CanExecuteWhether it can be run right now.
public bool IsCheckedWhether it is a toggle that is on.
Methods (2)
public EditorCommand(string id, StringId title, Action run)Creates a command.
public override string ToString()Returns a string that represents the current object.
Used by (39)
- BlockoutModeVixen.Editor.Blockout
- BlockoutModeTestsVixen.Editor.Blockout.Tests
- BuildSettingsTestsVixen.Editor.App.Tests
- ChromeFixtureVixen.Editor.Ui.Tests
- CommandDispatcherVixen.Editor.Ui
- CommandPaletteSourceVixen.Editor.Ui
- CommandRegistryVixen.Editor.Ui
- CommandTestsVixen.Editor.Ui.Tests
- ConsolePanelTestsVixen.Editor.App.Tests
- DiagnosticsPanelTestsVixen.Editor.App.Tests
- EditorAffordanceTestsVixen.Editor.App.Tests
- EditorApplicationVixen.Editor.App
- EditorModesVixen.Editor.Ui
- EditorScriptTestsVixen.Editor.Scripts.Tests
- EditorSessionVixen.Editor.Testing
- EditorShellVixen.Editor.Ui
- EditorShellTestsVixen.Editor.Ui.Tests
- FoliageModeVixen.Editor.Terrain
- FoliageModeTestsVixen.Editor.Terrain.Tests
- KeyBindingsViewVixen.Editor.Ui
- LoadingTestsVixen.Editor.Plugin.Tests
- MenuBarTestsVixen.Editor.App.Tests
- MenuPresenterVixen.Editor.Ui
- MenuTestsVixen.Editor.Ui.Tests
- MilestoneE3TestsVixen.Editor.App.Tests
- ModeStripTestsVixen.Editor.Ui.Tests
- ModeTestsVixen.Editor.Ui.Tests
- PaletteTestsVixen.Editor.Ui.Tests
- PluginContextVixen.Editor.Plugin
- SceneMenuTestsVixen.Editor.App.Tests
- ScopeTestsVixen.Editor.Ui.Tests
- SettingsWindowTestsVixen.Editor.App.Tests
- SnapCommandTestsVixen.Editor.App.Tests
- TerrainModeVixen.Editor.Terrain
- TerrainModeTestsVixen.Editor.Terrain.Tests
- ToolbarPresenterVixen.Editor.Ui
- ToolbarSectionTestsVixen.Editor.Ui.Tests
- TransportTestsVixen.Editor.App.Tests
- ViewportTestsVixen.Editor.App.Tests