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


TypeScript IInstantiationService.createInstance方法代码示例

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


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

示例1: createSharedProcessContributions

export function createSharedProcessContributions(service: IInstantiationService): IDisposable {
	return combinedDisposable([
		service.createInstance(NodeCachedDataCleaner),
		service.createInstance(LanguagePackCachedDataCleaner),
		service.createInstance(StorageDataCleaner)
	]);
}
开发者ID:donaldpipowitch,项目名称:vscode,代码行数:7,代码来源:contributions.ts

示例2: triggerAndDisposeAction

export function triggerAndDisposeAction(instantitationService: IInstantiationService, telemetryService: ITelemetryService, partService: IPartService, descriptor: SyncActionDescriptor, args: any): TPromise<any> {
	let actionInstance = instantitationService.createInstance(descriptor.syncDescriptor);
	actionInstance.label = descriptor.label || actionInstance.label;

	// don't run the action when not enabled
	if (!actionInstance.enabled) {
		actionInstance.dispose();

		return void 0;
	}

	const from = args && args.from || 'keybinding';
	if (telemetryService) {
		telemetryService.publicLog('workbenchActionExecuted', { id: actionInstance.id, from });
	}

	// run action when workbench is created
	return partService.joinCreation().then(() => {
		try {
			return TPromise.as(actionInstance.run(undefined, { from })).then(() => {
				actionInstance.dispose();
			}, (err) => {
				actionInstance.dispose();
				return TPromise.wrapError(err);
			});
		} catch (err) {
			actionInstance.dispose();
			return TPromise.wrapError(err);
		}
	});
}
开发者ID:naturtle,项目名称:vscode,代码行数:31,代码来源:actionRegistry.ts

示例3: catch

		return lifecycleService.when(LifecyclePhase.Running).then(() => {
			const actionInstance = instantitationService.createInstance(descriptor.syncDescriptor);
			try {
				actionInstance.label = descriptor.label || actionInstance.label;

				// don't run the action when not enabled
				if (!actionInstance.enabled) {
					actionInstance.dispose();

					return void 0;
				}

				const from = args && args.from || 'keybinding';

				return TPromise.as(actionInstance.run(undefined, { from })).then(() => {
					actionInstance.dispose();
				}, (err) => {
					actionInstance.dispose();
					return TPromise.wrapError(err);
				});
			} catch (err) {
				actionInstance.dispose();
				return TPromise.wrapError(err);
			}
		});
开发者ID:AllureFer,项目名称:vscode,代码行数:25,代码来源:actions.ts

示例4: catch

		return lifecycleService.when(LifecyclePhase.Ready).then(() => {
			const actionInstance = instantiationService.createInstance(descriptor.syncDescriptor);
			try {
				actionInstance.label = descriptor.label || actionInstance.label;

				// don't run the action when not enabled
				if (!actionInstance.enabled) {
					actionInstance.dispose();

					return undefined;
				}

				const from = args && args.from || 'keybinding';

				return Promise.resolve(actionInstance.run(undefined, { from })).then(() => {
					actionInstance.dispose();
				}, err => {
					actionInstance.dispose();

					return Promise.reject(err);
				});
			} catch (err) {
				actionInstance.dispose();

				return Promise.reject(err);
			}
		});
开发者ID:eamodio,项目名称:vscode,代码行数:27,代码来源:actions.ts

示例5: createConnectionTree

	/**
	 * Create a Recent Connections tree
	 */
	public static createConnectionTree(treeContainer: HTMLElement, instantiationService: IInstantiationService, useController?: IController): Tree {
		const dataSource = instantiationService.createInstance(RecentConnectionDataSource);
		const renderer = instantiationService.createInstance(ServerTreeRenderer, true);
		const controller = useController ? useController : new DefaultController();
		const dnd = instantiationService.createInstance(RecentConnectionsDragAndDrop);
		const filter = new DefaultFilter();
		const sorter = undefined;
		const accessibilityProvider = new DefaultAccessibilityProvider();

		return new Tree(treeContainer, { dataSource, renderer, controller, dnd, filter, sorter, accessibilityProvider },
			{
				indentPixels: 10,
				twistiePixels: 20,
				ariaLabel: nls.localize('treeAriaLabel', "Recent Connections")
			});
	}
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:19,代码来源:treeCreationUtils.ts

