动态菜单贡献和 PersistedState

Dynamic Menu contribution and PersistedState

如何在以下问题给出的答案中获取 menu 实例?

Existing Question

使用 EModelService 通过其 id 查找菜单。

@Inject
EModelService modelService;

List<MMenu> list = modelService.findElements(app, "menu id", MMenu.class, 
                          Collections.emptyList(), EModelService.IN_MAIN_MENU);

您必须使用带有 EModelService.IN_MAIN_MENU 标志的 findElements 调用来搜索菜单。