本文整理匯總了TypeScript中@theia/core/lib/browser.SingleTextInputDialog.open方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SingleTextInputDialog.open方法的具體用法?TypeScript SingleTextInputDialog.open怎麽用?TypeScript SingleTextInputDialog.open使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@theia/core/lib/browser.SingleTextInputDialog
的用法示例。
在下文中一共展示了SingleTextInputDialog.open方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getNewKeyPairName
protected async getNewKeyPairName(): Promise<string> {
const dialog = new SingleTextInputDialog({
title: `New SSH key pair`,
initialValue: 'Key pair title'
});
return dialog.open();
}
示例2: getNewKeyPairName
protected async getNewKeyPairName(): Promise<string> {
const dialog = new SingleTextInputDialog({
title: `New SSH key pair`,
initialValue: 'Remote host name/IP, e.g. github.com',
validate: (input) => this.validateHostName(input)
});
return dialog.open();
}
示例3: 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.
}
}
}
},
示例4: runQuery
protected async runQuery(): Promise<void> {
const uri = this.selectedUri();
if (uri && await this.isSadl(uri)) {
const languageClient = await this.languageClientContribution.languageClient;
const dialog = new SingleTextInputDialog({ title: 'Run Query' });
try {
const query = await dialog.open();
if (query) {
await this.revealOutput();
await languageClient.sendNotification(SadlRunQuery.TYPE, { uri: uri.toString(), query });
}
} catch {
// Dialog cancel.
}
} else {
this.messageService.warn('Can run query only against SADL models.');
}
}