mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 20:06:32 +00:00
Fixed file menu, New Sketch and New File items were not shown in main menu
Signed-off-by: jbicker <jan.bicker@typefox.io>
This commit is contained in:
parent
206b65f138
commit
c564572718
@ -1,15 +1,19 @@
|
|||||||
import * as electron from 'electron';
|
import * as electron from 'electron';
|
||||||
import { injectable } from "inversify";
|
import { injectable, inject } from "inversify";
|
||||||
import { ElectronMenuContribution } from "@theia/core/lib/electron-browser/menu/electron-menu-contribution";
|
import { ElectronMenuContribution } from "@theia/core/lib/electron-browser/menu/electron-menu-contribution";
|
||||||
import { FrontendApplication } from "@theia/core/lib/browser";
|
import { FrontendApplication } from "@theia/core/lib/browser";
|
||||||
import { isOSX } from '@theia/core';
|
import { isOSX } from '@theia/core';
|
||||||
|
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
||||||
|
|
||||||
@injectable()
|
@injectable()
|
||||||
export class ElectronArduinoMenuContribution extends ElectronMenuContribution {
|
export class ElectronArduinoMenuContribution extends ElectronMenuContribution {
|
||||||
onStart(app: FrontendApplication): void {
|
|
||||||
const currentWindow = electron.remote.getCurrentWindow();
|
|
||||||
const createdMenuBar = this.factory.createMenuBar();
|
|
||||||
|
|
||||||
|
@inject(WorkspaceService) protected readonly workspaceService: WorkspaceService;
|
||||||
|
|
||||||
|
onStart(app: FrontendApplication): void {
|
||||||
|
this.workspaceService.onWorkspaceChanged(() => {
|
||||||
|
const createdMenuBar = this.factory.createMenuBar();
|
||||||
|
const currentWindow = electron.remote.getCurrentWindow();
|
||||||
if (isOSX) {
|
if (isOSX) {
|
||||||
electron.remote.Menu.setApplicationMenu(createdMenuBar);
|
electron.remote.Menu.setApplicationMenu(createdMenuBar);
|
||||||
currentWindow.on('focus', () =>
|
currentWindow.on('focus', () =>
|
||||||
@ -18,10 +22,10 @@ export class ElectronArduinoMenuContribution extends ElectronMenuContribution {
|
|||||||
// between them as the user switch windows.
|
// between them as the user switch windows.
|
||||||
electron.remote.Menu.setApplicationMenu(this.factory.createMenuBar())
|
electron.remote.Menu.setApplicationMenu(this.factory.createMenuBar())
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Unix/Windows: Set the per-window menus
|
// Unix/Windows: Set the per-window menus
|
||||||
currentWindow.setMenu(createdMenuBar);
|
currentWindow.setMenu(createdMenuBar);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user