本文整理汇总了TypeScript中vs/platform/instantiation/common/instantiation.ServicesAccessor.get方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ServicesAccessor.get方法的具体用法?TypeScript ServicesAccessor.get怎么用?TypeScript ServicesAccessor.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vs/platform/instantiation/common/instantiation.ServicesAccessor
的用法示例。
在下文中一共展示了ServicesAccessor.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: toResource
export const openFileInNewWindowCommand = (accessor: ServicesAccessor) => {
const windowService = accessor.get(IWindowService);
const editorService = accessor.get(IWorkbenchEditorService);
const fileResource = toResource(editorService.getActiveEditorInput(), { supportSideBySide: true, filter: 'file' });
windowService.pickFileAndOpen({ forceNewWindow: true, dialogOptions: { defaultPath: fileResource ? paths.dirname(fileResource.fsPath) : void 0 } });
};
示例2: toResource
export const openFileInNewWindowCommand = (accessor: ServicesAccessor) => {
const windowService = accessor.get(IWindowService);
const editorService = accessor.get(IWorkbenchEditorService);
const fileResource = toResource(editorService.getActiveEditorInput(), { supportSideBySide: true, filter: 'file' });
windowService.openFilePicker(true, fileResource ? paths.dirname(fileResource.fsPath) : void 0);
};
示例3: services
function services(accessor: ServicesAccessor): { windowService: IWindowService, historyService: IHistoryService, contextService: IWorkspaceContextService, environmentService: IEnvironmentService } {
return {
windowService: accessor.get(IWindowService),
historyService: accessor.get(IHistoryService),
contextService: accessor.get(IWorkspaceContextService),
environmentService: accessor.get(IEnvironmentService)
};
}
示例4:
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));
}
示例5: getOutOfWorkspaceEditorResources
export function getOutOfWorkspaceEditorResources(accessor: ServicesAccessor): URI[] {
const editorService = accessor.get(IEditorService);
const contextService = accessor.get(IWorkspaceContextService);
const fileService = accessor.get(IFileService);
const resources = editorService.editors
.map(editor => toResource(editor, { supportSideBySide: SideBySideEditor.MASTER }))
.filter(resource => !!resource && !contextService.isInsideWorkspace(resource) && fileService.canHandleResource(resource));
return resources as URI[];
}
示例6: getResourceForCommand
const revealInOSHandler = (accessor: ServicesAccessor, resource: URI) => {
// Without resource, try to look at the active editor
resource = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
if (resource) {
const windowsService = accessor.get(IWindowsService);
windowsService.showItemInFolder(paths.normalize(resource.fsPath, true));
} else {
const messageService = accessor.get(IMessageService);
messageService.show(severity.Info, nls.localize('openFileToReveal', "Open a file first to reveal"));
}
};
示例7: getMultiSelectedResources
const revealInOSHandler = (accessor: ServicesAccessor, resource: URI) => {
// Without resource, try to look at the active editor
const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
if (resources.length) {
const windowsService = accessor.get(IWindowsService);
sequence(resources.map(r => () => windowsService.showItemInFolder(paths.normalize(r.fsPath, true))));
} else {
const messageService = accessor.get(IMessageService);
messageService.show(severity.Info, nls.localize('openFileToReveal', "Open a file first to reveal"));
}
};
示例8: function
CommandsRegistry.registerCommand('_workbench.previewHtml', function (
accessor: ServicesAccessor,
resource: URI | string,
position?: EditorViewColumn,
label?: string
) {
const uri = resource instanceof URI ? resource : URI.parse(resource);
label = label || uri.fsPath;
let input: HtmlInput;
const editorGroupService = accessor.get(IEditorGroupsService);
let targetGroup: IEditorGroup = editorGroupService.getGroup(viewColumnToEditorGroup(editorGroupService, position));
if (!targetGroup) {
targetGroup = editorGroupService.activeGroup;
}
// Find already opened HTML input if any
if (targetGroup) {
const editors = targetGroup.editors;
for (let i = 0; i < editors.length; i++) {
const editor = editors[i];
const editorResource = editor.getResource();
if (editor instanceof HtmlInput && editorResource && editorResource.toString() === resource.toString()) {
input = editor;
break;
}
}
}
const extensionsWorkbenchService = accessor.get(IExtensionsWorkbenchService);
const inputOptions: HtmlInputOptions = {
allowScripts: true,
allowSvgs: true,
svgWhiteList: extensionsWorkbenchService.allowedBadgeProviders
};
// Otherwise, create new input and open it
if (!input) {
input = accessor.get(IInstantiationService).createInstance(HtmlInput, label, '', uri, inputOptions);
} else {
input.setName(label); // make sure to use passed in label
}
return accessor.get(IEditorService)
.openEditor(input, { pinned: true }, viewColumnToEditorGroup(editorGroupService, position))
.then(editor => true);
});
示例9: loadExperiments
export function loadExperiments(accessor?: ServicesAccessor): ITelemetryExperiments {
// shortcut since there are currently no experiments (should introduce separate service to load only once)
if (!accessor) {
return {};
}
const storageService = accessor.get(IStorageService);
const configurationService = accessor.get(IConfigurationService);
let {
} = splitExperimentsRandomness(storageService);
return applyOverrides(defaultExperiments, configurationService);
}
示例10: getWebViewEditor
private getWebViewEditor(accessor: ServicesAccessor): WebviewEditor {
const activeEditor = accessor.get(IWorkbenchEditorService).getActiveEditor() as WebviewEditor;
if (activeEditor.isWebviewEditor) {
return activeEditor;
}
return null;
}