Skip to content

Commit

Permalink
empty submenu bug
Browse files Browse the repository at this point in the history
Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed Aug 12, 2022
1 parent e533367 commit 131c0da
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// *****************************************************************************

import { injectable, inject } from '@theia/core/shared/inversify';
import { CommandRegistry, MenuModelRegistry } from '@theia/core/lib/common';
import { Command, CommandRegistry, MenuModelRegistry, MessageService } from '@theia/core/lib/common';
import { CommonMenus, AbstractViewContribution, FrontendApplicationContribution, FrontendApplication } from '@theia/core/lib/browser';
import { GettingStartedWidget } from './getting-started-widget';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
Expand All @@ -29,9 +29,18 @@ export const GettingStartedCommand = {
label: GettingStartedWidget.LABEL
};

export const HELLO_WORLD_SUBMENU = [...CommonMenus.EDIT_FIND, 'hello-world-submenu'];
export const HelloWorldCommand: Command = {
id: 'hello-world-command',
label: 'Echo Hello World'
};

@injectable()
export class GettingStartedContribution extends AbstractViewContribution<GettingStartedWidget> implements FrontendApplicationContribution {

@inject(MessageService)
protected readonly messageService: MessageService;

@inject(FrontendApplicationStateService)
protected readonly stateService: FrontendApplicationStateService;

Expand Down Expand Up @@ -60,6 +69,10 @@ export class GettingStartedContribution extends AbstractViewContribution<Getting
registry.registerCommand(GettingStartedCommand, {
execute: () => this.openView({ reveal: true }),
});
registry.registerCommand(HelloWorldCommand, {
execute: () => this.messageService.info('Hello World!'),
isVisible: () => false,
});
}

override registerMenus(menus: MenuModelRegistry): void {
Expand All @@ -68,5 +81,9 @@ export class GettingStartedContribution extends AbstractViewContribution<Getting
label: GettingStartedCommand.label,
order: 'a10'
});
menus.registerSubmenu(HELLO_WORLD_SUBMENU, 'Test');
menus.registerMenuAction(HELLO_WORLD_SUBMENU, {
commandId: HelloWorldCommand.id,
});
}
}

0 comments on commit 131c0da

Please sign in to comment.