Disable some menu item

Hi,

theia-menu

I want disable "open…/open workspace …/open recent workspace " item on menu bar like “Save Workspace as …”
Or delete it from menu content.

Is there any idea about this ?

Thanks.

Hi, do some search, it has been asked multiple times:

It’s work “CommonCommands” menu item makes invisible.
like below.

registerMenus(menus: MenuModelRegistry): void { menus.unregisterMenuAction(CommonCommands.ABOUT_COMMAND);
}

But, there is a difficulty in making three items invisible related to the “open …” attached in the picture.

when i write below,

registerMenus(menus: MenuModelRegistry): void {
menus.unregisterMenuAction(CommonMenus.FILE_SETTINGS_SUBMENU_OPEN[1])
}

All File menu is invisible.

How can i do?
Thanks.

Here is an example.

In a nutshell, if you want to completely eliminate a functionality from the IDE, remove the corresponding command and you’re done. (CommandRegistry#unregisterCommand)

If you want to keep the functionality (so that you can access it from the Command Palette), keep the command but remove the menu item from the UI. (MenuModelRegistry.unregisterMenuAction)

1 Like

It’s really helpful for me.
Thank you for help.