forked from openkylin/kylin-code
在菜单栏添加项目菜单,作为项目创建功能的入口
This commit is contained in:
parent
5c6a93b92e
commit
cdd7765389
|
@ -78,6 +78,7 @@ export class MenuId {
|
|||
static readonly MenubarFileMenu = new MenuId('MenubarFileMenu');
|
||||
static readonly MenubarGoMenu = new MenuId('MenubarGoMenu');
|
||||
static readonly MenubarHelpMenu = new MenuId('MenubarHelpMenu');
|
||||
static readonly MenubarProjectMenu = new MenuId('MenubarProjectMenu');
|
||||
static readonly MenubarLayoutMenu = new MenuId('MenubarLayoutMenu');
|
||||
static readonly MenubarNewBreakpointMenu = new MenuId('MenubarNewBreakpointMenu');
|
||||
static readonly MenubarPanelAlignmentMenu = new MenuId('MenubarPanelAlignmentMenu');
|
||||
|
|
|
@ -296,7 +296,13 @@ export class Menubar {
|
|||
this.setMenuById(editMenu, 'Edit');
|
||||
menubar.append(editMenuItem);
|
||||
}
|
||||
|
||||
//Project
|
||||
if (this.shouldDrawMenu('Project')) {
|
||||
const projectMenu = new Menu();
|
||||
const projectMenuItem = new MenuItem({ label: this.mnemonicLabel(nls.localize({ key: 'mProject', comment: ['&& denotes a mnemonic'] }, "&&Project")), submenu: projectMenu, role: 'help' });
|
||||
this.setMenuById(projectMenu, 'Project');
|
||||
menubar.append(projectMenuItem);
|
||||
}
|
||||
// Selection
|
||||
if (this.shouldDrawMenu('Selection')) {
|
||||
const selectionMenu = new Menu();
|
||||
|
@ -357,6 +363,8 @@ export class Menubar {
|
|||
menubar.append(helpMenuItem);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (menubar.items && menubar.items.length > 0) {
|
||||
Menu.setApplicationMenu(menubar);
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
import { localize } from 'vs/nls';
|
||||
import { MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
|
||||
|
||||
const commandCreateProject = "project.createProject";
|
||||
const commandConfigProject = "project.configProject";
|
||||
const commandPackageProject = "project.buildPackage";
|
||||
const commandDebugProject = "debug.openView";
|
||||
const commandRunProject = "workbench.action.tasks.runTask";
|
||||
const commandBuidProject = "workbench.action.tasks.build";
|
||||
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
|
||||
group: '1_project',
|
||||
command: {
|
||||
id: commandCreateProject,
|
||||
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&创建新的项目")
|
||||
},
|
||||
order: 1
|
||||
//when: ContextKeyExpr.has('extension.helloWorld')
|
||||
});
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
|
||||
group: '1_project',
|
||||
command: {
|
||||
id: commandConfigProject,
|
||||
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&配置当前项目")
|
||||
},
|
||||
order: 2
|
||||
//when: ContextKeyExpr.has('extension.helloWorld')
|
||||
});
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
|
||||
group: '1_project',
|
||||
command: {
|
||||
id: commandBuidProject,
|
||||
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&构建")
|
||||
},
|
||||
order: 3
|
||||
//when: ContextKeyExpr.has('extension.helloWorld')
|
||||
});
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
|
||||
group: '1_project',
|
||||
command: {
|
||||
id: commandDebugProject,
|
||||
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&调试")
|
||||
},
|
||||
order: 4
|
||||
//when: ContextKeyExpr.has('extension.helloWorld')
|
||||
});
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
|
||||
group: '1_project',
|
||||
command: {
|
||||
id: commandRunProject,
|
||||
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&运行")
|
||||
},
|
||||
order: 5,
|
||||
//when: ContextKeyExpr.has('extension.vscode-create-project')
|
||||
});
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarProjectMenu, {
|
||||
group: '1_project',
|
||||
command: {
|
||||
id: commandPackageProject,
|
||||
title: localize({ key: 'miDefault Template', comment: ['&& denotes a mnemonic'] }, "&&打包")
|
||||
},
|
||||
order: 6
|
||||
//when: ContextKeyExpr.has('extension.helloWorld')
|
||||
});
|
||||
|
||||
|
|
@ -114,6 +114,16 @@ MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
|
|||
order: 8
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
|
||||
submenu: MenuId.MenubarProjectMenu,
|
||||
title: {
|
||||
value: 'Project',
|
||||
original: 'Project',
|
||||
mnemonicTitle: localize({ key: 'mProject', comment: ['&& denotes a mnemonic'] }, "&&Project")
|
||||
},
|
||||
order: 10
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
|
||||
submenu: MenuId.MenubarPreferencesMenu,
|
||||
title: {
|
||||
|
@ -125,6 +135,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarMainMenu, {
|
|||
order: 9
|
||||
});
|
||||
|
||||
|
||||
export abstract class MenubarControl extends Disposable {
|
||||
|
||||
protected keys = [
|
||||
|
|
|
@ -346,4 +346,8 @@ import 'vs/workbench/contrib/list/browser/list.contribution';
|
|||
// Audio Cues
|
||||
import 'vs/workbench/contrib/audioCues/browser/audioCues.contribution';
|
||||
|
||||
//workspaces project
|
||||
import 'vs/workbench/browser/actions/projectActions';
|
||||
//#endregion
|
||||
|
||||
//#endregion
|
||||
|
|
Loading…
Reference in New Issue