Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CommandRegistry

The command registry manages commands and handlers.

Hierarchy

  • CommandRegistry

Implements

Index

Constructors

constructor

Properties

Protected Readonly _commands

_commands: {}

Type declaration

Protected Readonly _handlers

_handlers: {}

Type declaration

Protected _recent

_recent: Command[] = []

Protected Readonly contributionProvider

Readonly onDidExecuteCommand

onDidExecuteCommand: Event<CommandEvent> = this.onDidExecuteCommandEmitter.event

Protected Readonly onDidExecuteCommandEmitter

onDidExecuteCommandEmitter: Emitter<CommandEvent> = new Emitter<CommandEvent>()

Readonly onWillExecuteCommand

onWillExecuteCommand: Event<WillExecuteCommandEvent> = this.onWillExecuteCommandEmitter.event

Protected Readonly onWillExecuteCommandEmitter

onWillExecuteCommandEmitter: Emitter<WillExecuteCommandEvent> = new Emitter<WillExecuteCommandEvent>()

Protected Readonly toUnregisterCommands

toUnregisterCommands: Map<string, Disposable> = new Map<string, Disposable>()

Accessors

commandIds

  • get commandIds(): string[]

commands

recent

Methods

addRecentCommand

clearCommandHistory

  • clearCommandHistory(): void

Protected doRegisterCommand

executeCommand

  • executeCommand<T>(commandId: string, ...args: any[]): Promise<T | undefined>

Protected fireWillExecuteCommand

  • fireWillExecuteCommand(commandId: string, args?: any[]): Promise<void>

getActiveHandler

  • getActiveHandler(commandId: string, ...args: any[]): CommandHandler | undefined

getAllHandlers

getCommand

  • getCommand(id: string): Command | undefined

getToggledHandler

  • getToggledHandler(commandId: string, ...args: any[]): CommandHandler | undefined

getVisibleHandler

  • getVisibleHandler(commandId: string, ...args: any[]): CommandHandler | undefined

isEnabled

  • isEnabled(command: string, ...args: any[]): boolean

isToggled

  • isToggled(command: string, ...args: any[]): boolean

isVisible

  • isVisible(command: string, ...args: any[]): boolean

onStart

  • onStart(): void

registerCommand

registerHandler

  • Register the given handler for the given command identifier.

    If there is already a handler for the given command then the given handler is registered as more specific, and has higher priority during enablement, visibility and toggle state evaluations.

    Parameters

    Returns Disposable

unregisterCommand

  • unregisterCommand(command: Command): void
  • unregisterCommand(id: string): void