()
| 515 | } |
| 516 | |
| 517 | function buildApplicationMenuTemplate() { |
| 518 | const recentProjects = getRecentProjectsForMenu() |
| 519 | const recentItems = recentProjects.length > 0 |
| 520 | ? recentProjects.map((projectPath) => ({ |
| 521 | label: path.basename(projectPath) || projectPath, |
| 522 | click: () => sendMenuEvent('menu-open-recent', projectPath) |
| 523 | })) |
| 524 | : [{ label: '(暂无最近项目)', enabled: false }] |
| 525 | |
| 526 | return [ |
| 527 | { |
| 528 | label: '项目', |
| 529 | submenu: [ |
| 530 | { label: '新建页签', accelerator: 'Ctrl+T', click: () => sendMenuEvent('menu-new-tab') }, |
| 531 | { label: '关闭页签', accelerator: 'Ctrl+W', click: () => sendMenuEvent('menu-close-tab') }, |
| 532 | { type: 'separator' }, |
| 533 | { label: '打开最近', submenu: recentItems }, |
| 534 | { type: 'separator' }, |
| 535 | { role: 'quit', label: '退出' } |
| 536 | ] |
| 537 | } |
| 538 | ] |
| 539 | } |
| 540 | |
| 541 | function refreshApplicationMenu() { |
| 542 | try { |
no test coverage detected