本文整理汇总了TypeScript中vs/base/common/labels.getPathLabel函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getPathLabel函数的具体用法?TypeScript getPathLabel怎么用?TypeScript getPathLabel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPathLabel函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getPathLabel
const folderPicks = folders.map(folder => {
return {
label: folder.name,
description: getPathLabel(resources.dirname(folder.uri), void 0, environmentService),
folder,
resource: folder.uri,
fileKind: FileKind.ROOT_FOLDER
} as IFilePickOpenEntry;
});
示例2: getResourceForCommand
handler: (accessor, resource: URI) => {
resource = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IWorkbenchEditorService));
if (resource) {
const clipboardService = accessor.get(IClipboardService);
clipboardService.writeText(resource.scheme === 'file' ? labels.getPathLabel(resource) : resource.toString());
} else {
const messageService = accessor.get(IMessageService);
messageService.show(severity.Info, nls.localize('openFileToCopy', "Open a file first to copy its path"));
}
}
示例3: onDragStart
public onDragStart(tree: _.ITree, data: _.IDragAndDropData, originalEvent: Mouse.DragMouseEvent): void {
const sources: object[] = data.getData();
let source: object = null;
if (sources.length > 0) {
source = sources[0];
}
// Apply some datatransfer types to allow for dragging the element outside of the application
const resource = this.toResource(source);
if (resource) {
originalEvent.dataTransfer.setData('text/plain', getPathLabel(resource));
}
}
示例4: getWorkspaceLabel
export function getWorkspaceLabel(workspace: (IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier), environmentService: IEnvironmentService, options?: { verbose: boolean }): string {
// Workspace: Single Folder
if (isSingleFolderWorkspaceIdentifier(workspace)) {
return tildify(workspace, environmentService.userHome);
}
// Workspace: Untitled
if (isParent(workspace.configPath, environmentService.workspacesHome, !isLinux /* ignore case */)) {
return localize('untitledWorkspace', "Untitled (Workspace)");
}
// Workspace: Saved
const filename = basename(workspace.configPath);
const workspaceName = filename.substr(0, filename.length - WORKSPACE_EXTENSION.length - 1);
if (options && options.verbose) {
return localize('workspaceNameVerbose', "{0} (Workspace)", getPathLabel(join(dirname(workspace.configPath), workspaceName), null, environmentService));
}
return localize('workspaceName', "{0} (Workspace)", workspaceName);
}
示例5: toResource
export const copyPathCommand = (accessor: ServicesAccessor, resource?: URI) => {
// Without resource, try to look at the active editor
if (!resource) {
const editorGroupService = accessor.get(IEditorGroupService);
const editorService = accessor.get(IWorkbenchEditorService);
const activeEditor = editorService.getActiveEditor();
resource = activeEditor ? toResource(activeEditor.input, { supportSideBySide: true }) : void 0;
if (activeEditor) {
editorGroupService.focusGroup(activeEditor.position); // focus back to active editor group
}
}
if (resource) {
const clipboardService = accessor.get(IClipboardService);
clipboardService.writeText(resource.scheme === 'file' ? getPathLabel(resource) : resource.toString());
} else {
const messageService = accessor.get(IMessageService);
messageService.show(severity.Info, nls.localize('openFileToCopy', "Open a file first to copy its path"));
}
};
示例6: setFile
public setFile(file: uri, provider: IWorkspaceFolderProvider, userHome: IUserHomeProvider): void {
const parent = paths.dirname(file.fsPath);
this.setValue(getBaseLabel(file), parent && parent !== '.' ? getPathLabel(parent, provider, userHome) : '', { title: file.fsPath });
}
示例7:
const text = resources.map(r => r.scheme === Schemas.file ? labels.getPathLabel(r) : r.toString()).join(lineDelimiter);
示例8:
const text = resources.map(r => r.scheme === 'file' ? labels.getPathLabel(r) : r.toString()).join('\n');
示例9: setFile
public setFile(file: uri, provider: IRootProvider, userHome: IUserHomeProvider): void {
const parent = paths.dirname(file.fsPath);
this.setValue(paths.basename(file.fsPath), parent && parent !== '.' ? getPathLabel(parent, provider, userHome) : '', { title: file.fsPath });
}