当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Registry.add方法代码示例

本文整理汇总了TypeScript中vs/platform/platform.Registry.add方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Registry.add方法的具体用法?TypeScript Registry.add怎么用?TypeScript Registry.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/platform/platform.Registry的用法示例。


在下文中一共展示了Registry.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: registerWorkbenchContribution

	/**
	 * Registers a workbench contribution to the platform that will be loaded when the workbench starts and disposed when
	 * the workbench shuts down.
	 */
	registerWorkbenchContribution(contribution: IWorkbenchContributionSignature): void;

	/**
	 * Returns all workbench contributions that are known to the platform.
	 */
	getWorkbenchContributions(): IWorkbenchContribution[];

	setInstantiationService(service: IInstantiationService): void;
}

class WorkbenchContributionsRegistry extends BaseRegistry<IWorkbenchContribution> implements IWorkbenchContributionsRegistry {

	public registerWorkbenchContribution(ctor: IWorkbenchContributionSignature): void {
		super._register(ctor);
	}

	public getWorkbenchContributions(): IWorkbenchContribution[] {
		return super._getInstances();
	}

	public setWorkbenchContributions(contributions: IWorkbenchContribution[]): void {
		super._setInstances(contributions);
	}
}

Registry.add(Extensions.Workbench, new WorkbenchContributionsRegistry());
开发者ID:gaoxiaojun,项目名称:vscode,代码行数:30,代码来源:contributions.ts

示例2: registerChannel

	/**
	 * Make an output channel known to the output world.
	 */
	registerChannel(id: string, name: string): void;

	/**
	 * Returns the list of channels known to the output world.
	 */
	getChannels(): { id: string, label: string }[];
}

class OutputChannelRegistry implements IOutputChannelRegistry {
	private channels: { id: string, label: string }[];

	constructor() {
		this.channels = [];
	}

	public registerChannel(id: string, label: string): void {
		if (this.channels.every(channel => channel.id !== id)) {
			this.channels.push({ id, label });
		}
	}

	public getChannels(): { id: string, label: string }[] {
		return this.channels;
	}
}

Registry.add(Extensions.OutputChannels, new OutputChannelRegistry());
开发者ID:StateFarmIns,项目名称:vscode,代码行数:30,代码来源:output.ts

示例3: registerStatusbarItem

	}
}

export interface IStatusbarRegistry {
	registerStatusbarItem(descriptor: StatusbarItemDescriptor): void;
	items: StatusbarItemDescriptor[];
}

class StatusbarRegistry implements IStatusbarRegistry {

	private _items: StatusbarItemDescriptor[];

	constructor() {
		this._items = [];
	}

	public get items(): StatusbarItemDescriptor[] {
		return this._items;
	}

	public registerStatusbarItem(descriptor: StatusbarItemDescriptor): void {
		this._items.push(descriptor);
	}
}

export const Extensions = {
	Statusbar: 'workbench.contributions.statusbar'
};

Registry.add(Extensions.Statusbar, new StatusbarRegistry());
开发者ID:1833183060,项目名称:vscode,代码行数:30,代码来源:statusbar.ts

示例4: getPanels

		return this.getComposite(id);
	}

	/**
	 * Returns an array of registered panels known to the platform.
	 */
	public getPanels(): PanelDescriptor[] {
		return this.getComposits();
	}

	/**
	 * Sets the id of the panel that should open on startup by default.
	 */
	public setDefaultPanelId(id: string): void {
		this.defaultPanelId = id;
	}

	/**
	 * Gets the id of the panel that should open on startup by default.
	 */
	public getDefaultPanelId(): string {
		return this.defaultPanelId;
	}
}

export const Extensions = {
	Panels: 'workbench.contributions.panels'
};

Registry.add(Extensions.Panels, new PanelRegistry());
开发者ID:13572293130,项目名称:vscode,代码行数:30,代码来源:panel.ts

示例5: getModeId

		LanguageExtensions.registerCompatMode(def);
	}

	public getModeId(commaSeparatedMimetypesOrCommaSeparatedIds: string): string {
		var modeIds = LanguageExtensions.extractModeIds(commaSeparatedMimetypesOrCommaSeparatedIds);

		if (modeIds.length > 0) {
			return modeIds[0];
		}

		return null;
	}
}

var mR = new EditorModesRegistry();
Registry.add(Extensions.EditorModes, mR);

export function registerMode(def:ILegacyLanguageDefinition): void {
	mR.registerMode(def);
}

export function registerWorkerParticipant(modeId:string, moduleId:string, ctorName?:string): void {
	mR.registerWorkerParticipant(modeId, createAsyncDescriptor0<Modes.IWorkerParticipant>(moduleId, ctorName));
}



// TODO@Martin: find a better home for this code:

// TODO@Martin: modify suggestSupport to return a boolean if snippets should be presented or not
//       and turn this into a real registry
开发者ID:gaoxiaojun,项目名称:vscode,代码行数:31,代码来源:modesRegistry.ts

示例6: return

		return (this.mapActionIdToMeta[id] && this.mapActionIdToMeta[id].alias) || null;
	}

	public getWorkbenchActions(): SyncActionDescriptor[] {
		return collections.values(this.workbenchActions);
	}

	public setWorkbenchActions(actions: SyncActionDescriptor[]): void {
		this.workbenchActions = Object.create(null);
		this.mapActionIdToMeta = Object.create(null);

		actions.forEach(action => this.registerWorkbenchAction(action, ''), this);
	}
}

Registry.add(Extensions.WorkbenchActions, new WorkbenchActionRegistry());

function registerWorkbenchCommandFromAction(descriptor: SyncActionDescriptor): void {
	let when = descriptor.keybindingContext;
	let weight = (typeof descriptor.keybindingWeight === 'undefined' ? KeybindingsRegistry.WEIGHT.workbenchContrib() : descriptor.keybindingWeight);
	let keybindings = descriptor.keybindings;

	let desc: ICommandAndKeybindingRule = {
		id: descriptor.id,
		handler: createCommandHandler(descriptor),
		weight: weight,
		when: when,
		primary: keybindings && keybindings.primary,
		secondary: keybindings && keybindings.secondary,
		win: keybindings && keybindings.win,
		mac: keybindings && keybindings.mac,
开发者ID:GYGit,项目名称:vscode,代码行数:31,代码来源:actionRegistry.ts

示例7: activate

		this._telemetryAppenderCtors.push(ctor);
	}

	public activate(instantiationService: IInstantiationService): void {
		const service = instantiationService.getInstance(ITelemetryService);
		for (let ctor of this._telemetryAppenderCtors) {
			const instance = instantiationService.createInstance(ctor);
			service.addTelemetryAppender(instance);
		}

		// can only be done once
		this._telemetryAppenderCtors = undefined;
	}
}

Registry.add(Extenstions.TelemetryAppenders, new TelemetryAppendersRegistry());

// --- util

export function anonymize(input: string): string {
	if (!input) {
		return input;
	}

	let r = '';
	for (let i = 0; i < input.length; i++) {
		let ch = input[i];
		if (ch >= '0' && ch <= '9') {
			r += '0';
			continue;
		}
开发者ID:Abdullah-Mamun,项目名称:vscode,代码行数:31,代码来源:telemetry.ts


注:本文中的vs/platform/platform.Registry.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。