Skip to content

Commit

Permalink
electron: render menu items based on 'isEnabled'
Browse files Browse the repository at this point in the history
This commit updates the logic of rendering menu items with the
electron target to be based on a command being `enabled`. Since
electron does not support graying-out items (enable), we must rely
on hiding these items from the menus since they are no-op when
executed.

Signed-off-by: vince-fugnitto <vincent.fugnitto@ericsson.com>
  • Loading branch information
vince-fugnitto committed May 23, 2020
1 parent 18b128c commit f9d05b1
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ export class ElectronMainMenuFactory {
throw new Error(`Unknown command with ID: ${commandId}.`);
}

// We should omit rendering menu items which are not visible or enabled.
if (!this.commandRegistry.isVisible(commandId, ...args)
|| !this.commandRegistry.isEnabled(commandId, ...args)
|| (!!node.action.when && !this.contextKeyService.match(node.action.when))) {
continue;
}
Expand Down

0 comments on commit f9d05b1

Please sign in to comment.