@theia/core
Version:
Theia is a cloud & desktop IDE framework implemented in TypeScript.
56 lines • 2.09 kB
TypeScript
import { Disposable } from '../common/disposable';
import { MaybePromise } from '../common/types';
import { URI } from '../common/uri';
import { QuickInputService, QuickPickItem } from './quick-input';
import { PreferenceService } from './preferences';
export interface OpenWithHandler {
/**
* A unique id of this handler.
*/
readonly id: string;
/**
* A human-readable name of this handler.
*/
readonly label?: string;
/**
* A human-readable provider name of this handler.
*/
readonly providerName?: string;
/**
* A css icon class of this handler.
*/
readonly iconClass?: string;
/**
* Test whether this handler can open the given URI for given options.
* Return a nonzero number if this handler can open; otherwise it cannot.
* Never reject.
*
* A returned value indicating a priority of this handler.
*/
canHandle(uri: URI): number;
/**
* Test whether this handler and open the given URI
* and return the order of this handler in the list.
*/
getOrder?(uri: URI): number;
/**
* Open a widget for the given URI and options.
* Resolve to an opened widget or undefined, e.g. if a page is opened.
* Never reject if `canHandle` return a positive number; otherwise should reject.
*/
open(uri: URI): MaybePromise<object | undefined>;
}
export interface OpenWithQuickPickItem extends QuickPickItem {
handler: OpenWithHandler;
}
export declare class OpenWithService {
protected readonly quickInputService: QuickInputService;
protected readonly preferenceService: PreferenceService;
protected readonly handlers: OpenWithHandler[];
registerHandler(handler: OpenWithHandler): Disposable;
openWith(uri: URI): Promise<object | undefined>;
protected getQuickPickItems(handlers: OpenWithHandler[], defaultHandler?: string): OpenWithQuickPickItem[];
protected getOrder(handler: OpenWithHandler, uri: URI): number;
getHandlers(uri: URI): OpenWithHandler[];
}
//# sourceMappingURL=open-with-service.d.ts.map