提交 37f6bc48 编写于 作者: J Johannes Rieken

add IKeybindingService#hasCommand, #3676

上级 65e0142d
......@@ -163,6 +163,11 @@ export abstract class AbstractKeybindingService {
this.getContext(this._myContextId).removeValue(key);
}
public hasCommand(commandId: string): boolean {
return !!KeybindingsRegistry.getCommands()[commandId];
}
public abstract executeCommand(commandId: string, args: any): TPromise<any>;
public abstract getLabelFor(keybinding: Keybinding): string;
public abstract getHTMLLabelFor(keybinding: Keybinding): IHTMLContentElement[];
public abstract getAriaLabelFor(keybinding: Keybinding): string;
......@@ -173,7 +178,7 @@ export abstract class AbstractKeybindingService {
public abstract disposeContext(contextId: number): void;
public abstract getDefaultKeybindings(): string;
public abstract lookupKeybindings(commandId: string): Keybinding[];
public abstract executeCommand(commandId: string, args: any): TPromise<any>;
}
export abstract class KeybindingService extends AbstractKeybindingService implements IKeybindingService {
......
......@@ -337,6 +337,7 @@ export interface IKeybindingService {
executeCommand<T>(commandId: string, args?: any): TPromise<T>;
executeCommand(commandId: string, args?: any): TPromise<any>;
hasCommand(commandId: string): boolean;
}
export const SET_CONTEXT_COMMAND_ID = 'setContext';
......@@ -34,6 +34,7 @@ export class MockKeybindingService implements IKeybindingService {
public dispose(): void { }
public executeCommand(commandId: string, args: any): TPromise<any> { return; }
public hasCommand(commandId) { return false; }
public createKey<T>(key: string, defaultValue: T): IKeybindingContextKey<T> {
return new MockKeybindingContextKey(key, defaultValue);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册