@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
36 lines • 2.19 kB
TypeScript
import { CommandRegistry } from '../command';
import { Disposable } from '../disposable';
import { MenuPath } from './menu-types';
export declare type MenuCommandArguments = [menuPath: MenuPath, command: string, ...commandArgs: unknown[]];
export declare const MenuCommandExecutor: unique symbol;
export interface MenuCommandExecutor {
isVisible(...args: MenuCommandArguments): boolean;
isEnabled(...args: MenuCommandArguments): boolean;
isToggled(...args: MenuCommandArguments): boolean;
executeCommand(...args: MenuCommandArguments): Promise<unknown>;
}
export declare const MenuCommandAdapter: unique symbol;
export interface MenuCommandAdapter extends MenuCommandExecutor {
/** Return values less than or equal to 0 are treated as rejections. */
canHandle(...args: MenuCommandArguments): number;
}
export declare const MenuCommandAdapterRegistry: unique symbol;
export interface MenuCommandAdapterRegistry {
registerAdapter(adapter: MenuCommandAdapter): Disposable;
getAdapterFor(...args: MenuCommandArguments): MenuCommandAdapter | undefined;
}
export declare class MenuCommandExecutorImpl implements MenuCommandExecutor {
protected readonly adapterRegistry: MenuCommandAdapterRegistry;
protected readonly commandRegistry: CommandRegistry;
executeCommand(menuPath: MenuPath, command: string, ...commandArgs: unknown[]): Promise<unknown>;
isVisible(menuPath: MenuPath, command: string, ...commandArgs: unknown[]): boolean;
isEnabled(menuPath: MenuPath, command: string, ...commandArgs: unknown[]): boolean;
isToggled(menuPath: MenuPath, command: string, ...commandArgs: unknown[]): boolean;
protected delegate<T extends keyof MenuCommandExecutor>(menuPath: MenuPath, command: string, commandArgs: unknown[], method: T): ReturnType<MenuCommandExecutor[T]>;
}
export declare class MenuCommandAdapterRegistryImpl implements MenuCommandAdapterRegistry {
protected readonly adapters: MenuCommandAdapter[];
registerAdapter(adapter: MenuCommandAdapter): Disposable;
getAdapterFor(menuPath: MenuPath, command: string, ...commandArgs: unknown[]): MenuCommandAdapter | undefined;
}
//# sourceMappingURL=menu-adapter.d.ts.map