本文整理汇总了TypeScript中vs/platform/instantiation/common/instantiation.IInstantiationService类的典型用法代码示例。如果您正苦于以下问题:TypeScript IInstantiationService类的具体用法?TypeScript IInstantiationService怎么用?TypeScript IInstantiationService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IInstantiationService类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: activate
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;
}
开发者ID:Abdullah-Mamun,项目名称:vscode,代码行数:10,代码来源:telemetry.ts
示例3:
handler: (accessor: ServicesAccessor) => {
let editorService: IWorkbenchEditorService = accessor.get(IWorkbenchEditorService);
let instantiationService: IInstantiationService = accessor.get(IInstantiationService);
let connectionService: IConnectionManagementService = accessor.get(IConnectionManagementService);
let objectExplorerService: IObjectExplorerService = accessor.get(IObjectExplorerService);
let connectionProfile = TaskUtilities.getCurrentGlobalConnection(objectExplorerService, connectionService, editorService);
let profilerInput = instantiationService.createInstance(ProfilerInput, connectionProfile);
return editorService.openEditor(profilerInput, { pinned: true }, false).then(() => TPromise.as(true));
}
开发者ID:jumpinjackie,项目名称:sqlopsstudio,代码行数:10,代码来源:profilerActions.contribution.ts
示例4: 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
示例5: 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
示例6: _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
示例7: 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
示例8: function
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: function
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
示例10: 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
注:本文中的vs/platform/instantiation/common/instantiation.IInstantiationService类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论