本文整理匯總了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 });
}