feat:桌面版本IDE的文件菜单下新增“新建项目”菜单,依赖于工程创建插件KylinIDETeam.project-manager是否安装。

This commit is contained in:
chriswang521 2024-06-21 13:50:00 +08:00 committed by wangpenglong
parent 8b454babd2
commit 7f138be7d8
3 changed files with 16 additions and 0 deletions

View File

@ -3289,6 +3289,7 @@
"folders": "文件夹",
"miAbout": "关于(&&A)",
"miConfirmClose": "关闭前确认",
"miCreateProject": "新建项目",
"miMore": "更多(&&M)...",
"miNewWindow": "新建窗口(&&W)",
"miOpenRecent": "打开最近的文件(&&R)",

View File

@ -478,3 +478,13 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '2_open',
order: 4
});
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '1_new',
command: {
id: 'project.createProject',
title: localize({ key: 'miCreateProject', comment: ['&& denotes a mnemonic'] }, "&&New Project")
},
order: 4,
when: ContextKeyExpr.has('hasProjectManager'),
});

View File

@ -21,6 +21,7 @@ import { IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/cont
const HasInstalledExtDependencyExtensionContext = new RawContextKey<boolean>('hasExtDependency', false);
const HasInstalledOfflineExtManagerExtensionContext = new RawContextKey<boolean>('hasOfflineExtManager', false);
const HasInstalledProjectManagerExtensionContext = new RawContextKey<boolean>('hasProjectManager', false);
export class CachedExtensionScanner {
public readonly scannedExtensions: Promise<IExtensionDescription[]>;
@ -29,6 +30,7 @@ export class CachedExtensionScanner {
private HasInstalledExtDependencyExtensionContextKey: IContextKey<boolean>;
private HasInstalledOfflineExtManagerExtensionContextKey: IContextKey<boolean>;
private HasInstalledProjectManagerExtensionContextKey: IContextKey<boolean>;
constructor(
@INotificationService private readonly _notificationService: INotificationService,
@ -45,6 +47,7 @@ export class CachedExtensionScanner {
this.HasInstalledExtDependencyExtensionContextKey = HasInstalledExtDependencyExtensionContext.bindTo(contextKeyService);
this.HasInstalledOfflineExtManagerExtensionContextKey = HasInstalledOfflineExtManagerExtensionContext.bindTo(contextKeyService);
this.HasInstalledProjectManagerExtensionContextKey = HasInstalledProjectManagerExtensionContext.bindTo(contextKeyService);
}
@ -61,6 +64,8 @@ export class CachedExtensionScanner {
this.HasInstalledExtDependencyExtensionContextKey.set(true);
} else if (extension.identifier.value === 'KylinIDETeam.offline-extensions-manager') {
this.HasInstalledOfflineExtManagerExtensionContextKey.set(true);
} else if (extension.identifier.value === 'KylinIDETeam.project-manager') {
this.HasInstalledProjectManagerExtensionContextKey.set(true);
}
}
this._scannedExtensionsResolve(extensions);