本文整理汇总了TypeScript中@theia/core/lib/common.MessageService类的典型用法代码示例。如果您正苦于以下问题:TypeScript MessageService类的具体用法?TypeScript MessageService怎么用?TypeScript MessageService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MessageService类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: reloadExternals
protected async reloadExternals(): Promise<void> {
const uri = this.selectedUri();
if (uri && await this.isExternalDefinition(uri)) {
const languageClient = await this.languageClientContribution.languageClient;
// XXX: The result of the request is currently unused.
await languageClient.sendRequest(SadlReloadExternals.TYPE, { uri: uri.toString() });
} else {
this.messageService.warn('Only external model definitions can be used to download external OWL models.');
}
}
示例2: testModel
protected async testModel(): Promise<void> {
const uri = this.selectedUri();
if (uri && await this.isSadl(uri)) {
const languageClient = await this.languageClientContribution.languageClient;
await this.revealOutput();
await languageClient.sendNotification(SadlTestModel.TYPE, { uri: uri.toString() });
} else {
this.messageService.warn('Only SADL models can be tested.');
}
}
示例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.');
}
}