當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ServicesAccessor.get方法代碼示例

本文整理匯總了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 } });
};
開發者ID:armanio123,項目名稱:vscode,代碼行數:8,代碼來源:fileCommands.ts

示例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);
};
開發者ID:diarmaidm,項目名稱:vscode,代碼行數:8,代碼來源:fileCommands.ts

示例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)
	};
}
開發者ID:liunian,項目名稱:vscode,代碼行數:8,代碼來源:workspaceCommands.ts

示例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));
	}
開發者ID:jumpinjackie,項目名稱:sqlopsstudio,代碼行數:10,代碼來源:profilerActions.contribution.ts

示例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[];
}
開發者ID:PKRoma,項目名稱:vscode,代碼行數:11,代碼來源:search.ts

示例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"));
	}
};
開發者ID:servicesgpr,項目名稱:vscode,代碼行數:12,代碼來源:fileCommands.ts

示例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"));
	}
};
開發者ID:JarnoNijboer,項目名稱:vscode,代碼行數:12,代碼來源:fileCommands.ts

示例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);
});
開發者ID:burhandodhy,項目名稱:azuredatastudio,代碼行數:50,代碼來源:html.contribution.ts

示例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);
}
開發者ID:Chan-PH,項目名稱:vscode,代碼行數:15,代碼來源:experiments.ts

示例10: getWebViewEditor

	private getWebViewEditor(accessor: ServicesAccessor): WebviewEditor {
		const activeEditor = accessor.get(IWorkbenchEditorService).getActiveEditor() as WebviewEditor;
		if (activeEditor.isWebviewEditor) {
			return activeEditor;
		}
		return null;
	}
開發者ID:elibarzilay,項目名稱:vscode,代碼行數:7,代碼來源:webviewEditor.ts


注:本文中的vs/platform/instantiation/common/instantiation.ServicesAccessor.get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。