Vixen
02b45cc4
csharp
public sealed class CommandRegistry

Every command the editor knows, by id.

Read the guide page for this →

Remarks

One table, and everything that shows a command reads it. That is what makes a new action appear in the menu, the palette and the keymap editor at once, and it is why a plugin adding a command is one Add call rather than an entry in four places.

⚠ Registering an id twice throws. A silent replace would let a plugin take over file.save by naming it, and a silent ignore would leave the plugin's own command quietly dead — both of which are found weeks later. The loader catches this and reports which plugin collided with what.

Insertion order is kept, because it is the order a palette shows commands in when the query is empty and there is nothing better to sort by. A ranked query reorders it.

Fields and properties (3)

  • public IReadOnlyList<EditorCommand> Commands

    The commands, in the order they were registered.

  • public Func<string?>? FocusedContext

    Which context has the focus, asked whenever a scoped command is looked at.

  • public EditorCommand? this[string id]

    The command with an id, or null.

Events (2)

  • public Action<CommandRegistry>? Changed

    Raised when a command is added or removed.

  • public Action<EditorCommand>? Executed

    Raised after a command runs, whatever ran it.

Methods (8)

  • public bool IsInScope(EditorCommand command)

    Whether a command belongs to the context the user is in.

  • public EditorCommand Add(EditorCommand command)

    Adds a command.

  • public EditorCommand Add(string id, StringId title, Action run)

    Adds a command built from its parts.

  • public bool Remove(string id)

    Takes a command out.

  • public bool TryGet(string id, out EditorCommand? command)

    Looks a command up.

  • public bool CanExecute(string id)

    Whether a command exists and can run right now.

  • public bool CanExecute(EditorCommand command)

    Whether a command is in scope and enabled.

  • public bool Execute(string id)

    Runs a command.

Used by (47, showing 40)

  • BlockoutModeVixen.Editor.Blockout
  • BlockoutModeTestsVixen.Editor.Blockout.Tests
  • BlockoutSelectionTestsVixen.Editor.Blockout.Tests
  • ChromeFixtureVixen.Editor.Ui.Tests
  • CommandDispatcherVixen.Editor.Ui
  • CommandPaletteSourceVixen.Editor.Ui
  • CommandTestsVixen.Editor.Ui.Tests
  • ConsolePanelTestsVixen.Editor.App.Tests
  • CreateMenuTestsVixen.Editor.App.Tests
  • DiagnosticsPanelTestsVixen.Editor.App.Tests
  • EditorAffordanceTestsVixen.Editor.App.Tests
  • EditorApplicationVixen.Editor.App
  • EditorHostVixen.Editor.Host
  • EditorModeTestsVixen.Editor.App.Tests
  • EditorModesVixen.Editor.Ui
  • EditorScriptTestsVixen.Editor.Scripts.Tests
  • EditorSessionVixen.Editor.Testing
  • EditorShellVixen.Editor.Ui
  • EditorShellTestsVixen.Editor.Ui.Tests
  • FoliageModeVixen.Editor.Terrain
  • FoliageModeTestsVixen.Editor.Terrain.Tests
  • KeyBindingsPanelTestsVixen.Editor.App.Tests
  • KeyBindingsViewVixen.Editor.Ui
  • LoadingTestsVixen.Editor.Plugin.Tests
  • MenuBarTestsVixen.Editor.App.Tests
  • MenuPresenterVixen.Editor.Ui
  • MenuTestsVixen.Editor.Ui.Tests
  • MilestoneE3TestsVixen.Editor.App.Tests
  • ModeTestsVixen.Editor.Ui.Tests
  • OutlinerTestsVixen.Editor.App.Tests
  • PaletteTestsVixen.Editor.Ui.Tests
  • PanelBehaviourTestsVixen.Editor.App.Tests
  • PlatformKeyTestsVixen.Editor.Ui.Tests
  • PluginContextVixen.Editor.Plugin
  • SceneMenuTestsVixen.Editor.App.Tests
  • ScopeTestsVixen.Editor.Ui.Tests
  • SculptSessionTestsVixen.Editor.Terrain.Tests
  • SwitchingTestsVixen.Editor.Plugin.Tests
  • TerrainModeVixen.Editor.Terrain
  • TerrainModeTestsVixen.Editor.Terrain.Tests