本文整理汇总了TypeScript中@theia/core/lib/common/uri.toString函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toString函数的具体用法?TypeScript toString怎么用?TypeScript toString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toString函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: directoryFor
protected async directoryFor(uri: URI): Promise<FileStat | undefined> {
const stat = await this.fileSystem.getFileStat(uri.toString());
if (stat && stat.isDirectory) {
return stat;
}
return this.parentOf(uri);
}
开发者ID:crapo,项目名称:sadlos2,代码行数:7,代码来源:sadl-command-contribution.ts
示例2: URI
execute: async uri => {
if (await this.inSadlProject(uri)) {
this.messageService.warn('Nested SADL projects are not supported.');
} else {
const parent = await this.directoryFor(uri);
if (parent) {
const parentUri = new URI(parent.uri);
const vacantChildUri = this.findVacantChildUri(parentUri, parent, 'Untitled');
const dialog = new SingleTextInputDialog({
title: 'New SADL Project',
initialValue: vacantChildUri.path.base,
validate: name => this.validateFileName(name, parent)
});
try {
const name = await dialog.open();
if (name) {
const desiredUri = parentUri.resolve(name);
await this.fileSystem.createFolder(desiredUri.toString())
const content = this.dotProjectContent(desiredUri.path.base);
await this.fileSystem.createFile(desiredUri.resolve('.project').toString(), { content });
await this.fileSystem.createFile(desiredUri.resolve('settings.json').toString(), { content: DefaultSadlConfigSchema.content() });
const widget = await this.navigatorContribution.widget;
const fileTreeModel = widget.model;
const parent = fileTreeModel.getNode(parentUri.toString());
const toDisposeAfterExpand = fileTreeModel.onChanged(async () => {
const node = fileTreeModel.getNode(desiredUri.toString());
if (node) {
if (SelectableTreeNode.is(node) && !SelectableTreeNode.isSelected(node)) {
fileTreeModel.selectNode(node);
}
if (ExpandableTreeNode.is(node) && ExpandableTreeNode.isCollapsed(node)) {
await fileTreeModel.expandNode(node);
}
toDisposeAfterExpand.dispose();
}
});
if (ExpandableTreeNode.is(parent) && ExpandableTreeNode.isCollapsed(parent)) {
await fileTreeModel.expandNode(parent);
}
}
} catch {
// Dialog cancel.
}
}
}
},
开发者ID:crapo,项目名称:sadlos2,代码行数:46,代码来源:sadl-command-contribution.ts
示例3: isSadl
protected async isSadl(uri: URI | undefined): Promise<boolean> {
return !!uri && this.inSadlProject(uri) && uri.toString().endsWith('.sadl');
}
开发者ID:crapo,项目名称:sadlos2,代码行数:3,代码来源:sadl-command-contribution.ts
示例4: isExternalDefinition
protected async isExternalDefinition(uri: URI | undefined): Promise<boolean> {
return !!uri && this.inSadlProject(uri) && uri.toString().endsWith('.url');
}
开发者ID:crapo,项目名称:sadlos2,代码行数:3,代码来源:sadl-command-contribution.ts
示例5: inSadlProject
protected async inSadlProject(uri: URI | undefined): Promise<boolean> {
if (uri) {
const languageClient = await this.languageClientContribution.languageClient;
const result = await languageClient.sendRequest(SadlProjectRoot.TYPE, { uri: uri.toString() });
return !!result.uri;
}
return false;
}
开发者ID:crapo,项目名称:sadlos2,代码行数:8,代码来源:sadl-command-contribution.ts
注:本文中的@theia/core/lib/common/uri.toString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论