示例6: test

	test('getFilteredResource return markers grouped by resource', function () {
		const marker1 = aMarker('res1');
		const marker2 = aMarker('res2');
		const marker3 = aMarker('res1');
		const marker4 = aMarker('res3');
		const marker5 = aMarker('res4');
		const marker6 = aMarker('res2');
		const testObject = instantiationService.createInstance(TestMarkersModel, [marker1, marker2, marker3, marker4, marker5, marker6]);

		const actuals = testObject.filteredResources;

		assert.equal(4, actuals.length);

		assert.ok(compareResource(actuals[0], 'res1'));
		assert.equal(2, actuals[0].markers.length);
		assert.ok(hasMarker(actuals[0].markers, marker1));
		assert.ok(hasMarker(actuals[0].markers, marker3));

		assert.ok(compareResource(actuals[1], 'res2'));
		assert.equal(2, actuals[1].markers.length);
		assert.ok(hasMarker(actuals[1].markers, marker2));
		assert.ok(hasMarker(actuals[1].markers, marker6));

		assert.ok(compareResource(actuals[2], 'res3'));
		assert.equal(1, actuals[2].markers.length);
		assert.ok(hasMarker(actuals[2].markers, marker4));

		assert.ok(compareResource(actuals[3], 'res4'));
		assert.equal(1, actuals[3].markers.length);
		assert.ok(hasMarker(actuals[3].markers, marker5));
	});
开发者ID:developers23,项目名称:vscode,代码行数:31,代码来源:markersModel.test.ts

示例7: _triggerAndDisposeAction

	private _triggerAndDisposeAction(instantitationService: IInstantiationService, lifecycleService: ILifecycleService, descriptor: SyncActionDescriptor, args: any): Thenable<void> {
		const actionInstance = instantitationService.createInstance(descriptor.syncDescriptor);
		actionInstance.label = descriptor.label || actionInstance.label;

		// don't run the action when not enabled
		if (!actionInstance.enabled) {
			actionInstance.dispose();

			return void 0;
		}

		const from = args && args.from || 'keybinding';

		// run action when workbench is created
		return lifecycleService.when(LifecyclePhase.Running).then(() => {
			try {
				return TPromise.as(actionInstance.run(undefined, { from })).then(() => {
					actionInstance.dispose();
				}, (err) => {
					actionInstance.dispose();
					return TPromise.wrapError(err);
				});
			} catch (err) {
				actionInstance.dispose();
				return TPromise.wrapError(err);
			}
		});
	}
开发者ID:AlexxNica,项目名称:sqlopsstudio,代码行数:28,代码来源:actions.ts

示例8: test

	test('dont show after initial run', function() {
		welcomePageEnvConfig = 'url';
		hideWelcomeSettingsValue = 'true';
		let gettingStarted = instantiation.createInstance(TestGettingStarted);
		assert(gettingStarted.lastUrl === undefined, 'no page is opened after initial run');
		assert(hideWelcomeSettingsValue !== null, 'a flag is set to hide welcome page');
	});
开发者ID:578723746,项目名称:vscode,代码行数:7,代码来源:gettingStarted.test.ts

示例9: test

	test('Alle Drei Zusammen', function () {

		let searchResult = instantiation.createInstance(SearchResult, null);
		let fileMatch = aFileMatch('far\\boo', searchResult);
		let lineMatch = new Match(fileMatch, 'foo bar', 1, 0, 3);

		assert(lineMatch.parent() === fileMatch);
		assert(fileMatch.parent() === searchResult);
	});
开发者ID:dmackerman,项目名称:vscode,代码行数:9,代码来源:searchModel.test.ts


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