本文整理汇总了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)
]);
}
示例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;
}
示例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));
}
示例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")
});
}
示例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);
}
});
}
示例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);
}
});
}
示例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);
}
});
示例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');
});
示例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));
});
示例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);
}
});